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.
…synced (#10560)
Summary: WAL append and switch can both happen between
FlushWAL(true /* sync */)
's sync operations and its call toMarkLogsSynced()
. 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 timeMarkLogsSynced()
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 changesMarkLogsSynced()
to only remove inactive WALs from consideration for which all flushed data has been synced.Pull Request resolved: https://github.com/facebook/rocksdb/pull/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