cls_rgw: cleanups

move stuff to cls/rgw, create needed helpers.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
cls_lock: specify librados namespace explicitly

librados namespace was not specified, hence required including
source files to add using namespace. This fixes it.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
config_opts: add gc configurables

rgw_gc_max_objs: num of objects to used for gc shards
rgw_gc_obj_min_wait: min time for an object to become visible to gc
rgw_gc_processor_max_time: max time a for a single gc processor cycle
rgw_gc_processor_period: period between processors start

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
cls_rgw: add gc commands handling

add the various functionality required for the gc: set entry,
defer entry, list

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
mon: check for int parsing errors in osdmon

Signed-off-by: Sage Weil <sage@inktank.com>
mon: check for int parsing errors in mdsmon

Fixes: #3014
Signed-off-by: Sage Weil <sage@inktank.com>
mon: fix int parsing in monmon

Signed-off-by: Sage Weil <sage@inktank.com>
mon: make parse_pos_long() error message more helpful

Signed-off-by: Sage Weil <sage@inktank.com>
rgw: implement garbage collector

Add a garbage collector thread that is responsible for clean
up of clutter. When removing an object, store info about the
leftovers in a special gc map (via rgw objclass). A new
radosgw-admin commands to list objects in gc, and to run the
gc process manually. Also, gc processors can run in parallel,
however, each will handle a single gc shard (synchronized
using lock objclass).

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw-admin: get rid of lazy remove option, other fixes

was mishandling parsing of binary flag arguments.
also, fix argument parsing and update radosgw-admin
cli test reference.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
cls_rgw: add cls_rgw unitest, test gc api

Test various cls_rgw gc related functionality.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
Merge remote-tracking branch 'origin/master' into wip-gc2
cls_rgw_client: fix #include path

Signed-off-by: Sage Weil <sage@inktank.com>
config: add 'fatal signal handlers' option

This will let us disable the sighandlers for SEGV, etc.

Signed-off-by: Sage Weil <sage@inktank.com>
osd: include notif pointer in notify debug output

Signed-off-by: Sage Weil <sage@inktank.com>
Merge remote-tracking branch 'gh/wip-mon-intparsing'

Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
osd: requeue dup ops inline with in-progress ops

We should requeue the dups along with the originals.  This avoids
situations where, after requeue, the dups are reordered with respect to
each other.  For example:

 - client sends A, B, C
 - osd receives A
 - connection drops
 - client sends A', B', C'
 - osd puts A' in waiting_for_ondisk, starts B' and C'
 - on_change() requeues everything

Final queue order (before this patch) is
    A, B', C', A'

After this patch, the resulting queue order is
    A, A', B', C'

Or somewhat more generally, it might be:

    A, A', B, B', B'', C', C'', D'', ....

Fixes (another source of): #2947
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Samuel Just <sam.just@inktank.com>
monclient: document get_version(), and fix return value

Return -EAGAIN instead of -1, since that's more meaningful, and
document it.

Signed-off-by: Sage Weil <sage@inktank.com>
monclient: pass EAGAIN to is_latest_map() callers

If our map get_version check needs to be retried, tell the
is_latest_map() callers instead of giving returning 0 ("no").

Fixes: #3049
Signed-off-by: Sage Weil <sage@inktank.com>
objecter: fix is_latest_map() retry on mon session restart

If the mon session drops, we get an EAGAIN callback, which we already
correctly ignored.  (Clean this up and comment so it's clearer what is
going on.)

Fix ms_handle_connect() to resubmit those requests.

Noticed while fixing #3049.

Signed-off-by: Sage Weil <sage@inktank.com>