Skip to content

Commit

Permalink
fix(storage): remove compaction_group_index from pin version
Browse files Browse the repository at this point in the history
  • Loading branch information
Li0k committed Jun 17, 2024
1 parent 7556cbb commit f151c40
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
4 changes: 1 addition & 3 deletions src/storage/src/hummock/event_handler/uploader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use risingwave_common::must_match;
use risingwave_hummock_sdk::table_watermark::{
TableWatermarks, VnodeWatermark, WatermarkDirection,
};
use risingwave_hummock_sdk::{CompactionGroupId, HummockEpoch, LocalSstableInfo, SyncResult};
use risingwave_hummock_sdk::{HummockEpoch, LocalSstableInfo, SyncResult};
use thiserror_ext::AsReport;
use tokio::sync::oneshot;
use tokio::task::JoinHandle;
Expand Down Expand Up @@ -84,7 +84,6 @@ pub struct UploadTaskInfo {
pub task_size: usize,
pub epochs: Vec<HummockEpoch>,
pub imm_ids: HashMap<LocalInstanceId, Vec<ImmId>>,
pub compaction_group_index: Arc<HashMap<TableId, CompactionGroupId>>,
}

impl Display for UploadTaskInfo {
Expand Down Expand Up @@ -241,7 +240,6 @@ impl UploadingTask {
task_size,
epochs,
imm_ids,
compaction_group_index: context.pinned_version.compaction_group_index(),
};
context
.buffer_tracker
Expand Down
13 changes: 2 additions & 11 deletions src/storage/src/hummock/local_version/pinned_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use std::collections::{BTreeMap, HashMap};
use std::collections::BTreeMap;
use std::iter::empty;
use std::sync::Arc;
use std::time::{Duration, Instant};
Expand Down Expand Up @@ -75,7 +75,6 @@ impl Drop for PinnedVersionGuard {
#[derive(Clone)]
pub struct PinnedVersion {
version: Arc<HummockVersion>,
compaction_group_index: Arc<HashMap<TableId, CompactionGroupId>>,
guard: Arc<PinnedVersionGuard>,
}

Expand All @@ -85,35 +84,27 @@ impl PinnedVersion {
pinned_version_manager_tx: UnboundedSender<PinVersionAction>,
) -> Self {
let version_id = version.id;
let compaction_group_index = version.state_table_info.build_table_compaction_group_id();

PinnedVersion {
version: Arc::new(version),
compaction_group_index: Arc::new(compaction_group_index),
guard: Arc::new(PinnedVersionGuard::new(
version_id,
pinned_version_manager_tx,
)),
}
}

pub(crate) fn compaction_group_index(&self) -> Arc<HashMap<TableId, CompactionGroupId>> {
self.compaction_group_index.clone()
}

pub fn new_pin_version(&self, version: HummockVersion) -> Self {
assert!(
version.id >= self.version.id,
"pinning a older version {}. Current is {}",
version.id,
self.version.id
);
let version_id = version.id;
let compaction_group_index = version.state_table_info.build_table_compaction_group_id();
let version_id: u64 = version.id;

PinnedVersion {
version: Arc::new(version),
compaction_group_index: Arc::new(compaction_group_index),
guard: Arc::new(PinnedVersionGuard::new(
version_id,
self.guard.pinned_version_manager_tx.clone(),
Expand Down

0 comments on commit f151c40

Please sign in to comment.