Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/risingwavelabs/risingwave i…
Browse files Browse the repository at this point in the history
…nto li0k/storage_fix_correct_commit_ssts
  • Loading branch information
Li0k committed Sep 5, 2024
2 parents 6ec7218 + f2f5827 commit dd1c495
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/storage/hummock_sdk/src/sstable_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl From<&PbSstableInfo> for SstableInfo {

impl From<SstableInfo> for PbSstableInfo {
fn from(sstable_info: SstableInfo) -> Self {
assert_ne!(0, sstable_info.sst_size);
assert!(sstable_info.sst_size > 0 || sstable_info.is_stripped());
PbSstableInfo {
object_id: sstable_info.object_id,
sst_id: sstable_info.sst_id,
Expand Down Expand Up @@ -174,7 +174,7 @@ impl From<SstableInfo> for PbSstableInfo {

impl From<&SstableInfo> for PbSstableInfo {
fn from(sstable_info: &SstableInfo) -> Self {
assert_ne!(0, sstable_info.sst_size);
assert!(sstable_info.sst_size > 0 || sstable_info.is_stripped());
PbSstableInfo {
object_id: sstable_info.object_id,
sst_id: sstable_info.sst_id,
Expand Down Expand Up @@ -212,3 +212,10 @@ impl SstableInfo {
self.key_range = KeyRange::default();
}
}

// Time travel
impl SstableInfo {
pub fn is_stripped(&self) -> bool {
self.object_id == 0
}
}

0 comments on commit dd1c495

Please sign in to comment.