test: switch the cls_replica_log tests to use a test fixture

Instead of the silly macros.

Signed-off-by: Greg Farnum <greg@inktank.com>
rgw: grab the old mtime when doing a user metadata put

We're about to use this to enable (ick) a timestamp-based update
decision tree, to help in resolving disastrous double-active conflicts.

Signed-off-by: Greg Farnum <greg@inktank.com>
test_rgw_admin_meta.cc: use static_cast<>() instead of C-Style cast

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
test_rgw_admin_opstate.cc: use static_cast<>() instead of C-Style cast

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
test_rgw_admin_meta.cc: remove unused variable 'creds'

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
test_rgw_admin_opstate.cc: remove unused variable 'creds'

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
test_rgw_admin_log.cc: use static_cast<>() instead of C-Style cast

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
test_rgw_admin_log.cc: remove unused variable 'creds'

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
rgw/rgw_metadata.h: init prefix in initialization list

For performance reasons: init 'prefix' with META_LOG_OBJ_PREFIX
in the initialization list of RGWMetadataLog instead of assigning
the value in the constructor body.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
ceph_argparse.py: wrong variable used if valid() fails for Ceph{Osd}Name

self.t isn't valid in the failure case; use t

Signed-off-by: Dan Mick <dan.mick@inktank.com>
osd: Don't put functional code inside of an assert

Fix assert in OSDService::get_map()

Signed-off-by: David Zafman <david.zafman@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
ceph-disk: use new dumpling-style osd caps if we can, or fall back to old-style ones

Signed-off-by: Alfredo Deza <alfredo@deza.pe>
Reviewed-by: Sage Weil <sage@inktank.com>
remove old push_to_kclient.pl

Signed-off-by: Sage Weil <sage@inktank.com>
rgw: add preliminary support for sync update policies on metadata sync

We want to be able to conditionally apply new updates:
1) if we already have a newer version than the sync is applying for some
reason (replay of logs?), we don't want to go back in time.
2) If both zones were active at the same time, then we'd like to be
able to do a merge based on timestamps.

In order to support this, we add a sync_type flag to the implementations of
RGWMetadataHandler::put, and then check the version or the mtime of the
incoming put to what we have on disk, and refuse the update if needed.
We return the 204 NoContent success code when refusing sync; for the
moment the conversion is automatic but we're going to pull it out in
the next couple commits.

This commit does not complete the feature: we don't provide an interface
for specifying a different sync protocol.

Signed-off-by: Greg Farnum <greg@inktank.com>
rgw: pass the sync mode into the RGWMetadataManager::put() calls.

Signed-off-by: Greg Farnum <greg@inktank.com>
rgw: add sync state parsing code and REST interface

Specify the param "sync-type" as one of "always", "update-by-version",
"update-by-timestamp". It defaults to always.

Signed-off-by: Greg Farnum <greg@inktank.com>
rgw: return the update status on sync requests

Add new STATUS_APPLIED, then specify the RGWX_UPDATE_STATUS header
based on that return code when doing metadata puts.
Add a send_response() function to RGWOp_Metadata_Put in order to
support sending back our new headers. Move the translation from
STATUS_NO_APPLY from set_req_state_err() to this function, so we
can turn different sync results into failures if necessary elsewhere.

Signed-off-by: Greg Farnum <greg@inktank.com>
rgw: expose the version of synced items to the poster

To support this, we add an optional out argument to
RGWMetadatManager::put() and fill in the read_version. When the
function returns, that contains whatever the current on-disk version
of the object is (either what already existed or what we just wrote).

Signed-off-by: Greg Farnum <greg@inktank.com>
mon/Paxos: share uncommitted value when leader is/was behind

If the leader has and older lc than we do, and we are sharing states to
bring them up to date, we still want to also share our uncommitted value.
This particular case was broken by b26b7f6e, which was only contemplating
the case where the leader was ahead of us or at the same point as us, but
not the case where the leader was behind.  Note that the call to
share_state() a few lines up will bring them fully up to date, so
after they receive and store_state() for this message they will be at the
same lc as we are.

Fixes: #5750
Backport: cuttlefish
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
mon: translate caps=[k1,v1,k2,v2] into [caps_k1=v1, caps_k2=v2]

The command matching needs key/value pairs.

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>