Skip to content

Commit 1eb0623

Browse files
committed
rgw/restore: Mark the restore entry status as None first time
While adding the restore entry to the FIFO, mark its status as `None` so that restore thread knows that the entry is being processed for the first time. Incase the restore is still in progress and the entry needs to be re-added to the queue, its status then will be marked `InProgress`. Signed-off-by: Soumya Koduri <[email protected]>
1 parent 90b962c commit 1eb0623

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/rgw/rgw_restore.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,14 +392,16 @@ int Restore::process(int index, int max_secs, optional_yield y)
392392
int Restore::process_restore_entry(RestoreEntry& entry, optional_yield y)
393393
{
394394
int ret = 0;
395-
bool in_progress = true;
396395
std::unique_ptr<rgw::sal::Bucket> bucket;
397396
std::unique_ptr<rgw::sal::Object> obj;
398397
std::unique_ptr<rgw::sal::PlacementTier> tier;
399398
std::optional<uint64_t> days = entry.days;
400399
rgw::sal::RGWRestoreStatus restore_status = rgw::sal::RGWRestoreStatus::None;
401400
rgw_placement_rule target_placement;
402401

402+
// mark in_progress as false if the entry is being processed first time
403+
bool in_progress = ((entry.status == rgw::sal::RGWRestoreStatus::None) ? false : true);
404+
403405
// Ensure its the same source zone processing temp entries as we do not
404406
// replicate temp restored copies
405407
if (days) { // temp copy
@@ -632,7 +634,8 @@ int Restore::restore_obj_from_cloud(rgw::sal::Bucket* pbucket,
632634
RestoreEntry entry;
633635
entry.bucket = pbucket->get_key();
634636
entry.obj_key = pobj->get_key();
635-
entry.status = rgw::sal::RGWRestoreStatus::RestoreAlreadyInProgress;
637+
// for first time mark status as None
638+
entry.status = rgw::sal::RGWRestoreStatus::None;
636639
entry.days = days;
637640
entry.zone_id = driver->get_zone()->get_id();
638641

0 commit comments

Comments
 (0)