build(flags): preserve flag-value ABI by pinning new flags to high bits#31
Merged
Conversation
Adding DB_MPOOL_AIO and DB_TXN_SNAPSHOT_SAFE to their set_flags/txn_begin flag groups made the api_flags bit allocator repack those groups, which renumbered the public values of several existing flags (DB_NOFLUSH, DB_NOLOCKING, DB_NOPANIC, DB_OVERWRITE, DB_PANIC_ENVIRONMENT, DB_REGION_INIT, DB_TIME_NOTGRANTED, DB_YIELDCPU, DB_TXN_WAIT). That is an ABI change for the public flag constants. Add a __PIN=<value> annotation to dist/api_flags so a flag can be assigned a fixed bit that the greedy allocator reserves up-front and skips. Pin DB_MPOOL_AIO to 0x00100000 and DB_TXN_SNAPSHOT_SAFE to 0x00000800 -- both free in their APIs at the pre-change baseline -- so every pre-existing public flag keeps its original value and the change is purely additive. Verified: src/dbinc_auto/api_flags.in now differs from the pre-AIO baseline by exactly the two added #defines, with zero value changes to existing flags; regenerated Java/C# constants accordingly. TCL test001/012 and ssi001/002 (which exercise DB_TXN_SNAPSHOT_SAFE) pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Preserve the public flag-constant ABI by pinning the two recently-added
flags to high, previously-unused bits instead of letting the
api_flagsbit allocator repack their groups.
Why
Adding
DB_MPOOL_AIO(AIO Stage 2, #24) andDB_TXN_SNAPSHOT_SAFE(SSI) totheir flag groups made the greedy bit allocator renumber the public values
of several existing flags:
Changing public flag values is an ABI break for the constants (a
precompiled application that baked in the old value and links a new libdb
would pass the wrong flag).
How
Add a
__PIN=<value>annotation todist/api_flags. A pinned flag's bit isreserved in its APIs' masks before the greedy pass and skipped during
allocation, so it takes a fixed bit without disturbing any other flag.
Pin
DB_MPOOL_AIO = 0x00100000andDB_TXN_SNAPSHOT_SAFE = 0x00000800—both free in their respective APIs at the pre-change baseline.
Verification
src/dbinc_auto/api_flags.innow differs from the pre-AIO baseline(
eae0c147e) by exactly the two added#defines — zero value changes toany existing flag.
DbConstantsaccordingly (they revert to baselinevalues).
test001,test012, andssi001/ssi002(which exercise
DB_TXN_SNAPSHOT_SAFE) pass.