Skip to content

Commit

Permalink
fix(storage): add assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
Li0k committed Sep 5, 2024
1 parent dd1c495 commit 2401f34
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/storage/hummock_sdk/src/sstable_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ impl SstableInfo {

impl From<PbSstableInfo> for SstableInfo {
fn from(pb_sstable_info: PbSstableInfo) -> Self {
assert!(pb_sstable_info.table_ids.is_sorted());
Self {
object_id: pb_sstable_info.object_id,
sst_id: pb_sstable_info.sst_id,
Expand Down Expand Up @@ -100,6 +101,7 @@ impl From<PbSstableInfo> for SstableInfo {

impl From<&PbSstableInfo> for SstableInfo {
fn from(pb_sstable_info: &PbSstableInfo) -> Self {
assert!(pb_sstable_info.table_ids.is_sorted());
Self {
object_id: pb_sstable_info.object_id,
sst_id: pb_sstable_info.sst_id,
Expand Down Expand Up @@ -137,6 +139,7 @@ impl From<&PbSstableInfo> for SstableInfo {
impl From<SstableInfo> for PbSstableInfo {
fn from(sstable_info: SstableInfo) -> Self {
assert!(sstable_info.sst_size > 0 || sstable_info.is_stripped());
assert!(sstable_info.table_ids.is_sorted());
PbSstableInfo {
object_id: sstable_info.object_id,
sst_id: sstable_info.sst_id,
Expand Down Expand Up @@ -175,6 +178,7 @@ impl From<SstableInfo> for PbSstableInfo {
impl From<&SstableInfo> for PbSstableInfo {
fn from(sstable_info: &SstableInfo) -> Self {
assert!(sstable_info.sst_size > 0 || sstable_info.is_stripped());
assert!(sstable_info.table_ids.is_sorted());
PbSstableInfo {
object_id: sstable_info.object_id,
sst_id: sstable_info.sst_id,
Expand Down

0 comments on commit 2401f34

Please sign in to comment.