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 b44272d
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 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,13 @@ 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, bucket:{:?}, namespace:{}",
bucket.entry,
self.name()
);

let timer = Instant::now();
{
// Create all wal shards of this bucket.
let mut operator = self.operator.lock().unwrap();
Expand All @@ -406,6 +413,13 @@ 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, cost:{:?}, bucket:{:?}, namespace:{}",
timer.elapsed()
bucket.entry,
self.name(),
);

Ok(bucket)
}

Expand Down Expand Up @@ -1253,7 +1267,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 +1289,6 @@ impl TableOperator {
continue;
}
};

cur_running_tasks -= 1;
}

Ok(())
Expand Down

0 comments on commit b44272d

Please sign in to comment.