Skip to content

Commit

Permalink
chore: cr comment
Browse files Browse the repository at this point in the history
  • Loading branch information
QuenKar committed Jan 9, 2024
1 parent 6afedad commit 6fb1f3c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/mito2/src/cache/file_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ pub(crate) type IndexKey = (RegionId, FileId);
#[derive(Debug, Clone)]
pub(crate) struct IndexValue {
/// Size of the file in bytes.
pub file_size: u32,
pub(crate) file_size: u32,
}

/// Generates the path to the cached file.
Expand Down
9 changes: 7 additions & 2 deletions src/mito2/src/cache/write_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ impl WriteCache {
timer.stop_and_record();

// Upload sst file to remote object store.
if sst_info.is_none() {
// No data need to upload.
return Ok(None);
}

let timer = FLUSH_ELAPSED.with_label_values(&["upload"]).start_timer();

let reader = self
Expand All @@ -111,11 +116,11 @@ impl WriteCache {
.await
.context(error::UploadSstSnafu { region_id, file_id })?;

UPLOAD_BYTES_TOTAL.inc_by(bytes_written);

// Must close to upload all data.
writer.close().await.context(error::OpenDalSnafu)?;

UPLOAD_BYTES_TOTAL.inc_by(bytes_written);

debug!(
"Successfully upload file to remote, region: {}, file: {}, upload_path: {}, cost: {:?}s",
region_id,
Expand Down

0 comments on commit 6fb1f3c

Please sign in to comment.