Skip to content

Commit

Permalink
fix file_size always = 0 bug
Browse files Browse the repository at this point in the history
Signed-off-by: Wang Haitao <[email protected]>
  • Loading branch information
apple-ouyang committed Apr 23, 2022
1 parent bdc92e0 commit 3533491
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/blob_gc_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ Status BlobGCJob::DoRunGC() {
// uint64_t total_entry_num = 0;
// uint64_t total_entry_size = 0;

uint64_t file_size = 0;

std::string last_key;
bool last_key_valid = false;
gc_iter->SeekToFirst();
Expand Down Expand Up @@ -203,9 +201,10 @@ Status BlobGCJob::DoRunGC() {

// Rewrite entry to new blob file
if ((!blob_file_handle && !blob_file_builder) ||
file_size >= blob_gc_->titan_cf_options().blob_file_target_size) {
if (file_size >= blob_gc_->titan_cf_options().blob_file_target_size) {
assert(blob_file_builder);
(blob_file_handle->GetFile()->GetFileSize() >=
blob_gc_->titan_cf_options().blob_file_target_size)) {
if ((blob_file_handle->GetFile()->GetFileSize() >=
blob_gc_->titan_cf_options().blob_file_target_size)) {
assert(blob_file_handle);
assert(blob_file_builder->status().ok());
blob_file_builders_.emplace_back(std::make_pair(
Expand All @@ -222,7 +221,6 @@ Status BlobGCJob::DoRunGC() {
blob_file_builder = std::unique_ptr<BlobFileBuilder>(
new BlobFileBuilder(db_options_, blob_gc_->titan_cf_options(),
blob_file_handle->GetFile()));
file_size = 0;
}
assert(blob_file_handle);
assert(blob_file_builder);
Expand Down

0 comments on commit 3533491

Please sign in to comment.