From d94cfd0df21e6c343db4ce81b345e8ceab9d81a6 Mon Sep 17 00:00:00 2001 From: kamille Date: Thu, 3 Aug 2023 19:09:52 +0800 Subject: [PATCH] stats obkv wal open time cost. --- wal/src/table_kv_impl/namespace.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/wal/src/table_kv_impl/namespace.rs b/wal/src/table_kv_impl/namespace.rs index 0c719e558e..6e6284a75a 100644 --- a/wal/src/table_kv_impl/namespace.rs +++ b/wal/src/table_kv_impl/namespace.rs @@ -10,7 +10,7 @@ use std::{ Arc, Mutex, RwLock, }, thread, - time::Duration, + time::{Duration, Instant}, }; use common_types::{table::TableId, time::Timestamp}; @@ -392,6 +392,9 @@ impl NamespaceInner { /// Open bucket, ensure all tables are created, and insert the bucket into /// the bucket set in memory. fn open_bucket(&self, bucket: Bucket) -> Result { + 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(); @@ -406,6 +409,12 @@ impl NamespaceInner { 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) } @@ -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 }); @@ -1273,8 +1284,6 @@ impl TableOperator { continue; } }; - - cur_running_tasks -= 1; } Ok(())