-
Notifications
You must be signed in to change notification settings - Fork 225
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
Two-node vfs2 unit test #674
Closed
Closed
Changes from 1 commit
Commits
Show all changes
73 commits
Select commit
Hold shift + click to select a range
c0e8569
Format sources and delete SM diagram
cole-miller f2f3f83
Rename vfs2_apply_uncommitted and vfs2_unapply
cole-miller f418816
Remove FLUSH state and invariant
cole-miller b137aaf
Remove ad-hoc tracing
cole-miller 64831fe
Implement hash table updates for region0
cole-miller 10ba5f0
Rename vfs2_commit to vfs2_apply
cole-miller be847c7
Allow moving from WTX_ACTIVE to WTX_ACTIVE
cole-miller 19f66d2
Fix rollback test
cole-miller 4ded6bb
Suppose multiple nodes in vfs2 test
cole-miller 0e3054d
Add comments to vfs2 tests
cole-miller 993a673
Use sqlite3_randomness to fill salts
cole-miller bfb0815
Calculate checksums for the WAL header
cole-miller 2d80f98
Don't move to POLLED state unless a transaction was found
cole-miller 2f42cfe
Replace vfs2_wal_frame with dqlite_vfs_frame
cole-miller 0a7cc12
Initialize page size in vfs2_add_uncommitted if not earlier
cole-miller b34e6f3
Remove obsolete comments
cole-miller 0820ad9
Remove redundant out argument from vfs2_poll
cole-miller f4ff5a2
Make vfs2 tests more concise
cole-miller cc0ff2e
Add a new vfs2 test for transaction replication
cole-miller bc18c51
Fix WAL header initialization
cole-miller afa657e
Move shm finalization to maybe_close_entry
cole-miller 8e1f5c9
Use parentheses in OK test macro
cole-miller 67a49a5
Add more extensive comments to vfs2.h
cole-miller 6d21769
Rename open_test_db, accept name as argument
cole-miller cf2690f
Rename check_wals
cole-miller 88a3131
Rename constants describing main file header
cole-miller 7987e0d
Clean up vfs2 rollback test
cole-miller 6febc7b
Add TODOs about long WALs
cole-miller 7834e33
Add comments about handling of the hash table
cole-miller 13fe315
Clarify comment about releasing the write lock
cole-miller ba61610
Initialize W-i header with all unused read marks
cole-miller 73b279d
Fix comparison to SQLITE_OK
cole-miller 4b3c238
Simplify and correct W-i hdr cksum calculations
cole-miller 6c2fdc9
Declare sm relationship in two-node vfs2 test
cole-miller dc3be92
Check validity of WAL headers at startup
cole-miller 05d9e91
Share WAL header calculation between vfs2.c and UT
cole-miller 8912b8e
Require the page size to be known before add_uncommitted
cole-miller 97c9cb3
Split the WAL swap and the WAL header write
cole-miller ffe06d7
Fix handling of page size
cole-miller 7f20503
Factor out shared memory into a struct
cole-miller 549bff9
Walk WAL-cur at startup to set wal_cursor
cole-miller 43ec47c
Rewrite the logic for WAL swap in add_uncommitted
cole-miller 70ef37e
Add comments to vfs2 tests explaining what's going on
cole-miller ad7d864
Clean up startup_both_nonempty test
cole-miller f1adcb5
Add some ancillary state machines for observability
cole-miller 59c9036
Use a NR constant for the wtx sm configuration
cole-miller 6594fb8
Add a new vfs2 test involving a restart
cole-miller d7490da
Work around integer promotion headache
cole-miller 8b31e83
Draw an updated state machine diagram
cole-miller eff99ca
Refactor vfs2_poll
cole-miller ad203cb
Tiny formatting fix
cole-miller 2d9fc07
Make assert_wal_sizes and prepare_wals more flexible
cole-miller e60109b
Disable checkpoint-on-close in vfs2 unit tests
cole-miller d924a06
Fix commit marker calculation
cole-miller f902cba
Add additional checks to leader_and_follower test
cole-miller bfce72d
Use a prepared statement in rollback test
cole-miller fde6dca
Return to separate allocations for shm regions
cole-miller 89f695b
Add a TODO about WALs with non-native byte order
cole-miller aff5f3a
Introduce WAL_MAX_VERSION constant
cole-miller 6c979b3
Remove WAL-prev invalidation
cole-miller 1381861
Fix off-by-one errors in shm region selection
cole-miller 1583dd1
Tweak shm_grow
cole-miller 01f2f92
Assert that SQLite doesn't try to delete the WAL-index
cole-miller c296805
Add missing error handling for shm_add_pgno
cole-miller b3ca21c
Add a TODO about the proper handling of stopping points in walk_wal
cole-miller 2b2877b
Correct description of the WTX_BASE state
cole-miller 64c3600
Add vfs2_unhide to wtx sm diagram
cole-miller 527881b
Correct flags for shm and ckpt state machines
cole-miller 9ac2372
More explicit
cole-miller 0bfc0d9
Remark about old frames in walk_wal
cole-miller f515bef
Remove redundancy between shm_init and shm_restart
cole-miller fe47c99
Fold the first frame write into the loop in vfs2_add_uncommitted
cole-miller 3951d1e
Add a TODO about the broken read mark implementation
cole-miller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are adding code for the tests here because of visibility I wonder if there is a better solution like making the inner fields visible for the tests, an attribute that makes this function uncallable from main code, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm reluctant to move our
struct file
orstruct entry
into vfs2.h---it seems good to maintain the conciseness of that file and keep all the implementation details of vfs2 in one place. As for making the function uncallable outside tests, I agree it would be nice to be able to ifdef out bits of code so that they only exist if dqlite is being built for testing (and this is a good candidate). We'd need to tinker with the build system to implement this, because right now we don't (always) compile source files separately for the installable artifacts and the tests.I think a good local improvement for this function specifically would be to just expose an accessor for the wtx sm, which will be useful also outside the unit tests (e.g. we'll want to sm_relate it to other state machines related to write transactions). What do you think?