PGLog: create interface allowing interface user to cleanup/rollback

We need to be able to allow the PGLog interface user to provide
logic for rolling back and trimming log entries.  To that end,
serveral PGLog methods now take a LogEntryHander.

In PGLog::merge_old_entry, if prior_version > info.log_tail and
the object is not missing, we must have rolled back the prior
log entry.  Thus, we don't skip the entry.

To simplify the code, _merge_old_entry has been split out as
a const helper.  This way, proc_replica_log can be reexpressed
as merging the divergent replica log entries with the fully
merged authoritative log.

Signed-off-by: Samuel Just <sam.just@inktank.com>
PGLog: we cannot rollback past a recovered object entry

We don't recover the older versions, so we can't do a rollback.
In general, this is ok since we had enough copies to recover it
in the first place.

Signed-off-by: Samuel Just <sam.just@inktank.com>
PGLog,PG: reset can_rollback_to when we get a log entry without a transaction

Signed-off-by: Samuel Just <sam.just@inktank.com>
ObjectStore: _collection_move_rename needs to increment ops

Signed-off-by: Samuel Just <sam.just@inktank.com>
TestRados: skip 0 weight ops

Signed-off-by: Samuel Just <sam.just@inktank.com>
osd/: add sync/async read methods to PGBackend

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG: use pgbackend->objects_read_sync() as appropriate

Signed-off-by: Samuel Just <sam.just@inktank.com>
src/: add CEPH_OSD_OP_READ_SYNC

EC pools won't support SYNC reads.  This means that TMAP and friends
along with reads from an object class will not be supported.

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG: support async reads on ec pools

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG: requeue in_progress_async_reads on_change

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG: make COPY_GET async read friendly

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG: EOPNOTSUPP on ec_pool if there are omaps in the COPY_GET

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG: handle removing the old object in finish_copy_op

do_osd_ops will need to either copy the old version out of the
way or simply delete it depending on mod_desc.  Thus, defer
handling filling that part in until we finish the copy op.

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG::finish_copyfrom: check new_obs.exists, not obs.exists

If the transaction previously removed the object, the stat update
will have already happened.

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG: fill in mod_desc in finish_copyfrom

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG::_process_copy_chunk: use append

Signed-off-by: Samuel Just <sam.just@inktank.com>
test/osd/: verify length of buffer returned in read

Signed-off-by: Samuel Just <sam.just@inktank.com>
common/hobject: print shard as unsigned, not as char

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG: fill in ctx->obc in simple_repop_create

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG: only advance last_backfill to head objects

If we rollback the log entries which created the clone at
last_backfill, it won't get rerun on the replica.  Instead,
only advance last_backfill when we hit head (or snapdir).

Signed-off-by: Samuel Just <sam.just@inktank.com>