Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgw: log refactoring for data sync #23843

Merged
merged 3 commits into from Sep 20, 2018
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

rgw: RGWBucketSyncStatusManager implements DoutPrefixProvider

and passes its pointer to RGWRemoteBucketLog

Signed-off-by: Casey Bodley <cbodley@redhat.com>
  • Loading branch information...
cbodley committed Aug 27, 2018
commit df723e5fe7898791627f94b81039a53481b97f7d
@@ -3245,13 +3245,13 @@ int RGWBucketSyncStatusManager::init()
{
conn = store->get_zone_conn_by_id(source_zone);
if (!conn) {
ldout(store->ctx(), 0) << "connection object to zone " << source_zone << " does not exist" << dendl;
ldpp_dout(this, 0) << "connection object to zone " << source_zone << " does not exist" << dendl;
return -EINVAL;
}

int ret = http_manager.start();
if (ret < 0) {
ldout(store->ctx(), 0) << "failed in http_manager.start() ret=" << ret << dendl;
ldpp_dout(this, 0) << "failed in http_manager.start() ret=" << ret << dendl;
return ret;
}

@@ -3266,7 +3266,7 @@ int RGWBucketSyncStatusManager::init()
bucket_instance_meta_info result;
ret = cr_mgr.run(new RGWReadRESTResourceCR<bucket_instance_meta_info>(store->ctx(), conn, &http_manager, path, pairs, &result));
if (ret < 0) {
ldout(store->ctx(), 0) << "ERROR: failed to fetch bucket metadata info from zone=" << source_zone << " path=" << path << " key=" << key << " ret=" << ret << dendl;
ldpp_dout(this, 0) << "ERROR: failed to fetch bucket metadata info from zone=" << source_zone << " path=" << path << " key=" << key << " ret=" << ret << dendl;
return ret;
}

@@ -3282,10 +3282,10 @@ int RGWBucketSyncStatusManager::init()
auto async_rados = store->get_async_rados();

for (int i = 0; i < effective_num_shards; i++) {
RGWRemoteBucketLog *l = new RGWRemoteBucketLog(store, this, async_rados, &http_manager);
RGWRemoteBucketLog *l = new RGWRemoteBucketLog(this, store, this, async_rados, &http_manager);
ret = l->init(source_zone, conn, bucket, (num_shards ? i : -1), error_logger, store->get_sync_tracer(), sync_module);
if (ret < 0) {
ldout(store->ctx(), 0) << "ERROR: failed to initialize RGWRemoteBucketLog object" << dendl;
ldpp_dout(this, 0) << "ERROR: failed to initialize RGWRemoteBucketLog object" << dendl;
return ret;
}
source_logs[i] = l;
@@ -3323,7 +3323,7 @@ int RGWBucketSyncStatusManager::read_sync_status()

int ret = cr_mgr.run(stacks);
if (ret < 0) {
ldout(store->ctx(), 0) << "ERROR: failed to read sync status for "
ldpp_dout(this, 0) << "ERROR: failed to read sync status for "
<< bucket_str{bucket} << dendl;
return ret;
}
@@ -3345,14 +3345,26 @@ int RGWBucketSyncStatusManager::run()

int ret = cr_mgr.run(stacks);
if (ret < 0) {
ldout(store->ctx(), 0) << "ERROR: failed to read sync status for "
ldpp_dout(this, 0) << "ERROR: failed to read sync status for "
<< bucket_str{bucket} << dendl;
return ret;
}

return 0;
}

unsigned RGWBucketSyncStatusManager::get_subsys() const
{
return dout_subsys;
}

std::ostream& RGWBucketSyncStatusManager::gen_prefix(std::ostream& out) const
{
auto zone = std::string_view{source_zone};
return out << "bucket sync zone:" << zone.substr(0, 8)
<< " bucket:" << bucket.name << ' ';
}

string RGWBucketSyncStatusManager::status_oid(const string& source_zone,
const rgw_bucket_shard& bs)
{
@@ -498,6 +498,7 @@ struct rgw_bucket_index_marker_info {


class RGWRemoteBucketLog : public RGWCoroutinesManager {
const DoutPrefixProvider *dpp;
RGWRados *store;
RGWRESTConn *conn{nullptr};
string source_zone;
@@ -513,9 +514,14 @@ class RGWRemoteBucketLog : public RGWCoroutinesManager {
RGWBucketSyncCR *sync_cr{nullptr};

public:
RGWRemoteBucketLog(RGWRados *_store, RGWBucketSyncStatusManager *_sm,
RGWAsyncRadosProcessor *_async_rados, RGWHTTPManager *_http_manager) : RGWCoroutinesManager(_store->ctx(), _store->get_cr_registry()), store(_store),
status_manager(_sm), async_rados(_async_rados), http_manager(_http_manager) {}
RGWRemoteBucketLog(const DoutPrefixProvider *dpp, RGWRados *_store,
RGWBucketSyncStatusManager *_sm,
RGWAsyncRadosProcessor *_async_rados,
RGWHTTPManager *_http_manager)
: RGWCoroutinesManager(_store->ctx(), _store->get_cr_registry()),
dpp(dpp), store(_store), status_manager(_sm),
async_rados(_async_rados), http_manager(_http_manager)
{}

int init(const string& _source_zone, RGWRESTConn *_conn,
const rgw_bucket& bucket, int shard_id,
@@ -531,7 +537,7 @@ class RGWRemoteBucketLog : public RGWCoroutinesManager {
void wakeup();
};

class RGWBucketSyncStatusManager {
class RGWBucketSyncStatusManager : public DoutPrefixProvider {
RGWRados *store;

RGWCoroutinesManager cr_mgr;
@@ -576,6 +582,11 @@ class RGWBucketSyncStatusManager {

int read_sync_status();
int run();

// implements DoutPrefixProvider
CephContext *get_cct() const override { return store->ctx(); }
unsigned get_subsys() const override;
std::ostream& gen_prefix(std::ostream& out) const override;
};

/// read the sync status of all bucket shards from the given source zone
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.