Skip to content

Add test for prefix truncation#94

Merged
KShivendu merged 9 commits intomasterfrom
test-prefix-truncate
Aug 5, 2025
Merged

Add test for prefix truncation#94
KShivendu merged 9 commits intomasterfrom
test-prefix-truncate

Conversation

@KShivendu
Copy link
Member

@KShivendu KShivendu commented Jul 30, 2025

We only had a dedicated test for truncate() but not prefix_truncate()

While prefix_truncate() only had an automated property test called check_prefix_truncate()

src/lib.rs Outdated
Comment on lines +1136 to +1139
assert!(wal.entry(truncate_index).is_some());
if truncate_index > 0 {
assert!(wal.entry(truncate_index - 1).is_none());
}
Copy link
Member Author

@KShivendu KShivendu Jul 30, 2025

Choose a reason for hiding this comment

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

@timvisee this is failing even without my changes. I thought when you call prefix_truncate it modifies the wal segment internally to trim early parts. But apparently, that's not the case. It seems to be leaving the entire segment that contains the entry as untouched. Is this expected behaviour? 🤔

I wrote this on basis of test_truncate() which comes just before this.

Copy link
Member

@timvisee timvisee Aug 1, 2025

Choose a reason for hiding this comment

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

Yes, it keeps full segments. We cannot trim/truncate files on disk from the start.

@KShivendu KShivendu merged commit 6b161fb into master Aug 5, 2025
4 checks passed
@KShivendu KShivendu deleted the test-prefix-truncate branch August 5, 2025 12:51
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