8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 03:23:03 +01:00

Backported fix for CORE-3649: gbak deletes backup file even if error happens when it's already successfully closed

This commit is contained in:
alexpeshkoff 2012-03-03 16:48:40 +00:00
parent e8ccfa6d0c
commit 950f499f12
5 changed files with 18 additions and 3 deletions

View File

@ -523,8 +523,8 @@ int BACKUP_backup(const TEXT* dbb_file, const TEXT* file_name)
// Finish up
put(tdgbl, (UCHAR) rec_end);
FB_UINT64 cumul_count = MVOL_fini_write(&tdgbl->io_cnt, &tdgbl->io_ptr);
tdgbl->action->act_action = ACT_backup_fini;
BURP_verbose(176, SafeArg() << cumul_count);
// msg 176 closing file, committing, and finishing. %ld bytes written

View File

@ -1107,6 +1107,10 @@ int gbak(Firebird::UtilSvc* uSvc)
{
// All calls to exit_local(), normal and error exits, wind up here
tdgbl->burp_throw = false;
if (tdgbl->action->act_action == ACT_backup_fini)
{
tdgbl->exit_code = 0;
}
exit_code = tdgbl->exit_code;
}
@ -1183,7 +1187,8 @@ void BURP_abort()
**************************************/
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
BURP_print(true, 83);
BURP_print(true, tdgbl->action->act_action == ACT_backup_fini ? 351 : 83);
// msg 351 Error closing database, but backup file is OK
// msg 83 Exiting before completion due to errors
tdgbl->uSvc->started();

View File

@ -764,6 +764,7 @@ enum act_t {
ACT_unknown, // action is unknown
ACT_backup,
ACT_backup_split,
ACT_backup_fini,
ACT_restore,
ACT_restore_join
};

View File

@ -20,7 +20,7 @@ set bulk_insert INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUM
('1996-11-07 13:39:40', 'INSTALL', 10, 1)
('1996-11-07 13:38:41', 'TEST', 11, 4)
-- Reserved 326-334 by CVC for FB3
('2009-11-19 11:48:00', 'GBAK', 12, 343)
('2012-03-03 19:55:44', 'GBAK', 12, 352)
('2009-06-05 23:07:00', 'SQLERR', 13, 970)
('1996-11-07 13:38:42', 'SQLWARN', 14, 613)
('2006-09-10 03:04:31', 'JRD_BUGCHK', 15, 307)

View File

@ -2497,6 +2497,15 @@ ERROR: Backup incomplete', NULL, NULL);
(NULL, 'burp_usage', 'burp.cpp', NULL, 12, 325, NULL, 'general options are:', NULL, NULL);
('gbak_invalid_metadata', 'general_on_error', 'restore.epp', NULL, 12, 341, NULL, 'Invalid metadata detected. Use -FIX_FSS_METADATA option.', NULL, NULL);
('gbak_invalid_data', 'get_data', 'restore.epp', NULL, 12, 342, NULL, 'Invalid data detected. Use -FIX_FSS_DATA option.', NULL, NULL);
(NULL, 'put_asciz', 'backup.epp', NULL, 12, 343, NULL, 'text for attribute @1 is too large in @2, truncating to @3 bytes', NULL, NULL);
(NULL, 'restore.epp', 'burp.cpp', 'do not change the param order', 12, 344, NULL, 'Expected backup version @2..@3. Found @1', NULL, NULL);
(NULL, 'write_relations', 'backup.epp', NULL, 12, 345, NULL, ' writing view @1', NULL, NULL);
(NULL, 'get_relation', 'restore.epp', NULL, 12, 346, NULL, ' table @1 is a view', NULL, NULL);
(NULL, 'write_secclasses', 'backup.epp', NULL, 12, 347, NULL, 'writing security classes', NULL, NULL);
(NULL, 'BACKUP_backup', 'backup.epp', NULL, 12, 348, NULL, 'database format @1 is too old to backup', NULL, NULL);
(NULL, 'restore', 'restore.epp', NULL, 12, 349, NULL, 'backup version is @1', NULL, NULL);
(NULL, 'fix_system_generators', 'restore.epp', NULL, 12, 350, NULL, 'fixing system generators', NULL, NULL);
(NULL, 'BURP_abort', 'burp.cpp', NULL, 12, 351, NULL, 'Error closing database, but backup file is OK', NULL, NULL);
-- SQLERR
(NULL, NULL, NULL, NULL, 13, 1, NULL, 'Firebird error', NULL, NULL);
(NULL, NULL, NULL, NULL, 13, 74, NULL, 'Rollback not performed', NULL, NULL);