Skip to content

Commit

Permalink
chore: change style
Browse files Browse the repository at this point in the history
  • Loading branch information
QuenKar committed Oct 16, 2023
1 parent 1dfb019 commit 1fe889b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/mito2/src/manifest/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ impl RegionManifestManagerInner {

// recover from storage
// construct manifest builder
// calculate the manifest size from the latest checkpoint
let mut version = MIN_VERSION;
let checkpoint = Self::last_checkpoint(&mut store).await?;
let last_checkpoint_version = checkpoint
Expand All @@ -257,10 +258,6 @@ impl RegionManifestManagerInner {
"Recover region manifest {} from checkpoint version {}",
options.manifest_dir, checkpoint.last_version
);
// set manifest size before last checkpoint
store
.set_manifest_size_until(last_checkpoint_version)
.await?;
version = version.max(checkpoint.last_version + 1);
RegionManifestBuilder::with_checkpoint(checkpoint.checkpoint)
} else {
Expand Down Expand Up @@ -567,8 +564,7 @@ mod test {
manager.validate_manifest(&new_metadata, 1).await;
}

/// Just for test, the manifest size is the sum of all checkpoint files and delta files,
/// refer to wal_dir_usage in src/store-api/src/logstore.rs.
/// Just for test, refer to wal_dir_usage in src/store-api/src/logstore.rs.
async fn manifest_dir_usage(path: &str) -> u64 {
let mut size = 0;
let mut read_dir = tokio::fs::read_dir(path).await.unwrap();
Expand Down Expand Up @@ -642,9 +638,10 @@ mod test {

// check manifest size again
let manifest_size = manager.manifest_size().await;
assert_eq!(manifest_size, 1453);
assert_eq!(manifest_size, manifest_dir_usage(&manifest_dir).await);

// Reopen the manager.
// Reopen the manager,
// we just calculate the size from the latest checkpoint file
manager.stop().await.unwrap();
let manager = env
.create_manifest_manager(CompressionType::Uncompressed, 10, None)
Expand All @@ -655,6 +652,6 @@ mod test {

// get manifest size again
let manifest_size = manager.manifest_size().await;
assert_eq!(manifest_size, manifest_dir_usage(&manifest_dir).await);
assert_eq!(manifest_size, 1312);
}
}
1 change: 1 addition & 0 deletions src/mito2/src/manifest/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ impl ManifestObjectStore {
compress_type: self.compress_type,
path: path.clone(),
})?;
// set the checkpoint size
self.set_manifest_size_by_path(&path, decompress_data.len() as u64);
Ok(Some(decompress_data))
}
Expand Down

0 comments on commit 1fe889b

Please sign in to comment.