Skip to content

Commit

Permalink
fix(storage): fix assertion (#18413)
Browse files Browse the repository at this point in the history
  • Loading branch information
zwang28 authored Sep 5, 2024
1 parent 3b98b71 commit f2f5827
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 f2f5827

Please sign in to comment.