mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 21:23:04 +01:00
Bug CORE-5707 : Begin and end of physical backup in the same transaction could crash engine
Incompatible clauses in the same ALTER DATABASE statement is prohibited now.
This commit is contained in:
parent
df109c3bd8
commit
2a53615e0d
@ -11957,9 +11957,33 @@ bool AlterDatabaseNode::checkPermission(thread_db* tdbb, jrd_tra* transaction)
|
||||
return true;
|
||||
}
|
||||
|
||||
void AlterDatabaseNode::checkClauses(thread_db* tdbb)
|
||||
{
|
||||
if (clauses & CLAUSE_END_BACKUP)
|
||||
{
|
||||
// msg 298: Incompatible ALTER DATABASE clauses: '@1' and '@2'
|
||||
if (clauses & CLAUSE_BEGIN_BACKUP)
|
||||
(Arg::PrivateDyn(298) << Arg::Str("BEGIN BACKUP") << Arg::Str("END BACKUP")).raise();
|
||||
|
||||
if (differenceFile.hasData())
|
||||
(Arg::PrivateDyn(298) << Arg::Str("END BACKUP") << Arg::Str("ADD DIFFERENCE FILE")).raise();
|
||||
|
||||
if (clauses & CLAUSE_DROP_DIFFERENCE)
|
||||
(Arg::PrivateDyn(298) << Arg::Str("END BACKUP") << Arg::Str("DROP DIFFERENCE FILE")).raise();
|
||||
}
|
||||
|
||||
if ((clauses & CLAUSE_DROP_DIFFERENCE) && differenceFile.hasData())
|
||||
{
|
||||
// msg 298: Incompatible ALTER DATABASE clauses: '@1' and '@2'
|
||||
(Arg::PrivateDyn(298) << Arg::Str("ADD DIFFERENCE FILE") << Arg::Str("DROP DIFFERENCE FILE")).raise();
|
||||
}
|
||||
}
|
||||
|
||||
void AlterDatabaseNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
||||
jrd_tra* transaction)
|
||||
{
|
||||
checkClauses(tdbb);
|
||||
|
||||
// Take a LCK_alter_database lock to prevent altering of the database from
|
||||
// parallel transactions
|
||||
|
||||
|
@ -2322,6 +2322,7 @@ protected:
|
||||
private:
|
||||
static void changeBackupMode(thread_db* tdbb, jrd_tra* transaction, unsigned clause);
|
||||
static void defineDifference(thread_db* tdbb, jrd_tra* transaction, const Firebird::PathName& file);
|
||||
void checkClauses(thread_db* tdbb);
|
||||
|
||||
public:
|
||||
bool create; // Is the node created with a CREATE DATABASE command?
|
||||
|
@ -6,7 +6,7 @@ set bulk_insert INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUM
|
||||
('2015-01-07 18:01:51', 'GFIX', 3, 134)
|
||||
('1996-11-07 13:39:40', 'GPRE', 4, 1)
|
||||
('2017-02-05 20:37:00', 'DSQL', 7, 41)
|
||||
('2018-01-08 20:22:00', 'DYN', 8, 298)
|
||||
('2018-01-15 00:15:00', 'DYN', 8, 299)
|
||||
('1996-11-07 13:39:40', 'INSTALL', 10, 1)
|
||||
('1996-11-07 13:38:41', 'TEST', 11, 4)
|
||||
('2015-07-23 14:20:00', 'GBAK', 12, 370)
|
||||
|
@ -2072,6 +2072,7 @@ COMMIT WORK;
|
||||
(NULL, 'grant/revoke', 'DdlNode.epp', NULL, 8, 295, NULL, 'Only @1, DB owner @2 or user with privilege USE_GRANTED_BY_CLAUSE can use GRANTED BY clause', NULL, NULL);
|
||||
('dyn_cant_use_zero_inc_ident', NULL, 'DdlNodes.epp', NULL, 8, 296, NULL, 'INCREMENT BY 0 is an illegal option for identity column @1 of table @2', NULL, NULL);
|
||||
('dyn_concur_alter_database', 'AlterDatabaseNode::execute', 'DdlNodes.epp', NULL, 8, 297, NULL, 'Concurrent ALTER DATABASE is not supported', NULL, NULL);
|
||||
('dyn_incompat_alter_database', 'AlterDatabaseNode::execute', 'DdlNodes.epp', NULL, 8, 298, NULL, 'Incompatible ALTER DATABASE clauses: ''@1'' and ''@2''', NULL, NULL);
|
||||
COMMIT WORK;
|
||||
-- TEST
|
||||
(NULL, 'main', 'test.c', NULL, 11, 0, NULL, 'This is a modified text message', NULL, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user