Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Add test for compaction filter purge #33494

Merged

Conversation

CriesofCarrots
Copy link
Contributor

Problem

I'm exploring removing the primary-index from the Blockstore "special column" keys. But it's difficult to tell if I might be breaking current purge functionality, because there is no test of CompactionFilter-type purge.

Summary of Changes

Add test of compaction-filter purge.
I also exposed compact_range_cf functionality as a method on Database -- I need it for the test, but thought it might be useful for purging the special columns in other contexts. But I could lock it down within mod tests if preferred.

@CriesofCarrots CriesofCarrots requested a review from steviez October 3, 2023 00:09
@codecov
Copy link

codecov bot commented Oct 3, 2023

Codecov Report

Merging #33494 (0b44de3) into master (3eae980) will decrease coverage by 0.1%.
The diff coverage is 100.0%.

@@            Coverage Diff            @@
##           master   #33494     +/-   ##
=========================================
- Coverage    81.7%    81.7%   -0.1%     
=========================================
  Files         802      802             
  Lines      217779   217835     +56     
=========================================
+ Hits       178111   178128     +17     
- Misses      39668    39707     +39     

Copy link
Contributor

@steviez steviez left a comment

Choose a reason for hiding this comment

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

LGTM!

Technically, this test only runs on one of the "special" columns; however, I think that is ok since the compaction filter solely relies on being able to extract the slot from the key ... we'd have much bigger problems if we weren't extracting slot from AddressSignatures

@@ -1287,6 +1287,11 @@ impl Database {
pub fn live_files_metadata(&self) -> Result<Vec<LiveFile>> {
self.backend.live_files_metadata()
}

pub fn compact_range_cf<C: Column + ColumnName>(&self, from: &[u8], to: &[u8]) {
Copy link
Contributor

@steviez steviez Oct 3, 2023

Choose a reason for hiding this comment

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

I also exposed compact_range_cf functionality as a method on Database -- I need it for the test, but thought it might be useful for purging the special columns in other contexts. But I could lock it down within mod tests if preferred.

I'm ok leaving this open - after all, it is a layer down after all and not on Blockstore like you said.

Additionally, I had pondered running a compaction on blockstore of warehouse nodes before we load them up to google bucket so this is a nice kick to run that test soon.

@CriesofCarrots CriesofCarrots merged commit 7adab97 into solana-labs:master Oct 3, 2023
tao-stones pushed a commit to tao-stones/solana that referenced this pull request Oct 6, 2023
* Add Database::compact_range_cf method

* Add test of CompactionFilter purge
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants