-
Notifications
You must be signed in to change notification settings - Fork 750
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Improve logging and snapshot management
This commit introduces several enhancements to the snapshot management system: - Improved Progress Logging for Snapshot Building - **Introduction of `SMEntry`:** - A new structure, `SMEntry`, has been introduced to represent all variants of a state-machine record. `RaftStoreEntry` is a supper set of `SMEntry` that includes both state machine record and log records. 3. **Asynchronous Snapshot Writing:** - Added the `spawn_writer_thread()` function to facilitate the writing of snapshots in a separate thread, thereby improving the performance.
- Loading branch information
1 parent
b39b311
commit 285600e
Showing
10 changed files
with
329 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2021 Datafuse Labs | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
use std::fmt; | ||
use std::fmt::Formatter; | ||
|
||
use crate::state_machine::MetaSnapshotId; | ||
|
||
/// Snapshot stat. | ||
#[derive(Clone, Debug, Default, PartialEq, Eq)] | ||
pub struct SnapshotStat { | ||
pub snapshot_id: MetaSnapshotId, | ||
|
||
/// Total number of entries in the snapshot. | ||
/// | ||
/// Including meta entries, such as seq, nodes, generic kv, and expire index | ||
pub entry_cnt: u64, | ||
|
||
/// Size in bytes of the snapshot file | ||
pub size: u64, | ||
} | ||
|
||
impl fmt::Display for SnapshotStat { | ||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { | ||
write!( | ||
f, | ||
"{{ snapshot_id: {}, entry_cnt: {}, size: {} }}", | ||
self.snapshot_id.to_string(), | ||
self.entry_cnt, | ||
self.size | ||
) | ||
} | ||
} |
Oops, something went wrong.