Issue Details (XML | Word | Printable)

Key: CORE-4100
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Vlad Khorsun
Reporter: Vlad Khorsun
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
Firebird Core

Automatic sweep could be run when there is no need for it

Created: 15/May/13 02:24 PM   Updated: 18/Jan/16 03:46 PM
Component/s: Engine
Affects Version/s: 2.1.0, 2.1.1, 2.0.5, 2.1.2, 2.1.3, 3.0 Initial, 2.0.6, 2.5.0, 2.1.4, 2.5.1, 2.0.7, 2.1.5, 2.5.2, 2.1.5 Update 1, 2.5.2 Update 1
Fix Version/s: 3.0 Alpha 1, 2.5.3

QA Status: No test

 Description  « Hide
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.


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

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Vlad Khorsun added a comment - 15/May/13 02:31 PM
The simplest fix is to use just recalculated OIT value to calculate sweep gap