Skip to content

Commit 42baf2e

Browse files
authored
chore: record replay cost in log (#1569)
## Rationale ## Detailed Changes 1. Add replay cost in log 2. Remove verbose http log 3. Recover default to shard based, which is faster in most wal implementation. ## Test Plan
1 parent 3bcc64f commit 42baf2e

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/analytic_engine/src/instance/wal_replayer.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use std::{
2222
fmt::Display,
2323
ops::Range,
2424
sync::Arc,
25+
time::Instant,
2526
};
2627

2728
use async_trait::async_trait;
@@ -120,15 +121,15 @@ impl<'a> WalReplayer<'a> {
120121
/// Replay tables and return the failed tables and the causes.
121122
pub async fn replay(&mut self) -> Result<FailedTables> {
122123
// Build replay action according to mode.
124+
let table_num = self.table_datas.len();
123125
info!(
124-
"Replay wal logs begin, context:{}, tables:{:?}",
126+
"Replay wal logs begin, context:{}, table_num:{table_num}, tables:{:?}",
125127
self.context, self.table_datas
126128
);
129+
let begin = Instant::now();
127130
let result = self.replay.run(&self.context, self.table_datas).await;
128-
info!(
129-
"Replay wal logs finish, context:{}, tables:{:?}",
130-
self.context, self.table_datas,
131-
);
131+
let cost = Instant::now().duration_since(begin);
132+
info!("Replay wal logs finish, table_num:{table_num}, cost:{cost:?}");
132133

133134
result
134135
}

src/analytic_engine/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ impl Default for Config {
211211
wal_encode: WalEncodeConfig::default(),
212212
wal: WalConfig::default(),
213213
remote_engine_client: remote_engine_client::config::Config::default(),
214-
recover_mode: RecoverMode::TableBased,
214+
recover_mode: RecoverMode::ShardBased,
215215
metrics: MetricsOptions::default(),
216216
}
217217
}

src/server/src/http.rs

-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@ impl Service {
255255
.or(self.wal_stats())
256256
.or(self.query_push_down())
257257
.or(self.slow_threshold())
258-
.with(warp::log("http_requests"))
259258
.with(warp::log::custom(|info| {
260259
let path = info.path();
261260
// Don't record /debug API

0 commit comments

Comments
 (0)