Skip to content

Commit

Permalink
fix: Avoid hang when getting blockId bitmap (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
zuston authored Jan 16, 2025
1 parent 9b6e913 commit b364f50
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ pub struct App {
pub(crate) registry_timestamp: u128,

// key: shuffle_id, val: shuffle's all block_ids bitmap
block_id_bitmap: DashMap<i32, RwLock<Treemap>>,
block_id_bitmap: DashMap<i32, Arc<RwLock<Treemap>>>,

// key: (shuffle_id, partition_id)
partition_meta_infos: DashMap<(i32, i32), PartitionedMeta>,
Expand Down Expand Up @@ -486,7 +486,8 @@ impl App {
let treemap = self
.block_id_bitmap
.entry(*shuffle_id)
.or_insert_with(|| RwLock::new(Treemap::new()));
.or_insert_with(|| Arc::new(RwLock::new(Treemap::new())))
.clone();
let treemap = treemap.read();
let mut retrieved = Treemap::new();
for element in treemap.iter() {
Expand All @@ -505,7 +506,8 @@ impl App {
let treemap = self
.block_id_bitmap
.entry(*shuffle_id)
.or_insert_with(|| RwLock::new(Treemap::new()));
.or_insert_with(|| Arc::new(RwLock::new(Treemap::new())))
.clone();
let mut treemap = treemap.write();
for block_id in ctx.block_ids {
treemap.add(block_id as u64);
Expand Down

0 comments on commit b364f50

Please sign in to comment.