Skip to content

Commit

Permalink
Deal with iter errors
Browse files Browse the repository at this point in the history
Signed-off-by: v01dstar <[email protected]>
  • Loading branch information
v01dstar committed May 15, 2024
1 parent d362e9e commit ef34a73
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/blob_gc_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,11 @@ Status BlobGCJob::HolePunchSingleBlobFile(std::shared_ptr<BlobFileMeta> file) {
std::unique_ptr<BlobFileIterator> iter(
new BlobFileIterator(std::move(file_reader), file->file_number(),
file->file_size(), blob_gc_->titan_cf_options()));
for (iter->SeekToFirst(); iter->Valid(); iter->Next()) {
iter->SeekToFirst();
if (!iter->status().ok()) {
return iter->status();
}
for (;iter->Valid(); iter->Next()) {
if (IsShutingDown()) {
return Status::ShutdownInProgress();
}
Expand Down Expand Up @@ -221,6 +225,9 @@ Status BlobGCJob::HolePunchSingleBlobFile(std::shared_ptr<BlobFileMeta> file) {
return Status::NotSupported("Hole punch not supported");
#endif
}
if (!iter->status().ok()) {
return iter->status();
}
hole_punched_files_map_[file->file_number()] = live_blocks;
return Status::OK();
}
Expand Down Expand Up @@ -467,7 +474,7 @@ Status BlobGCJob::DiscardEntry(const Slice& key, const BlobIndex& blob_index,
// added to db before we rewrite any key to LSM
Status BlobGCJob::Finish() {
Status s;
{
if (!blob_gc_->use_punch_hole()) {
mutex_->Unlock();
s = InstallOutputBlobFiles();
if (s.ok()) {
Expand All @@ -486,8 +493,12 @@ Status BlobGCJob::Finish() {
s.ToString().c_str());
}
mutex_->Lock();
}
if (blob_gc_->use_punch_hole()) {
if (s.ok() && !blob_gc_->GetColumnFamilyData()->IsDropped()) {
TEST_SYNC_POINT("BlobGCJob::Finish::BeforeDeleteInputBlobFiles");
s = DeleteInputBlobFiles();
}
TEST_SYNC_POINT("BlobGCJob::Finish::AfterRewriteValidKeyToLSM");
} else {
TITAN_LOG_INFO(db_options_.info_log,
"Titan GC job finished, before batch updates");
// It is possible that while processing the GC job, the input blob files'
Expand Down Expand Up @@ -515,13 +526,6 @@ Status BlobGCJob::Finish() {
s = blob_file_manager_->BatchUpdateFiles(hole_punched_files);
}
}
if (s.ok() && !blob_gc_->GetColumnFamilyData()->IsDropped() &&
!blob_gc_->use_punch_hole()) {
TEST_SYNC_POINT("BlobGCJob::Finish::BeforeDeleteInputBlobFiles");
s = DeleteInputBlobFiles();
}
TEST_SYNC_POINT("BlobGCJob::Finish::AfterRewriteValidKeyToLSM");

if (s.ok()) {
UpdateInternalOpStats();
}
Expand Down

0 comments on commit ef34a73

Please sign in to comment.