Skip to content

Commit

Permalink
stats obkv wal open time cost.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rachelint committed Aug 3, 2023
1 parent ba19cd2 commit d94cfd0
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions wal/src/table_kv_impl/namespace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::{
Arc, Mutex, RwLock,
},
thread,
time::Duration,
time::{Duration, Instant},
};

use common_types::{table::TableId, time::Timestamp};
Expand Down Expand Up @@ -392,6 +392,9 @@ impl<T: TableKv> NamespaceInner<T> {
/// Open bucket, ensure all tables are created, and insert the bucket into
/// the bucket set in memory.
fn open_bucket(&self, bucket: Bucket) -> Result<BucketRef> {
info!("TableKvWal begin to open bucket, namespace:{}", self.name());

let timer = Instant::now();
{
// Create all wal shards of this bucket.
let mut operator = self.operator.lock().unwrap();
Expand All @@ -406,6 +409,12 @@ impl<T: TableKv> NamespaceInner<T> {
let mut bucket_set = self.bucket_set.write().unwrap();
bucket_set.insert_bucket(bucket.clone());

info!(
"TableKvWal success to open bucket, namespace:{}, cost:{:?}",
self.name(),
timer.elapsed()
);

Ok(bucket)
}

Expand Down Expand Up @@ -1253,7 +1262,9 @@ impl TableOperator {
}

match rx.recv_timeout(MONITOR_TABLE_CREATING_PERIOD) {
Ok(Ok(_)) => {}
Ok(Ok(_)) => {
cur_running_tasks -= 1;
}
Ok(Err(e)) => {
stop.store(true, Ordering::Relaxed);
return Err(e).context(LoadBuckets { namespace });
Expand All @@ -1273,8 +1284,6 @@ impl TableOperator {
continue;
}
};

cur_running_tasks -= 1;
}

Ok(())
Expand Down

0 comments on commit d94cfd0

Please sign in to comment.