Automatic sweep could be run when there is no need for it [CORE4100] #4428
Labels
affect-version: 2.0.5
affect-version: 2.0.6
affect-version: 2.0.7
affect-version: 2.1.0
affect-version: 2.1.1
affect-version: 2.1.2
affect-version: 2.1.3
affect-version: 2.1.4
affect-version: 2.1.5 Update 1
affect-version: 2.1.5
affect-version: 2.5.0
affect-version: 2.5.1
affect-version: 2.5.2 Update 1
affect-version: 2.5.2
affect-version: 3.0 Initial
component: engine
fix-version: 2.5.3
fix-version: 3.0 Alpha 1
priority: major
type: bug
Submitted by: @hvlad
When sweep succesfully finished its work it advance OIT up to the value of OST that was recorded at sweep start time.
If while sweep running there was started more than sweep_interval transaction, it could be that new OIT value again more than sweep_interval less than new OST value.
But new OIT is not pointed to the rolled back transaction and in fact it is recalculated by the first transaction which is started after sweep advances OIT.
The bug is that transaction_start used OIT value from header page when calculates sweep gap while it is more correct to use just recalculated value of OIT.
Example:
1. tx 1000 was rolled back. Next tx calculated OIT as 1000 and it is stuck value.
2. tx 21001 calculated following numbers:
OIT = 1000, OST = 21000, Next = 21001
3. auto sweep is started. Save_OST = 21000
4. while sweep is running there are new 30000 tx started and committed
5. sweep is done with gc and about to advance OIT
OIT = 1000, OST = 51000, Next = 51001
6. sweep advanced OIT up to the Save_OST, i.e. 21000
7. new tx is started and obtained following numbers:
tra_oldest = 21000
tra_oldest_active = 51002
tra_number = 51002
also it is recalculated new oldest tx number and it is 51001
8. condition below is true
tra_oldest_active - tra_oldest > sweep_interval
therefore sweep is started again
9. when sweep is started database header page will contain OIT = 51001
Commits: 276b7ec 3c7f862 FirebirdSQL/fbt-repository@6af7cc0 FirebirdSQL/fbt-repository@197c7c7
The text was updated successfully, but these errors were encountered: