Skip to content
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

Remove unnecessary calls to WAL::flushAllPages and clear the dirty flag when flushing pages #3427

Merged
merged 1 commit into from
May 1, 2024

Conversation

benjaminwinger
Copy link
Collaborator

Flushing the WAL after COPY NODE is no longer necessary since the primary key index is no longer reloaded from disk afterwards.

Flushing in Database::commit is only necessary when skipping checkpointing since it also occurs during checkpointing prior to the WAL replay.

Additionally, this appears to fix an issue I mentioned in #3403, where small copies and inserts after doing a large copy take extra time. I'm fairly sure, though I haven't actually confirmed, that it was caused by bypassing the WAL file and writing directly to the hash index file, flushing the hash index file in PrimaryKeyIndex::prepareCommit, but neither evicting nor clearing the dirty flags on the hash index file. Presumably subsequent flushes end up flushing the previously modified pages again since they are all still marked dirty.

…ag when flushing pages

Flushing the WAL after COPY NODE is no longer necessary since the
primary key index is no longer reloaded from disk afterwards.

Flushing in Database::commit is only necessary when skipping
checkpointing since it also occurs during checkpointing prior to the WAL
replay.
@benjaminwinger
Copy link
Collaborator Author

benjaminwinger commented May 1, 2024

I think we only actually need to flush it at the point of commit or rollback, but I don't really understand why the WAL needs to be flushed before rolling back (there are a few tests that fail if we don't).
Edit: Oh, and not even necessary in Database::commit at all since flushing happens in logCommit which is called (indirectly) by commitButKeepActiveWriteTransaction.

@benjaminwinger benjaminwinger merged commit f3971f0 into master May 1, 2024
17 checks passed
@benjaminwinger benjaminwinger deleted the fix-duplicate-wal-flushing branch May 1, 2024 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants