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

Restore may hang if the database contains more than 4 billion records [CORE5228] #5507

Closed
firebird-automations opened this issue May 6, 2016 · 3 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @dyemanov

The problem of the current restore process is that every record is inserted in its own looper roundtrip and thus using its own savepoint. The savepoint number is 32-bit and it wraps around after 2^32 iterations. This particular issue is not related to GBAK, it's common to any single transaction modifying billions of records. Fortunately, old dumb savepoint handling is tolerate to such a wraparound in trivial cases, so GBAK is not affected.

Second part of the problem appears when this transaction has also a deferred work (uncommitted DDL). AFAIU, the legacy code implicitly assumes that there cannot be savepoint number zero, but it becomes possible due to wraparound. So DFW_merge_work() is called with old_sav_number = 0 and new_sav_number = 0 and it enters an infinite loop, causing a hang.

Workaround for GBAK's restore is to use the -o switch, which restores every table in its own transaction (and also separates a DDL transaction from multiple DML transactions).

A noticable improvement could be to avoid savepoints during restore at all. IIRC, InterBase has added the isc_tpb_no_savepoints feature. But I leave this for another ticket.

Commits: dce0b4c 522f4c0

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

assignee: Dmitry Yemanov [ dimitr ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

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

resolution: Fixed [ 1 ]

Fix Version: 3.0.1 [ 10730 ]

Fix Version: 4.0 Alpha 1 [ 10731 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

QA Status: No test => Cannot be tested

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