File Workaround-for-CORE-5566-Server-crashes-while-restor.patch of Package firebird

From: Dmitry Yemanov <dyemanov@users.noreply.github.com>
Date: Mon, 12 Jun 2017 11:19:56 +0300
Subject: Workaround for CORE-5566: Server crashes while restoring backup if the shadow file already exists
Patch-mainline: R3_0_3?
Git-commit: 48d6f37c1a247e890ee1759d1af796c1fc7ae859
References: CORE-5566

---
 src/burp/restore.epp | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/burp/restore.epp b/src/burp/restore.epp
index 5e5f31cbcf5b..d583f0070998 100644
--- a/src/burp/restore.epp
+++ b/src/burp/restore.epp
@@ -7289,6 +7289,24 @@ bool get_relation(BurpGlobals* tdgbl)
 	ext_file_name[0] = '\0';
 	bool		ext_file_name_null = true;
 
+	// Before starting to restore relations, commit everything that was restored
+	// prior to this point. This ensures that no pending error can later affect
+	// other metadata being restored.
+
+	if (!tdgbl->relations)
+	{
+		BURP_verbose (68);
+		// msg 68 committing meta data
+		COMMIT
+		ON_ERROR
+			general_on_error ();
+		END_ERROR;
+
+		EXEC SQL SET TRANSACTION NO_AUTO_UNDO;
+		if (gds_status[1])
+			EXEC SQL SET TRANSACTION;
+	}
+
 	// Pick up relation attributes
 
 	burp_rel* relation = (burp_rel*) BURP_alloc_zero (sizeof(burp_rel));
-- 
2.13.2

openSUSE Build Service is sponsored by