Skip to content

Commit faf06bc

Browse files
committed
rgw/restore: Update to neorados FIFO routines
Use new neorados/FIFO routines to store restore state. Note: Old librados ioctx is also still retained as it is needed by RestoreRadosSerializer. Signed-off-by: Soumya Koduri <[email protected]>
1 parent b3c867a commit faf06bc

File tree

11 files changed

+252
-231
lines changed

11 files changed

+252
-231
lines changed

src/rgw/driver/rados/rgw_rados.cc

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "common/Throttle.h"
2323
#include "common/BackTrace.h"
2424
#include "common/ceph_time.h"
25+
#include "common/async/blocked_completion.h"
2526

2627
#include "rgw_asio_thread.h"
2728
#include "rgw_cksum.h"
@@ -1150,7 +1151,6 @@ void RGWRados::finalize()
11501151
if (use_restore_thread) {
11511152
restore->stop_processor();
11521153
}
1153-
delete restore;
11541154
restore = NULL;
11551155
}
11561156

@@ -1255,6 +1255,10 @@ int RGWRados::init_complete(const DoutPrefixProvider *dpp, optional_yield y, rgw
12551255
if (ret < 0)
12561256
return ret;
12571257

1258+
ret = open_restore_pool_neo_ctx(dpp);
1259+
if (ret < 0)
1260+
return ret;
1261+
12581262
ret = open_objexp_pool_ctx(dpp);
12591263
if (ret < 0)
12601264
return ret;
@@ -1378,7 +1382,7 @@ int RGWRados::init_complete(const DoutPrefixProvider *dpp, optional_yield y, rgw
13781382
if (use_lc_thread)
13791383
lc->start_processor();
13801384

1381-
restore = new RGWRestore();
1385+
restore = make_unique<rgw::restore::Restore>();
13821386
ret = restore->initialize(cct, this->driver);
13831387

13841388
if (ret < 0) {
@@ -1515,6 +1519,24 @@ int RGWRados::open_restore_pool_ctx(const DoutPrefixProvider *dpp)
15151519
return rgw_init_ioctx(dpp, get_rados_handle(), svc.zone->get_zone_params().restore_pool, restore_pool_ctx, true, true);
15161520
}
15171521

1522+
int RGWRados::open_restore_pool_neo_ctx(const DoutPrefixProvider *dpp)
1523+
{
1524+
maybe_warn_about_blocking(dpp);
1525+
try {
1526+
restore_pool_neo_ctx = rgw::init_iocontext(dpp, driver->get_neorados(),
1527+
svc.zone->get_zone_params().restore_pool,
1528+
rgw::create, ceph::async::use_blocked);
1529+
1530+
} catch (const boost::system::system_error& e) {
1531+
ldpp_dout(dpp, -1) << __PRETTY_FUNCTION__ << ": Failed to initialized ioctx: "
1532+
<< e.what()
1533+
<< ", for restore pool" << dendl;
1534+
return ceph::from_error_code(e.code());
1535+
}
1536+
return 0;
1537+
}
1538+
1539+
15181540
int RGWRados::open_objexp_pool_ctx(const DoutPrefixProvider *dpp)
15191541
{
15201542
return rgw_init_ioctx(dpp, get_rados_handle(), svc.zone->get_zone_params().log_pool, objexp_pool_ctx, true, true);

src/rgw/driver/rados/rgw_rados.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "rgw_sal_fwd.h"
4242
#include "rgw_pubsub.h"
4343
#include "rgw_tools.h"
44+
#include "rgw_restore.h"
4445

4546
struct D3nDataCache;
4647
struct RGWLCCloudTierCtx;
@@ -359,6 +360,7 @@ class RGWRados
359360
int open_gc_pool_ctx(const DoutPrefixProvider *dpp);
360361
int open_lc_pool_ctx(const DoutPrefixProvider *dpp);
361362
int open_restore_pool_ctx(const DoutPrefixProvider *dpp);
363+
int open_restore_pool_neo_ctx(const DoutPrefixProvider *dpp);
362364
int open_objexp_pool_ctx(const DoutPrefixProvider *dpp);
363365
int open_reshard_pool_ctx(const DoutPrefixProvider *dpp);
364366
int open_notif_pool_ctx(const DoutPrefixProvider *dpp);
@@ -373,7 +375,7 @@ class RGWRados
373375
rgw::sal::RadosStore* driver{nullptr};
374376
RGWGC* gc{nullptr};
375377
RGWLC* lc{nullptr};
376-
RGWRestore* restore{nullptr};
378+
std::unique_ptr<rgw::restore::Restore> restore{nullptr};
377379
RGWObjectExpirer* obj_expirer{nullptr};
378380
bool use_gc_thread{false};
379381
bool use_lc_thread{false};
@@ -453,6 +455,7 @@ class RGWRados
453455
librados::IoCtx gc_pool_ctx; // .rgw.gc
454456
librados::IoCtx lc_pool_ctx; // .rgw.lc
455457
librados::IoCtx restore_pool_ctx; // .rgw.restore
458+
neorados::IOContext restore_pool_neo_ctx; // .rgw.restore
456459
librados::IoCtx objexp_pool_ctx;
457460
librados::IoCtx reshard_pool_ctx;
458461
librados::IoCtx notif_pool_ctx; // .rgw.notif
@@ -504,8 +507,8 @@ class RGWRados
504507
return gc;
505508
}
506509

507-
RGWRestore *get_restore() {
508-
return restore;
510+
rgw::restore::Restore *get_restore() {
511+
return restore.get();
509512
}
510513

511514
RGWRados& set_run_gc_thread(bool _use_gc_thread) {
@@ -551,6 +554,10 @@ class RGWRados
551554
return &restore_pool_ctx;
552555
}
553556

557+
neorados::IOContext* get_restore_pool_neo_ctx() {
558+
return &restore_pool_neo_ctx;
559+
}
560+
554561
librados::IoCtx& get_notif_pool_ctx() {
555562
return notif_pool_ctx;
556563
}

0 commit comments

Comments
 (0)