Skip to content

Commit

Permalink
Ensure writes to WAL tail during FlushWAL(true /* sync */) will be … (
Browse files Browse the repository at this point in the history
#358)

* Ensure writes to WAL tail during `FlushWAL(true /* sync */)` will be synced (facebook#10560)

Summary:
WAL append and switch can both happen between `FlushWAL(true /* sync */)`'s sync operations and its call to `MarkLogsSynced()`. We permit this since locks need to be released for the sync operations. Such an appended/switched WAL is both inactive and incompletely synced at the time `MarkLogsSynced()` processes it.

Prior to this PR, `MarkLogsSynced()` assumed all inactive WALs were fully synced and removed them from consideration for future syncs. That was wrong in the scenario described above and led to the latest append(s) never being synced. This PR changes `MarkLogsSynced()` to only remove inactive WALs from consideration for which all flushed data has been synced.

Pull Request resolved: facebook#10560

Test Plan: repro unit test for the scenario described above. Without this PR, it fails on "key2" not found

Reviewed By: riversand963

Differential Revision: D38957391

Pulled By: ajkr

fbshipit-source-id: da77175eba97ff251a4219b227b3bb2d4843ed26

* comment out test

Signed-off-by: Connor1996 <[email protected]>

---------

Signed-off-by: Connor1996 <[email protected]>
Co-authored-by: Andrew Kryczka <[email protected]>
  • Loading branch information
Connor1996 and ajkr authored Mar 27, 2024
1 parent ce0ea61 commit c38a224
Show file tree
Hide file tree
Showing 4 changed files with 440 additions and 22 deletions.
Loading

0 comments on commit c38a224

Please sign in to comment.