Skip to content

Commit

Permalink
add more logs in key path to help debug.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rachelint committed Nov 28, 2022
1 parent a9028e0 commit 1a0c6aa
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
9 changes: 8 additions & 1 deletion wal/src/table_kv_impl/namespace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::{

use common_types::{table::TableId, time::Timestamp};
use common_util::{config::ReadableDuration, define_result, runtime::Runtime};
use log::{debug, error, info, warn};
use log::{debug, error, info, trace, warn};
use snafu::{Backtrace, OptionExt, ResultExt, Snafu};
use table_kv::{
ScanContext as KvScanContext, ScanIter, TableError, TableKv, WriteBatch, WriteContext,
Expand Down Expand Up @@ -609,6 +609,13 @@ impl<T: TableKv> NamespaceInner<T> {
ctx: &manager::WriteContext,
batch: &LogWriteBatch,
) -> Result<SequenceNumber> {
trace!(
"Write batch to namespace:{}, location:{:?}, entries num:{}",
self.name(),
batch.location,
batch.entries.len()
);

let now = Timestamp::now();
// Get current bucket to write.
let bucket = self.get_or_create_bucket(now)?;
Expand Down
9 changes: 9 additions & 0 deletions wal/src/table_kv_impl/table_unit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ impl TableUnit {
Some(v) => v,
None => return Ok(None),
};
debug!(
"Open table unit, table unit entry:{:?}, region id:{}, table id:{}",
table_unit_entry, region_id, table_id
);

// Load last sequence of this table unit.
let last_sequence =
Expand Down Expand Up @@ -405,6 +409,11 @@ impl TableUnit {
table_id: TableId,
buckets: &[BucketRef],
) -> Result<SequenceNumber> {
debug!(
"Load last sequence, buckets{:?}, region id:{}, table id:{}",
buckets, region_id, table_id
);

// Starts from the latest bucket, find last sequence of given region id.
let mut last_sequence = common_types::MIN_SEQUENCE_NUMBER;
for bucket in buckets.iter().rev() {
Expand Down
2 changes: 2 additions & 0 deletions wal/src/table_kv_impl/wal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ impl<T: TableKv> WalNamespaceImpl<T> {
namespace_name: &str,
config: NamespaceConfig,
) -> Result<WalNamespaceImpl<T>> {
info!("Open table kv wal, namespace:{}", namespace_name);

let namespace = Self::open_namespace(table_kv, runtimes, namespace_name, config).await?;

let wal = WalNamespaceImpl { namespace };
Expand Down

0 comments on commit 1a0c6aa

Please sign in to comment.