Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic sweep could be run when there is no need for it [CORE4100] #4428

Closed
firebird-issue-importer opened this issue May 15, 2013 · 5 comments

Comments

@firebird-issue-importer

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

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented May 15, 2013

Modified by: @hvlad

assignee: Vlad Khorsun [ hvlad ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented May 15, 2013

Commented by: @hvlad

The simplest fix is to use just recalculated OIT value to calculate sweep gap

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented May 15, 2013

Modified by: @hvlad

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0 Alpha 1 [ 10331 ]

Fix Version: 2.5.3 [ 10461 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Sep 22, 2015

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jan 18, 2016

Modified by: @pavel-zotov

status: Closed [ 6 ] => Closed [ 6 ]

QA Status: No test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment