Skip to content
Permalink
Browse files

rgw: remove RGWSyncDebugLogger

the majority of the debug output from this logger is duplicated by the
sync tracing output

Signed-off-by: Casey Bodley <cbodley@redhat.com>
  • Loading branch information...
cbodley committed Jul 20, 2018
1 parent df723e5 commit 880c348c396fc37b48511109349f41b91c33c89c
Showing with 2 additions and 92 deletions.
  1. +2 −92 src/rgw/rgw_data_sync.cc
@@ -40,72 +40,6 @@ static string datalog_sync_full_sync_index_prefix = "data.full-sync.index";
static string bucket_status_oid_prefix = "bucket.sync-status";
static string object_status_oid_prefix = "bucket.sync-status";

class RGWSyncDebugLogger {
CephContext *cct;
string prefix;

bool ended;

public:
RGWSyncDebugLogger(CephContext *_cct, const string& source_zone,
const string& sync_type, const string& sync_stage,
const string& resource, bool log_start = true) {
init(_cct, source_zone, sync_type, sync_stage, resource, log_start);
}
RGWSyncDebugLogger() : cct(NULL), ended(false) {}
~RGWSyncDebugLogger();

void init(CephContext *_cct, const string& source_zone,
const string& sync_type, const string& sync_stage,
const string& resource, bool log_start = true);
void log(const string& state);
void finish(int status);
};

void RGWSyncDebugLogger::init(CephContext *_cct, const string& source_zone,
const string& sync_type, const string& sync_section,
const string& resource, bool log_start)
{
cct = _cct;
ended = false;
string zone_str = source_zone.substr(0, 8);
prefix = "Sync:" + zone_str + ":" + sync_type + ":" + sync_section + ":" + resource;
if (log_start) {
log("start");
}
}

RGWSyncDebugLogger::~RGWSyncDebugLogger()
{
if (!ended) {
log("finish");
}
}

void RGWSyncDebugLogger::log(const string& state)
{
ldout(cct, 5) << prefix << ":" << state << dendl;
}

void RGWSyncDebugLogger::finish(int status)
{
ended = true;
ldout(cct, 5) << prefix << ":" << "finish r=" << status << dendl;
}

class RGWDataSyncDebugLogger : public RGWSyncDebugLogger {
public:
RGWDataSyncDebugLogger() {}
RGWDataSyncDebugLogger(RGWDataSyncEnv *sync_env, const string& sync_section,
const string& resource, bool log_start = true) {
init(sync_env, sync_section, resource, log_start);
}
void init(RGWDataSyncEnv *sync_env, const string& sync_section,
const string& resource, bool log_start = true) {
RGWSyncDebugLogger::init(sync_env->cct, sync_env->source_zone, "data", sync_section, resource, log_start);
}

};

