Skip to content

Improve WAL mapper stability under I/O pressure#110

Open
zablotchi wants to merge 3 commits intomainfrom
pr/wal-mapper-stability
Open

Improve WAL mapper stability under I/O pressure#110
zablotchi wants to merge 3 commits intomainfrom
pr/wal-mapper-stability

Conversation

@zablotchi
Copy link
Collaborator

  • Add WalCleanupThread for background file deletion and Arc dropping
  • Increase INITIAL_MAPS_BUFFER from 2 to 10
  • Increase get_writeable_map timeout from 10s to 60s
  • Update tests to use max_maps >= 16 to accommodate increased buffer

- Add WalCleanupThread for background file deletion and Arc dropping
- Increase INITIAL_MAPS_BUFFER from 2 to 10
- Increase get_writeable_map timeout from 10s to 60s
- Update tests to use max_maps >= 16 to accommodate increased buffer
@zablotchi zablotchi marked this pull request as ready for review January 12, 2026 13:32
@zablotchi zablotchi requested a review from andll January 12, 2026 13:32
Copy link
Collaborator

@andll andll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR actually have quite a bit of changes that simply rename variables/functions etc. This makes PR hard to review, because for every line you need to figure out if this is just renaming or some other change. Is it possible to rollback all the naming changes? If we think some names are confusing we can rename in a separate PR

const MAX_ATTEMPTS: usize = 60 * 1000;
for _ in 0..MAX_ATTEMPTS {
let Some(map) = self.wal.get_map(map) else {
let Some(map) = self.wal.get_map(map_id) else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change just renames variable, lets avoid changes like that

@zablotchi zablotchi requested a review from andll January 16, 2026 15:56
DropMaps(Arc<WalMaps>),
}

pub(crate) struct WalCleanupThread {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you look at wal mapper and others, the naming convention is usually this:

  • Struct that hold controls and used externally is called WalMapper
  • Struct that hold data needed for thread is called WalMapperThread

Since we use this pattern universally can you name structs in this file in similar manner (e.g. WalCleanup and WalCleanupThread)


impl WalCleanupWorker {
pub fn run(self) {
while let Ok(msg) = self.receiver.recv() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add thread utilization metric here similar to other threads like mapper etc?

std::fs::remove_file(&path).expect("Failed to remove wal file");
}
WalCleanupMessage::DropMaps(maps) => {
drop(maps); // Explicit drop; munmap happens here in background
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe remove 'in background' since its not clear what it means

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