Skip to content

Commit 7cc21bf

Browse files
author
Artyom Ivanov
committed
Do not allow run concurrent sweep instances
1 parent 70a60ba commit 7cc21bf

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

src/include/firebird/impl/msg/jrd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -987,3 +987,4 @@ FB_IMPL_MSG(JRD, 984, incompatible_format_patterns, -901, "HY", "000", "@1 incom
987987
FB_IMPL_MSG(JRD, 985, only_one_pattern_can_be_used, -901, "HY", "000", "Can use only one of these patterns @1")
988988
FB_IMPL_MSG(JRD, 986, can_not_use_same_pattern_twice, -901, "HY", "000", "Cannot use the same pattern twice: @1")
989989
FB_IMPL_MSG(JRD, 987, sysf_invalid_gen_uuid_version, -833, "42", "000", "Invalid GEN_UUID version (@1). Must be 4 or 7")
990+
FB_IMPL_MSG(JRD, 988, sweep_concurrent_instance, -901, "42", "000", "Another instance of sweep is already running")

src/include/gen/Firebird.pas

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5740,6 +5740,7 @@ IProfilerStatsImpl = class(IProfilerStats)
57405740
isc_only_one_pattern_can_be_used = 335545305;
57415741
isc_can_not_use_same_pattern_twice = 335545306;
57425742
isc_sysf_invalid_gen_uuid_version = 335545307;
5743+
isc_sweep_concurrent_instance = 335545308;
57435744
isc_gfix_db_name = 335740929;
57445745
isc_gfix_invalid_sw = 335740930;
57455746
isc_gfix_incmp_sw = 335740932;

src/jrd/Database.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ namespace Jrd
316316
if (old & DBB_sweep_in_progress)
317317
{
318318
clearSweepStarting();
319-
return false;
319+
ERR_post(Arg::Gds(isc_sweep_concurrent_instance));
320320
}
321321

322322
if (dbb_flags.compareExchange(old, old | DBB_sweep_in_progress))
@@ -336,7 +336,7 @@ namespace Jrd
336336
fb_utils::init_status(tdbb->tdbb_status_vector);
337337

338338
dbb_flags &= ~DBB_sweep_in_progress;
339-
return false;
339+
ERR_post(Arg::Gds(isc_sweep_concurrent_instance));
340340
}
341341
}
342342
else

src/jrd/Database.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,8 @@ class Database : public pool_alloc<type_dbb>
657657

658658
// returns true if sweeper thread could start
659659
bool allowSweepThread(thread_db* tdbb);
660-
// returns true if sweep could run
660+
// Returns true if sweep could run.
661+
// Exception can be thrown if another sweep instance is already running.
661662
bool allowSweepRun(thread_db* tdbb);
662663
// reset sweep flag and release sweep lock
663664
void clearSweepFlags(thread_db* tdbb);

0 commit comments

Comments
 (0)