From: Casey Bodley Date: Thu, 26 Apr 2018 15:14:36 +0000 (-0400) Subject: rgw: remove all traces of cls replica_log X-Git-Tag: v14.0.0~160^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f9ee48caa239304dcb1a131c6fe085ae0800ca53;p=ceph.git rgw: remove all traces of cls replica_log replica log was for the old radosgw sync agent, which was replaced with multisite v2 in jewel. no sense in continuing to maintain and test it Signed-off-by: Casey Bodley --- diff --git a/doc/man/8/radosgw-admin.rst b/doc/man/8/radosgw-admin.rst index 9135a5e05a74..1e4daf603a66 100644 --- a/doc/man/8/radosgw-admin.rst +++ b/doc/man/8/radosgw-admin.rst @@ -400,15 +400,6 @@ which are as follows: :command:`opstate rm` Remove entry (use client_id, op_id, object). -:command:`replicalog get` - Get replica metadata log entry. - -:command:`replicalog update` - Update replica metadata log entry. - -:command:`replicalog rm` - Remove replica metadata log entry. - :command:`orphans find` Init and run search for leaked rados objects @@ -566,8 +557,7 @@ Options .. option:: --shard-id= - Optional for mdlog list, data sync status. Required for ``mdlog trim``, - ``replica mdlog get/delete``, ``replica datalog get/delete``. + Optional for mdlog list, data sync status. Required for ``mdlog trim``. .. option:: --max-entries= @@ -767,11 +757,6 @@ Options Specify a state for the opstate set command. -.. option:: --replica-log-type - - Replica log type (metadata, data, bucket), required for replica log - operations. - .. option:: --categories= Comma separated list of categories, used in usage show. diff --git a/qa/suites/rados/basic/tasks/rados_cls_all.yaml b/qa/suites/rados/basic/tasks/rados_cls_all.yaml index bbab083e9cd7..ec85c18f7cff 100644 --- a/qa/suites/rados/basic/tasks/rados_cls_all.yaml +++ b/qa/suites/rados/basic/tasks/rados_cls_all.yaml @@ -3,9 +3,9 @@ overrides: conf: osd: osd_class_load_list: "cephfs hello journal lock log numops rbd refcount - replica_log rgw sdk statelog timeindex user version" + rgw sdk statelog timeindex user version" osd_class_default_list: "cephfs hello journal lock log numops rbd refcount - replica_log rgw sdk statelog timeindex user version" + rgw sdk statelog timeindex user version" tasks: - workunit: clients: diff --git a/qa/suites/rados/verify/tasks/rados_cls_all.yaml b/qa/suites/rados/verify/tasks/rados_cls_all.yaml index bbab083e9cd7..ec85c18f7cff 100644 --- a/qa/suites/rados/verify/tasks/rados_cls_all.yaml +++ b/qa/suites/rados/verify/tasks/rados_cls_all.yaml @@ -3,9 +3,9 @@ overrides: conf: osd: osd_class_load_list: "cephfs hello journal lock log numops rbd refcount - replica_log rgw sdk statelog timeindex user version" + rgw sdk statelog timeindex user version" osd_class_default_list: "cephfs hello journal lock log numops rbd refcount - replica_log rgw sdk statelog timeindex user version" + rgw sdk statelog timeindex user version" tasks: - workunit: clients: diff --git a/qa/suites/smoke/basic/tasks/rados_cls_all.yaml b/qa/suites/smoke/basic/tasks/rados_cls_all.yaml index a3e4980dfd99..cddb6281d74e 100644 --- a/qa/suites/smoke/basic/tasks/rados_cls_all.yaml +++ b/qa/suites/smoke/basic/tasks/rados_cls_all.yaml @@ -3,9 +3,9 @@ overrides: conf: osd: osd_class_load_list: "cephfs hello journal lock log numops rbd refcount - replica_log rgw sdk statelog timeindex user version" + rgw sdk statelog timeindex user version" osd_class_default_list: "cephfs hello journal lock log numops rbd refcount - replica_log rgw sdk statelog timeindex user version" + rgw sdk statelog timeindex user version" tasks: - install: - ceph: diff --git a/qa/suites/upgrade/luminous-x/parallel/0-cluster/start.yaml b/qa/suites/upgrade/luminous-x/parallel/0-cluster/start.yaml index 1e8d5a58ddfc..11f85449a51b 100644 --- a/qa/suites/upgrade/luminous-x/parallel/0-cluster/start.yaml +++ b/qa/suites/upgrade/luminous-x/parallel/0-cluster/start.yaml @@ -33,7 +33,7 @@ overrides: mon warn on osd down out interval zero: false osd: osd_class_load_list: "cephfs hello journal lock log numops rbd refcount - replica_log rgw sdk statelog timeindex user version" + rgw sdk statelog timeindex user version" osd_class_default_list: "cephfs hello journal lock log numops rbd refcount - replica_log rgw sdk statelog timeindex user version" + rgw sdk statelog timeindex user version" fs: xfs diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 874e7f3ae12d..043fe286a244 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -829,7 +829,6 @@ target_link_libraries(ceph-dencoder cls_log_client cls_statelog_client cls_version_client - cls_replica_log_client cls_user_client cls_journal_client cls_timeindex_client diff --git a/src/cls/CMakeLists.txt b/src/cls/CMakeLists.txt index 3e7b727bc906..fbc32d5b64dd 100644 --- a/src/cls/CMakeLists.txt +++ b/src/cls/CMakeLists.txt @@ -175,24 +175,6 @@ add_library(cls_timeindex_client STATIC ${cls_timeindex_client_srcs}) list(APPEND cls_embedded_srcs ${cls_timeindex_srcs} ${cls_timeindex_client_srcs}) -# cls_replica_log -set(cls_replica_log_srcs replica_log/cls_replica_log.cc) -add_library(cls_replica_log SHARED ${cls_replica_log_srcs}) -set_target_properties(cls_replica_log PROPERTIES - VERSION "1.0.0" - SOVERSION "1" - INSTALL_RPATH "" - CXX_VISIBILITY_PRESET hidden) -install(TARGETS cls_replica_log DESTINATION ${cls_dir}) - -set(cls_replica_log_client_srcs - replica_log/cls_replica_log_types.cc - replica_log/cls_replica_log_ops.cc - replica_log/cls_replica_log_client.cc) -add_library(cls_replica_log_client STATIC ${cls_replica_log_client_srcs}) - -list(APPEND cls_embedded_srcs ${cls_replica_log_srcs} ${cls_replica_log_client_srcs}) - # cls_user set(cls_user_srcs user/cls_user.cc) add_library(cls_user SHARED ${cls_user_srcs}) diff --git a/src/cls/replica_log/cls_replica_log.cc b/src/cls/replica_log/cls_replica_log.cc deleted file mode 100644 index 35ed639e69e4..000000000000 --- a/src/cls/replica_log/cls_replica_log.cc +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Ceph - scalable distributed file system - * - * This is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software - * Foundation. See file COPYING. - * - * Copyright Inktank 2013 - */ - -#include "objclass/objclass.h" - -#include "cls_replica_log_types.h" -#include "cls_replica_log_ops.h" - -CLS_VER(1, 0) -CLS_NAME(replica_log) - -static const string replica_log_prefix = "rl_"; -static const string replica_log_bounds = replica_log_prefix + "bounds"; - -static int get_bounds(cls_method_context_t hctx, cls_replica_log_bound& bound) -{ - bufferlist bounds_bl; - int rc = cls_cxx_map_get_val(hctx, replica_log_bounds, &bounds_bl); - if (rc < 0) { - return rc; - } - - try { - bufferlist::iterator bounds_bl_i = bounds_bl.begin(); - decode(bound, bounds_bl_i); - } catch (buffer::error& err) { - bound = cls_replica_log_bound(); - CLS_LOG(0, "ERROR: get_bounds(): failed to decode on-disk bounds object"); - return -EIO; - } - - return 0; -} - -static int write_bounds(cls_method_context_t hctx, - const cls_replica_log_bound& bound) -{ - bufferlist bounds_bl; - encode(bound, bounds_bl); - return cls_cxx_map_set_val(hctx, replica_log_bounds, &bounds_bl); -} - -static int cls_replica_log_set(cls_method_context_t hctx, - bufferlist *in, bufferlist *out) -{ - bufferlist::iterator in_iter = in->begin(); - - cls_replica_log_set_marker_op op; - try { - decode(op, in_iter); - } catch (buffer::error& err) { - CLS_LOG(0, "ERROR: cls_replica_log_set(): failed to decode op"); - return -EINVAL; - } - - cls_replica_log_bound bound; - int rc = get_bounds(hctx, bound); - if (rc < 0 && rc != -ENOENT) { - return rc; - } - - rc = bound.update_marker(op.marker); - if (rc < 0) { - return rc; - } - - return write_bounds(hctx, bound); -} - -static int cls_replica_log_delete(cls_method_context_t hctx, - bufferlist *in, bufferlist *out) -{ - bufferlist::iterator in_iter = in->begin(); - - cls_replica_log_delete_marker_op op; - try { - decode(op, in_iter); - } catch (buffer::error& err) { - CLS_LOG(0, "ERROR: cls_replica_log_delete(): failed to decode op"); - return -EINVAL; - } - - cls_replica_log_bound bound; - int rc = get_bounds(hctx, bound); - if (rc < 0 && rc != -ENOENT) { - return rc; - } - - rc = bound.delete_marker(op.entity_id); - if (rc < 0) { - return rc; - } - - return write_bounds(hctx, bound); -} - -static int cls_replica_log_get(cls_method_context_t hctx, - bufferlist *in, bufferlist *out) -{ - bufferlist::iterator in_iter = in->begin(); - - cls_replica_log_get_bounds_op op; - try { - decode(op, in_iter); - } catch (buffer::error& err) { - CLS_LOG(0, "ERROR: cls_replica_log_get(): failed to decode op"); - return -EINVAL; - } - - cls_replica_log_bound bound; - int rc = get_bounds(hctx, bound); - if (rc < 0) { - return rc; - } - - cls_replica_log_get_bounds_ret ret; - ret.oldest_time = bound.get_oldest_time(); - ret.position_marker = bound.get_lowest_marker_bound(); - bound.get_markers(ret.markers); - - encode(ret, *out); - return 0; -} - -CLS_INIT(replica_log) -{ - CLS_LOG(1, "Loaded replica log class!"); - - cls_handle_t h_class; - cls_method_handle_t h_replica_log_set; - cls_method_handle_t h_replica_log_delete; - cls_method_handle_t h_replica_log_get; - - cls_register("replica_log", &h_class); - - cls_register_cxx_method(h_class, "set", CLS_METHOD_RD | CLS_METHOD_WR, - cls_replica_log_set, &h_replica_log_set); - cls_register_cxx_method(h_class, "get", CLS_METHOD_RD, - cls_replica_log_get, &h_replica_log_get); - cls_register_cxx_method(h_class, "delete", CLS_METHOD_RD | CLS_METHOD_WR, - cls_replica_log_delete, &h_replica_log_delete); -} diff --git a/src/cls/replica_log/cls_replica_log_client.cc b/src/cls/replica_log/cls_replica_log_client.cc deleted file mode 100644 index cb764e743086..000000000000 --- a/src/cls/replica_log/cls_replica_log_client.cc +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Ceph - scalable distributed file system - * - * This is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software - * Foundation. See file COPYING. - */ - -#include - -#include "cls/replica_log/cls_replica_log_client.h" -#include "include/rados/librados.hpp" - -using namespace librados; - -void cls_replica_log_prepare_marker(cls_replica_log_progress_marker& progress, - const string& entity, const string& marker, - const utime_t& time, - const list > *entries) -{ - progress.entity_id = entity; - progress.position_marker = marker; - progress.position_time = time; - if (entries) { - list >::const_iterator i; - for (i = entries->begin(); i != entries->end(); ++i) { - cls_replica_log_item_marker item(i->first, i->second); - progress.items.push_back(item); - } - } -} - -void cls_replica_log_extract_marker(const cls_replica_log_progress_marker& progress, - string& entity, string& marker, - utime_t& time, - list >& entries) -{ - entity = progress.entity_id; - marker = progress.position_marker; - time = progress.position_time; - list::const_iterator i; - for (i = progress.items.begin(); i != progress.items.end(); ++i) { - entries.push_back(make_pair(i->item_name, i->item_timestamp)); - } -} - -void cls_replica_log_update_bound(librados::ObjectWriteOperation& o, - const cls_replica_log_progress_marker& progress) -{ - cls_replica_log_set_marker_op op(progress); - bufferlist in; - encode(op, in); - o.exec("replica_log", "set", in); -} - -void cls_replica_log_delete_bound(librados::ObjectWriteOperation& o, - const string& entity) -{ - cls_replica_log_delete_marker_op op(entity); - bufferlist in; - encode(op, in); - o.exec("replica_log", "delete", in); -} - -int cls_replica_log_get_bounds(librados::IoCtx& io_ctx, const string& oid, - string& position_marker, - utime_t& oldest_time, - list& markers) -{ - bufferlist in; - bufferlist out; - cls_replica_log_get_bounds_op op; - encode(op, in); - int r = io_ctx.exec(oid, "replica_log", "get", in, out); - if (r < 0) - return r; - - cls_replica_log_get_bounds_ret ret; - try { - bufferlist::iterator i = out.begin(); - decode(ret, i); - } catch (buffer::error& err) { - return -EIO; - } - - position_marker = ret.position_marker; - oldest_time = ret.oldest_time; - markers = ret.markers; - - return 0; -} diff --git a/src/cls/replica_log/cls_replica_log_client.h b/src/cls/replica_log/cls_replica_log_client.h deleted file mode 100644 index 407de814d537..000000000000 --- a/src/cls/replica_log/cls_replica_log_client.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Ceph - scalable distributed file system - * - * This is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software - * Foundation. See file COPYING. - * - * Copyright 2013 Inktank - */ - -#ifndef CLS_REPLICA_LOG_CLIENT_H_ -#define CLS_REPLICA_LOG_CLIENT_H_ - -#include "cls_replica_log_ops.h" - -namespace librados { - class ObjectWriteOperation; - class IoCtx; -} - -/** - * Prepare a progress marker object to send out. - * - * @param progress The marker object to prepare - * @param entity The ID of the entity setting the progress - * @param marker The marker key the entity has gotten to - * @param time The timestamp associated with the marker - * param entries A list of in-progress entries prior to the marker - */ -void cls_replica_log_prepare_marker(cls_replica_log_progress_marker& progress, - const string& entity, const string& marker, - const utime_t& time, - const list > *entries); - -/** - * Extract a progress marker object into its components. - * - * @param progress The marker object to extract data from - * @param entity [out] The ID of the entity the progress is associated with - * @param marker [out] The marker key the entity has gotten to - * @param time [out] The timestamp associated with the marker - * @param entries [out] List of in-progress entries prior to the marker - */ -void cls_replica_log_extract_marker(const cls_replica_log_progress_marker& progress, - string& entity, string& marker, - utime_t& time, - list >& entries); - -/** - * Add a progress marker update to a write op. The op will return 0 on - * success, -EEXIST if the marker conflicts with an existing one, or - * -EINVAL if the marker is in conflict (ie, before) the daemon's existing - * marker. - * - * @param op The op to add the update to - * @param progress The progress marker to send - */ -void cls_replica_log_update_bound(librados::ObjectWriteOperation& op, - const cls_replica_log_progress_marker& progress); - -/** - * Remove an entity's progress marker from the replica log. The op will return - * 0 on success, -ENOENT if the entity does not exist on the replica log, or - * -ENOTEMPTY if the items list on the marker is not empty. - * - * @param op The op to add the delete to - * @param entity The entity whose progress should be removed - */ -void cls_replica_log_delete_bound(librados::ObjectWriteOperation& op, - const string& entity); - -/** - * Read the bounds on a replica log. - * - * @param io_ctx The IoCtx to use for the read - * @param oid The oid to direct the read to - * @param position_marker [out] The lowest marker key that has been reached - * @param oldest_time [out] Timestamp corresponding to the position marker or - * oldest in-progress item. - * @param markers [out] List of progress markers for individual daemons - */ -int cls_replica_log_get_bounds(librados::IoCtx& io_ctx, const string& oid, - string& position_marker, - utime_t& oldest_time, - list& markers); - -#endif /* CLS_REPLICA_LOG_CLIENT_H_ */ diff --git a/src/cls/replica_log/cls_replica_log_ops.cc b/src/cls/replica_log/cls_replica_log_ops.cc deleted file mode 100644 index 7d653b64613d..000000000000 --- a/src/cls/replica_log/cls_replica_log_ops.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Ceph - scalable distributed file system - * - * This is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software - * Foundation. See file COPYING. - * - */ - -#include "cls_replica_log_ops.h" -#include "common/Formatter.h" -#include "common/ceph_json.h" - -void cls_replica_log_delete_marker_op::dump(Formatter *f) const -{ - f->dump_string("entity_id", entity_id); -} - -void cls_replica_log_delete_marker_op:: -generate_test_instances(std::list& ls) -{ - ls.push_back(new cls_replica_log_delete_marker_op); - ls.push_back(new cls_replica_log_delete_marker_op); - ls.back()->entity_id = "test_entity_1"; -} - -void cls_replica_log_set_marker_op::dump(Formatter *f) const -{ - encode_json("marker", marker, f); -} - -void cls_replica_log_set_marker_op:: -generate_test_instances(std::list& ls) -{ - std::list samples; - cls_replica_log_progress_marker::generate_test_instances(samples); - std::list::iterator i; - for (i = samples.begin(); i != samples.end(); ++i) { - ls.push_back(new cls_replica_log_set_marker_op(*(*i))); - } -} - -void cls_replica_log_get_bounds_op::dump(Formatter *f) const -{ - f->dump_string("contents", "empty"); -} - -void cls_replica_log_get_bounds_op:: -generate_test_instances(std::list& ls) -{ - ls.push_back(new cls_replica_log_get_bounds_op); -} - -void cls_replica_log_get_bounds_ret::dump(Formatter *f) const -{ - f->dump_string("position_marker", position_marker); - oldest_time.gmtime(f->dump_stream("oldest_time")); - encode_json("entity_markers", markers, f); -} - -void cls_replica_log_get_bounds_ret:: -generate_test_instances(std::list& ls) -{ - std::list samples; - cls_replica_log_progress_marker::generate_test_instances(samples); - std::list samples_whole; - std::list::iterator i; - int count = 0; - for (i = samples.begin(); i != samples.end(); ++i) { - ls.push_back(new cls_replica_log_get_bounds_ret()); - ls.back()->markers.push_back(*(*i)); - ls.back()->oldest_time.set_from_double(1000*count); - ls.back()->position_marker = ls.back()->markers.front().position_marker; - samples_whole.push_back(*(*i)); - } - ls.push_back(new cls_replica_log_get_bounds_ret()); - ls.back()->markers = samples_whole; - ls.back()->oldest_time = samples_whole.back().position_time; - ls.back()->position_marker = samples_whole.back().position_marker; -} diff --git a/src/cls/replica_log/cls_replica_log_ops.h b/src/cls/replica_log/cls_replica_log_ops.h deleted file mode 100644 index 07227de0fa2e..000000000000 --- a/src/cls/replica_log/cls_replica_log_ops.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Ceph - scalable distributed file system - * - * This is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software - * Foundation. See file COPYING. - */ - -#ifndef CLS_REPLICA_LOG_OPS_H_ -#define CLS_REPLICA_LOG_OPS_H_ - -#include "cls_replica_log_types.h" - -struct cls_replica_log_delete_marker_op { - string entity_id; - cls_replica_log_delete_marker_op() {} - explicit cls_replica_log_delete_marker_op(const string& id) : entity_id(id) {} - - void encode(bufferlist& bl) const { - ENCODE_START(1, 1, bl); - encode(entity_id, bl); - ENCODE_FINISH(bl); - } - - void decode(bufferlist::iterator& bl) { - DECODE_START(1, bl); - decode(entity_id, bl); - DECODE_FINISH(bl); - } - - void dump(Formatter *f) const; - static void generate_test_instances(std::list& ls); - -}; -WRITE_CLASS_ENCODER(cls_replica_log_delete_marker_op) - -struct cls_replica_log_set_marker_op { - cls_replica_log_progress_marker marker; - cls_replica_log_set_marker_op() {} - explicit cls_replica_log_set_marker_op(const cls_replica_log_progress_marker& m) : - marker(m) {} - - void encode(bufferlist& bl) const { - ENCODE_START(1, 1, bl); - encode(marker, bl); - ENCODE_FINISH(bl); - } - - void decode(bufferlist::iterator& bl) { - DECODE_START(1, bl); - decode(marker, bl); - DECODE_FINISH(bl); - } - - void dump(Formatter *f) const; - static void generate_test_instances(std::list& ls); -}; -WRITE_CLASS_ENCODER(cls_replica_log_set_marker_op) - -struct cls_replica_log_get_bounds_op { - cls_replica_log_get_bounds_op() {} - - void encode(bufferlist& bl) const { - ENCODE_START(1, 1, bl); - ENCODE_FINISH(bl); - } - - void decode(bufferlist::iterator& bl) { - DECODE_START(1, bl); - DECODE_FINISH(bl); - } - - void dump(Formatter *f) const; - static void generate_test_instances(std::list& ls); -}; -WRITE_CLASS_ENCODER(cls_replica_log_get_bounds_op) - -struct cls_replica_log_get_bounds_ret { - string position_marker; // oldest log listing position on the master - utime_t oldest_time; // oldest timestamp associated with position or an item - std::list markers; - - cls_replica_log_get_bounds_ret() {} - cls_replica_log_get_bounds_ret(const string& pos_marker, - const utime_t& time, - const std::list& m) : - position_marker(pos_marker), oldest_time(time), markers(m) - {} - void encode(bufferlist& bl) const { - ENCODE_START(1, 1, bl); - encode(position_marker, bl); - encode(oldest_time, bl); - encode(markers, bl); - ENCODE_FINISH(bl); - } - - void decode(bufferlist::iterator& bl) { - DECODE_START(1, bl); - decode(position_marker, bl); - decode(oldest_time, bl); - decode(markers, bl); - DECODE_FINISH(bl); - } - - void dump(Formatter *f) const; - static void generate_test_instances(std::list& ls); -}; -WRITE_CLASS_ENCODER(cls_replica_log_get_bounds_ret) - -#endif /* CLS_REPLICA_LOG_OPS_H_ */ diff --git a/src/cls/replica_log/cls_replica_log_types.cc b/src/cls/replica_log/cls_replica_log_types.cc deleted file mode 100644 index 133d06c1f7f0..000000000000 --- a/src/cls/replica_log/cls_replica_log_types.cc +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Ceph - scalable distributed file system - * - * This is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software - * Foundation. See file COPYING. - * - */ - -#include "cls_replica_log_types.h" - -#include "common/Formatter.h" -#include "common/ceph_json.h" - -void cls_replica_log_item_marker::dump(Formatter *f) const -{ - f->dump_string("name", item_name); - f->dump_stream("timestamp") << item_timestamp; -} - -void cls_replica_log_item_marker::decode_json(JSONObj *obj) -{ - JSONDecoder::decode_json("name", item_name, obj); - JSONDecoder::decode_json("timestamp", item_timestamp, obj); -} - -void cls_replica_log_item_marker:: -generate_test_instances(std::list& ls) -{ - ls.push_back(new cls_replica_log_item_marker); - ls.back()->item_name = "test_item_1"; - ls.back()->item_timestamp.set_from_double(0); - ls.push_back(new cls_replica_log_item_marker); - ls.back()->item_name = "test_item_2"; - ls.back()->item_timestamp.set_from_double(20); -} - -void cls_replica_log_progress_marker::dump(Formatter *f) const -{ - encode_json("entity", entity_id, f); - encode_json("position_marker", position_marker, f); - encode_json("position_time", position_time, f); - encode_json("items_in_progress", items, f); -} - -void cls_replica_log_progress_marker::decode_json(JSONObj *obj) -{ - JSONDecoder::decode_json("entity", entity_id, obj); - JSONDecoder::decode_json("position_marker", position_marker, obj); - JSONDecoder::decode_json("position_time", position_time, obj); - JSONDecoder::decode_json("items_in_progress", items, obj); -} - -void cls_replica_log_progress_marker:: -generate_test_instances(std::list& ls) -{ - ls.push_back(new cls_replica_log_progress_marker); - ls.push_back(new cls_replica_log_progress_marker); - ls.back()->entity_id = "entity1"; - ls.back()->position_marker = "pos1"; - ls.back()->position_time.set_from_double(20); - - std::list test_items; - cls_replica_log_item_marker::generate_test_instances(test_items); - std::list::iterator i = test_items.begin(); - for ( ; i != test_items.end(); ++i) { - ls.back()->items.push_back(*(*i)); - } -} - -void cls_replica_log_bound::dump(Formatter *f) const -{ - encode_json("position_marker", position_marker, f); - encode_json("position_time", position_time, f); - encode_json("marker_exists", marker_exists, f); - if (marker_exists) { - encode_json("marker", marker, f); //progress marker - } -} - -void cls_replica_log_bound::decode_json(JSONObj *obj) -{ - JSONDecoder::decode_json("position_marker", position_marker, obj); - JSONDecoder::decode_json("position_time", position_time, obj); - JSONDecoder::decode_json("marker_exists", marker_exists, obj); - if (marker_exists) { - JSONDecoder::decode_json("marker", marker, obj); //progress marker - } -} - -void cls_replica_log_bound:: -generate_test_instances(std::list& ls) -{ - ls.push_back(new cls_replica_log_bound); - std::list marker_objects; - cls_replica_log_progress_marker::generate_test_instances(marker_objects); - std::list::iterator i = - marker_objects.begin(); - ls.back()->update_marker(*(*i)); - ls.push_back(new cls_replica_log_bound); - ++i; - ls.back()->update_marker(*(*i)); -} diff --git a/src/cls/replica_log/cls_replica_log_types.h b/src/cls/replica_log/cls_replica_log_types.h deleted file mode 100644 index 4121f1f87878..000000000000 --- a/src/cls/replica_log/cls_replica_log_types.h +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Ceph - scalable distributed file system - * - * This is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software - * Foundation. See file COPYING. - * - * Copyright 2013 Inktank - */ - -#ifndef CLS_REPLICA_LOG_TYPES_H_ -#define CLS_REPLICA_LOG_TYPES_H_ - -#include "include/utime.h" -#include "include/encoding.h" -#include "include/types.h" -#include - -class JSONObj; - -struct cls_replica_log_item_marker { - string item_name; // the name of the item we're marking - utime_t item_timestamp; // the time stamp at which the item was outdated - - cls_replica_log_item_marker() {} - cls_replica_log_item_marker(const string& name, const utime_t& time) : - item_name(name), item_timestamp(time) {} - - void encode(bufferlist& bl) const { - ENCODE_START(1, 1, bl); - encode(item_name, bl); - encode(item_timestamp, bl); - ENCODE_FINISH(bl); - } - - void decode(bufferlist::iterator& bl) { - DECODE_START(1, bl); - decode(item_name, bl); - decode(item_timestamp, bl); - DECODE_FINISH(bl); - } - - void dump(Formatter *f) const; - void decode_json(JSONObj *obj); - static void generate_test_instances(std::list& ls); -}; -WRITE_CLASS_ENCODER(cls_replica_log_item_marker) - -struct cls_replica_log_progress_marker { - string entity_id; // the name of the entity setting the progress marker - string position_marker; // represents a log listing position on the master - utime_t position_time; // the timestamp associated with the position marker - std::list items; /* any items not caught up - to the position marker*/ - - cls_replica_log_progress_marker() {} - cls_replica_log_progress_marker(const string& entity, const string& marker, - const utime_t& time ) : - entity_id(entity), position_marker(marker), - position_time(time) {} - cls_replica_log_progress_marker(const string& entity, const string& marker, - const utime_t& time, - const std::list& b) : - entity_id(entity), position_marker(marker), - position_time(time), - items(b) {} - - void encode(bufferlist& bl) const { - ENCODE_START(1, 1, bl); - encode(entity_id, bl); - encode(position_marker, bl); - encode(position_time, bl); - encode(items, bl); - ENCODE_FINISH(bl); - } - - void decode(bufferlist::iterator& bl) { - DECODE_START(1, bl); - decode(entity_id, bl); - decode(position_marker, bl); - decode(position_time, bl); - decode(items, bl); - DECODE_FINISH(bl); - } - - void dump(Formatter *f) const; - void decode_json(JSONObj *obj); - static void generate_test_instances(std::list& ls); -}; -WRITE_CLASS_ENCODER(cls_replica_log_progress_marker) - -class cls_replica_log_bound { - /** - * Right now, we are lazy and only support a single marker at a time. In the - * future, we might support more than one, so the interface is designed to - * let that work. - */ - string position_marker; // represents a log listing position on the master - utime_t position_time; // the timestamp associated with the position marker - bool marker_exists; // has the marker been set? - cls_replica_log_progress_marker marker; // the status of the current locker - -public: - cls_replica_log_bound() : marker_exists(false) {} - - int update_marker(const cls_replica_log_progress_marker& new_mark) { - // only one marker at a time right now - if (marker_exists && (marker.entity_id != new_mark.entity_id)) { - return -EEXIST; - } - // can't go backwards with our one marker! - if (marker_exists && (marker.position_time > new_mark.position_time)) { - return -EINVAL; - } - - marker = new_mark; - position_marker = new_mark.position_marker; - position_time = new_mark.position_time; - marker_exists = true; - // hey look, updating is idempotent; did you notice that? - return 0; - } - - int delete_marker(const string& entity_id) { - if (marker_exists) { - // ENOENT if our marker doesn't match the passed ID - if (marker.entity_id != entity_id) { - return -ENOENT; - } - // you can't delete it if there are unclean entries - if (!marker.items.empty()) { - return -ENOTEMPTY; - } - } - - marker_exists = false; - marker = cls_replica_log_progress_marker(); - // hey look, deletion is idempotent! Hurray. - return 0; - } - - std::string get_lowest_marker_bound() { - return position_marker; - } - - utime_t get_lowest_time_bound() { - return position_time; - } - - utime_t get_oldest_time() { - utime_t oldest = position_time; - list::const_iterator i; - for ( i = marker.items.begin(); i != marker.items.end(); ++i) { - if (i->item_timestamp < oldest) - oldest = i->item_timestamp; - } - return oldest; - } - - void get_markers(list& ls) { - if (marker_exists) { - ls.push_back(marker); - } - } - - void encode(bufferlist& bl) const { - ENCODE_START(1, 1, bl); - encode(position_marker, bl); - encode(position_time, bl); - encode(marker_exists, bl); - if (marker_exists) { - encode(marker, bl); - } - ENCODE_FINISH(bl); - } - void decode(bufferlist::iterator& bl) { - DECODE_START(1, bl); - decode(position_marker, bl); - decode(position_time, bl); - decode(marker_exists, bl); - if (marker_exists) { - decode(marker, bl); - } - DECODE_FINISH(bl); - } - - void dump(Formatter *f) const; - void decode_json(JSONObj *obj); - static void generate_test_instances(std::list& ls); -}; -WRITE_CLASS_ENCODER(cls_replica_log_bound) - -#endif /* CLS_REPLICA_LOG_TYPES_H_ */ diff --git a/src/common/legacy_config_opts.h b/src/common/legacy_config_opts.h index 69fbc51c1935..500ee0dc58ef 100644 --- a/src/common/legacy_config_opts.h +++ b/src/common/legacy_config_opts.h @@ -1426,7 +1426,6 @@ OPTION(rgw_data_log_window, OPT_INT) // data log entries window (in seconds) OPTION(rgw_data_log_changes_size, OPT_INT) // number of in-memory entries to hold for data changes log OPTION(rgw_data_log_num_shards, OPT_INT) // number of objects to keep data changes log on OPTION(rgw_data_log_obj_prefix, OPT_STR) // -OPTION(rgw_replica_log_obj_prefix, OPT_STR) // OPTION(rgw_bucket_quota_ttl, OPT_INT) // time for cached bucket stats to be cached within rgw instance OPTION(rgw_bucket_quota_soft_threshold, OPT_DOUBLE) // threshold from which we don't rely on cached info for quota decisions diff --git a/src/common/options.cc b/src/common/options.cc index 9f7b746240d0..98321cdab379 100644 --- a/src/common/options.cc +++ b/src/common/options.cc @@ -3096,11 +3096,11 @@ std::vector