void rgw_datalog_info::decode_json(JSONObj *obj) {
JSONDecoder::decode_json("num_objects", num_shards, obj);
@@ -1004,7 +938,6 @@ class RGWRunBucketSyncCoroutine : public RGWCoroutine {
rgw_bucket_shard_sync_info sync_status;
RGWMetaSyncEnv meta_sync_env;

RGWDataSyncDebugLogger logger;
const std::string status_oid;

boost::intrusive_ptr<RGWContinuousLeaseCR> lease_cr;
@@ -1018,7 +951,6 @@ class RGWRunBucketSyncCoroutine : public RGWCoroutine {
status_oid(RGWBucketSyncStatusManager::status_oid(sync_env->source_zone, bs)),
tn(sync_env->sync_tracer->add_node(_tn_parent, "bucket",
SSTR(bucket_shard_str{bs}))) {
logger.init(sync_env, "Bucket", bs.get_key());
}
~RGWRunBucketSyncCoroutine() override {
if (lease_cr) {
@@ -1190,8 +1122,6 @@ class RGWDataSyncShardCR : public RGWCoroutine {
#define RETRY_BACKOFF_SECS_MAX 600
uint32_t retry_backoff_secs;

RGWDataSyncDebugLogger logger;

RGWSyncTraceNodeRef tn;
public:
RGWDataSyncShardCR(RGWDataSyncEnv *_sync_env,
@@ -1210,8 +1140,6 @@ class RGWDataSyncShardCR : public RGWCoroutine {
set_description() << "data sync shard source_zone=" << sync_env->source_zone << " shard_id=" << shard_id;
status_oid = RGWDataSyncStatusManager::shard_obj_name(sync_env->source_zone, shard_id);
error_oid = status_oid + ".retry";

logger.init(sync_env, "DataShard", status_oid);
}

~RGWDataSyncShardCR() override {
@@ -1293,7 +1221,6 @@ class RGWDataSyncShardCR : public RGWCoroutine {
yield;
}
tn->log(10, "took lease");
logger.log("full sync");
oid = full_data_sync_index_shard_oid(sync_env->source_zone, shard_id);
set_marker_tracker(new RGWDataSyncShardMarkerTrack(sync_env, status_oid, sync_marker, tn));
total_entries = sync_marker.pos;
@@ -1375,7 +1302,6 @@ class RGWDataSyncShardCR : public RGWCoroutine {
1 /* no buffer */);
error_repo->get();
spawn(error_repo, false);
logger.log("inc sync");
set_marker_tracker(new RGWDataSyncShardMarkerTrack(sync_env, status_oid, sync_marker, tn));
do {
current_modified.clear();
@@ -1568,8 +1494,6 @@ class RGWDataSyncCR : public RGWCoroutine {

bool *reset_backoff;

RGWDataSyncDebugLogger logger;

RGWSyncTraceNodeRef tn;

RGWDataSyncModule *data_sync_module{nullptr};
@@ -1579,7 +1503,7 @@ class RGWDataSyncCR : public RGWCoroutine {
num_shards(_num_shards),
marker_tracker(NULL),
shard_crs_lock("RGWDataSyncCR::shard_crs_lock"),
reset_backoff(_reset_backoff), logger(sync_env, "Data", "all"), tn(_tn) {
reset_backoff(_reset_backoff), tn(_tn) {

}

@@ -2560,8 +2484,6 @@ class RGWBucketSyncSingleEntryCR : public RGWCoroutine {

stringstream error_ss;

RGWDataSyncDebugLogger logger;

bool error_injection;

RGWDataSyncModule *data_sync_module;
@@ -2594,7 +2516,6 @@ class RGWBucketSyncSingleEntryCR : public RGWCoroutine {
set_description() << "bucket sync single entry (source_zone=" << sync_env->source_zone << ") b=" << ss.str() << " log_entry=" << entry_marker << " op=" << (int)op << " op_state=" << (int)op_state;
set_status("init");

logger.init(sync_env, "Object", ss.str());
tn = sync_env->sync_tracer->add_node(_tn_parent, "entry", SSTR(key));

tn->log(20, SSTR("bucket sync single entry (source_zone=" << sync_env->source_zone << ") b=" << ss.str() << " log_entry=" << entry_marker << " op=" << (int)op << " op_state=" << (int)op_state));
@@ -2630,17 +2551,15 @@ class RGWBucketSyncSingleEntryCR : public RGWCoroutine {
op == CLS_RGW_OP_LINK_OLH) {
set_status("syncing obj");
tn->log(5, SSTR("bucket sync: sync obj: " << sync_env->source_zone << "/" << bucket_info->bucket << "/" << key << "[" << versioned_epoch.value_or(0) << "]"));
logger.log("fetch");
call(data_sync_module->sync_object(sync_env, *bucket_info, key, versioned_epoch, &zones_trace));
} else if (op == CLS_RGW_OP_DEL || op == CLS_RGW_OP_UNLINK_INSTANCE) {
set_status("removing obj");
if (op == CLS_RGW_OP_UNLINK_INSTANCE) {
versioned = true;
}
logger.log("remove");
tn->log(10, SSTR("removing obj: " << sync_env->source_zone << "/" << bucket_info->bucket << "/" << key << "[" << versioned_epoch.value_or(0) << "]"));
call(data_sync_module->remove_object(sync_env, *bucket_info, key, timestamp, versioned, versioned_epoch.value_or(0), &zones_trace));
} else if (op == CLS_RGW_OP_LINK_OLH_DM) {
logger.log("creating delete marker");
set_status("creating delete marker");
tn->log(10, SSTR("creating delete marker: obj: " << sync_env->source_zone << "/" << bucket_info->bucket << "/" << key << "[" << versioned_epoch.value_or(0) << "]"));
call(data_sync_module->create_delete_marker(sync_env, *bucket_info, key, timestamp, owner, versioned, versioned_epoch.value_or(0), &zones_trace));
@@ -2650,15 +2569,11 @@ class RGWBucketSyncSingleEntryCR : public RGWCoroutine {
} while (marker_tracker->need_retry(key));
{
tn->unset_flag(RGW_SNS_FLAG_ACTIVE);
stringstream ss;
if (retcode >= 0) {
ss << "done";
tn->log(10, "success");
} else {
ss << "done, retcode=" << retcode;
tn->log(10, SSTR("failed, retcode=" << retcode << " (" << cpp_strerror(-retcode) << ")"));
}
logger.log(ss.str());
}

if (retcode < 0 && retcode != -ENOENT) {
@@ -2708,7 +2623,6 @@ class RGWBucketShardFullSyncCR : public RGWCoroutine {

const string& status_oid;

RGWDataSyncDebugLogger logger;
rgw_zone_set zones_trace;

RGWSyncTraceNodeRef tn;
@@ -2725,7 +2639,6 @@ class RGWBucketShardFullSyncCR : public RGWCoroutine {
status_oid(status_oid),
tn(sync_env->sync_tracer->add_node(tn_parent, "full_sync",
SSTR(bucket_shard_str{bs}))) {
logger.init(sync_env, "BucketFull", bs.get_key());
zones_trace.insert(sync_env->source_zone);
marker_tracker.set_tn(tn);
}
@@ -2861,8 +2774,6 @@ class RGWBucketShardIncrementalSyncCR : public RGWCoroutine {

string cur_id;

RGWDataSyncDebugLogger logger;

int sync_status{0};
bool syncstopped{false};

@@ -2885,7 +2796,6 @@ class RGWBucketShardIncrementalSyncCR : public RGWCoroutine {
set_description() << "bucket shard incremental sync bucket="
<< bucket_shard_str{bs};
set_status("init");
logger.init(sync_env, "BucketInc", bs.get_key());
marker_tracker.set_tn(tn);
}

0 comments on commit 880c348

Please sign in to comment.
You can’t perform that action at this time.