Skip to content

Commit

Permalink
fix(storage): fix hummock.proto check and nits
Browse files Browse the repository at this point in the history
  • Loading branch information
Li0k committed Jun 8, 2022
1 parent 4b39ef2 commit 8980df5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
3 changes: 1 addition & 2 deletions proto/hummock.proto
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ message CompactTask {
repeated common.ParallelUnitMapping vnode_mappings = 11;
// compaction group the task belongs to
uint64 compaction_group_id = 12;

// exist_table_id for compaction drop key
// existing_table_ids for compaction drop key
repeated uint32 existing_table_ids = 13;
}

Expand Down
6 changes: 3 additions & 3 deletions src/meta/src/hummock/hummock_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub struct HummockManager<S: MetaStore> {
// TODO: refactor to remove this field
config: Arc<CompactionConfig>,

// for compaction to get some info (e.g. exist_table_id)
// for compaction to get some info (e.g. existing_table_ids)
fragment_manager: FragmentManagerRef<S>,
}

Expand Down Expand Up @@ -579,7 +579,7 @@ where
task_id as HummockCompactionTaskId,
compaction_group_id,
);
let exist_table_id_from_meta = self.fragment_manager.exist_table_ids().await?;
let existing_table_ids_from_meta = self.fragment_manager.existing_table_ids().await?;
let ret = match compact_task {
None => Ok(None),
Some(mut compact_task) => {
Expand Down Expand Up @@ -635,7 +635,7 @@ where
}

// to found exist table_id from
if exist_table_id_from_meta.contains(&table_id) {
if existing_table_ids_from_meta.contains(&table_id) {
compact_task.existing_table_ids.push(table_id);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/meta/src/stream/meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,9 @@ where
Ok(())
}

// exist_table_id include the table_ref_id (source and materialized_view) + internal_table_id
// existing_table_ids include the table_ref_id (source and materialized_view) + internal_table_id
// (stateful executor)
pub async fn exist_table_ids(&self) -> Result<HashSet<u32>> {
pub async fn existing_table_ids(&self) -> Result<HashSet<u32>> {
let mut result_set = HashSet::default();
let map = &self.core.read().await.table_fragments;

Expand Down
6 changes: 3 additions & 3 deletions src/storage/src/hummock/compactor_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,14 +269,14 @@ mod tests {
let val = Bytes::from(b"0"[..].repeat(4 << 20)); // 4MB value

let drop_table_id = 1;
let exist_table_id = 2;
let existing_table_ids = 2;
let kv_count = 128;
let mut epoch: u64 = 1;
for index in 0..kv_count {
let table_id = if index % 2 == 0 {
drop_table_id
} else {
exist_table_id
existing_table_ids
};
let keyspace = Keyspace::table_root(storage.clone(), &TableId::new(table_id));
let mut write_batch = keyspace.state_store().start_write_batch();
Expand Down Expand Up @@ -359,7 +359,7 @@ mod tests {
let mut scan_count = 0;
for (k, _) in scan_result {
let table_id = get_table_id(&k).unwrap();
assert_eq!(table_id, exist_table_id);
assert_eq!(table_id, existing_table_ids);
scan_count += 1;
}
assert_eq!(key_count, scan_count);
Expand Down

0 comments on commit 8980df5

Please sign in to comment.