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

Cache FileInfo when replaying WAL #3137

Merged
merged 1 commit into from
Mar 29, 2024
Merged

Cache FileInfo when replaying WAL #3137

merged 1 commit into from
Mar 29, 2024

Conversation

benjaminwinger
Copy link
Collaborator

The WAL replayer is currently opening the destination file every time it updates or inserts a page, which is unnecessary and slows down bulk modifications.

In the benchmarks for #2938 it reduced the cost of replaying the WAL (in tmpfs) from 4.5 seconds to 3.2 seconds (where I'm still copying the hash index through the WAL file on the first try, but on additional copies in future significant amounts of data will still need to go through the WAL file).

I don't particularly like this solution, and I feel like it would be better to group them by file (removing the need for hashing and repeatedly looking up the same file), but I don't know of any way reasonable way of doing that without messing up the order that the records are replayed.

I briefly tried using a std::find with a vector of pairs, which gave more or less the same performance. If we allowed c++23 I'd use std::flat_map, but I'm not convinced that the vector of pairs by itself simplifies anything (no hashing, but messier access).

@benjaminwinger benjaminwinger changed the title Cache files when replaying WAL Cache FileInfo when replaying WAL Mar 25, 2024
Copy link

codecov bot commented Mar 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.98%. Comparing base (4d21128) to head (07ec07f).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3137   +/-   ##
=======================================
  Coverage   91.97%   91.98%           
=======================================
  Files        1171     1171           
  Lines       44041    44047    +6     
=======================================
+ Hits        40508    40517    +9     
+ Misses       3533     3530    -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ray6080 ray6080 merged commit fb8f4c7 into master Mar 29, 2024
17 checks passed
@ray6080 ray6080 deleted the wal-replay-cache branch March 29, 2024 02:03
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.

None yet

2 participants