From c66c69897d59e205dbd648dea0216b7c2110099c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=B1=E5=B2=9A?= <36239017+YuJuncen@users.noreply.github.com> Date: Sat, 10 Feb 2024 03:20:46 +0800 Subject: [PATCH] disk_snapshot_backup: pause raft log GC while backing up (#16519) close tikv/tikv#16518 This PR will pause the `CompactLog` admin command during backing up. Signed-off-by: Yu Juncen --- components/raftstore/src/store/snapshot_backup.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/components/raftstore/src/store/snapshot_backup.rs b/components/raftstore/src/store/snapshot_backup.rs index 0d972594d05..9168e974fc2 100644 --- a/components/raftstore/src/store/snapshot_backup.rs +++ b/components/raftstore/src/store/snapshot_backup.rs @@ -233,11 +233,9 @@ impl AdminObserver for Arc { if self.allowed() { return Ok(()); } - // NOTE: We should disable `CompactLog` here because if the log get truncated, + // NOTE: We have disabled `CompactLog` here because if the log get truncated, // we may take a long time to send snapshots during restoring. - // - // However it may impact the TP workload if we are preparing for a long time. - // With this risk, we need more evidence of its adventage to reject CompactLogs. + // Also note it may impact the TP workload if we are preparing for a long time. let should_reject = matches!( admin.get_cmd_type(), AdminCmdType::Split | @@ -249,7 +247,8 @@ impl AdminObserver for Arc { AdminCmdType::PrepareMerge | AdminCmdType::ChangePeer | AdminCmdType::ChangePeerV2 | - AdminCmdType::BatchSwitchWitness + AdminCmdType::BatchSwitchWitness | + AdminCmdType::CompactLog ); if should_reject { metrics::SNAP_BR_SUSPEND_COMMAND_TYPE