Skip to content

Commit

Permalink
use BTreeMap to avoid additional sort
Browse files Browse the repository at this point in the history
  • Loading branch information
dracoooooo committed Sep 19, 2024
1 parent d7bee0a commit 8bb868d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/analytic_engine/src/instance/wal_replayer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
//! Wal replayer
use std::{
collections::{HashMap, VecDeque},
collections::{BTreeMap, HashMap, VecDeque},
fmt::Display,
ops::Range,
sync::Arc,
Expand Down Expand Up @@ -451,7 +451,7 @@ impl RegionBasedReplay {
let mut start_log_idx = 0usize;
let mut curr_log_idx = 0usize;
let mut start_table_id = log_batch.get(start_log_idx).unwrap().table_id;
let mut table_ranges = HashMap::new();
let mut table_ranges = BTreeMap::new();
loop {
let time_to_break = curr_log_idx == log_batch.len();
let found_end_idx = if time_to_break {
Expand Down Expand Up @@ -485,7 +485,6 @@ impl RegionBasedReplay {
for (table_id, ranges) in table_ranges {
table_batches.push(TableBatch { table_id, ranges });
}
table_batches.sort_by_key(|batch| batch.table_id);
}
}

Expand Down

0 comments on commit 8bb868d

Please sign in to comment.