Repository navigation
fix(#11805): a one-file sync no longer waits for a full sync, retries a failed directory force, and does not spin on a refused page - #12311
Conversation
…c, retries a failed directory force, and does not spin on a refused page - FileManager.syncFile holds the file's own force lock instead of the database-wide sync lock, so a vector graph build no longer waits out a WAL rotation fsyncing every file. PaginatedComponentFile counts its metadata forces and the directory forces that followed them, so a one-file sync arriving between a full sync's file loop and its directory force still forces the directory. - A directory force that fails leaves its files owing it; the next sync, full or of one file, retries it. A force skipped because fsync is off or the platform has none counts as done (FileUtils.skipsDirectoryForce). - waitPagesOfFileAreFlushed sleeps the poll interval when only copies the disk refused are left, which the drain wait does not count as pending. - Follow-ups from the review of ArcadeData#11807, ported onto the implementation merged in ArcadeData#11827.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 6 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Tick the box to add this pull request to the merge queue (same as
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
Triage: Thanks for the follow-up. The design reads sound: the lock order is consistent ( Changes needed:
The production changes look correct and well scoped. |
Main's fix for ArcadeData#11932 (a vector index build waits only for its own file's fsync) landed the same design as three of the four follow-ups of this PR: the file's own force lock instead of the database-wide sync lock, the per-file directory bookkeeping (a generation pair), and a directory force that fails or is skipped. FileManager, PaginatedComponentFile, FileUtils and the PaginatedComponentFileSyncStateTest additions now take main's version. What is left is the drain wait of PageManagerFlushThread.waitPagesOfFileAreFlushed: a copy the disk refused is not counted as pending, so awaitDrain returned at once and the loop spun on the CPU until its deadline. OneFileSyncTest keeps the test for it; the test of the one-file sync not queueing behind a full sync is dropped, main's PaginatedComponentFileSyncStateTest and Issue11932VectorIndexBuildDoesNotWaitForASyncPassTest cover it.
What does this PR do?
Follow-ups to the one-file sync that #11827 merged for #11805. They come from the review of the superseded #11807 and are ported onto the merged implementation:
FileManager.syncFileholds the file's own force lock (PaginatedComponentFile.getForceLock()) instead of the database-wide sync lock. A vector graph build no longer waits out a WAL rotation fsyncing every file of the database (about 1.1 s per call during an application ingest, with the searches of the index queued behind the build lock).forceIfModifiedholds the same lock from its claim to the end of its force, so asyncFiles()reaching the file while a one-file force is in flight still waits for it.PaginatedComponentFilecounts its metadata forces and the directory forces that followed them (directoryForceOwed/directorySynced), and either sync forces a directory still owed.FileUtils.skipsDirectoryForce).PageManagerFlushThread.waitPagesOfFileAreFlushedsleeps the poll interval when the only pages left are copies the disk refused. Those are not counted as pending, so the drain wait returned at once and the loop spun on the CPU until its deadline, while the caller held the graph build lock.Not ported: #11807's "a file closed between the lookup and the force reports not synced". Main's
syncFiledeliberately answerstruefor a file that is no longer open, and a file closed mid-sync is the same case.Motivation
#11805 (search p95 of 2.4 s in an application ingest). #11827 forces only the graph file, but the call still queues behind any full sync in progress.
Related issues
#11805, #11807, #11827
Additional Notes
Tests:
OneFileSyncTest.aOneFileSyncDoesNotWaitForAFullSyncInProgress: a thread holds the database-wide sync lock andsyncFilemust still complete. On main it times out (TimeoutExceptionafter 10 s).OneFileSyncTest.waitingOnlyForARefusedPageDoesNotSpin: one refused page, a 1 s wait. On main the wait used 892 ms of CPU; the limit is 300 ms.PaginatedComponentFileSyncStateTest.aOneFileSyncForcesTheDirectoryAFullSyncStillOwesandaFailedDirectoryForceIsRetriedByTheNextSync. Both read the new directory bookkeeping, so they cannot run on main.Tests run, engine
com/arcadedb/engine/**andcom/arcadedb/index/vector/**without theslowandbenchmarkgroups: 3,424 tests, 3,421 passed, 0 skipped, 3 failed. All three failures are inReplicatedApplyPublicationTest(aTransactionalReadIsServedWhileEntriesAreAppliedBackToBack,aPlaceholderReadIsServedWhileEntriesAreAppliedBackToBack,aProofOfCorruptionStandsWhileEntriesAreAppliedBackToBack), the timing test that also fails on main's CI.Checklist
mvn clean packagecommand