ReplicatedPG: don't leak reservation on removal

Fixes: 4431
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
OSD: lock not needed in ~DeletingState()

No further refs to the object can remain at this point.
Furthermore, the callbacks might lock mutexes of their
own.

Backport: bobtail
Fixes: #4378
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
HashIndex: _collection_list_partial must tolerate NULL next

Backport: bobtail
Fixes: #4379
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
FileStore: fix reversed collection_empty return value

Backport: bobtail
Fixes: #4380
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
PG: check_recovery_sources must happen even if not active

missing_loc/missing_loc_sources also must be cleaned up
if a peer goes down during peering:

1) pg is in GetInfo, acting is [3,1]
2) we find object A on osd [0] in GetInfo
3) 0 goes down, no new peering interval since it is neither up nor
acting, but peer_missing[0] is removed.
4) pg goes active and try to pull A from 0 since missing_loc did not get
cleaned up.

Backport: bobtail
Fixes: #4371
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
OSD: add debugging to start_split and complete_split

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG::read_log: fix assert, split may introduce holes in the log

Signed-off-by: Samuel Just <sam.just@inktank.com>
osd_internals/snaps.rst: add a description of snaps and trimming

Signed-off-by: Samuel Just <sam.just@inktank.com>
osd_internals/snaps.rst: update description to reflect SnapMapper

Signed-off-by: Samuel Just <sam.just@inktank.com>
ObjectStore: move queue_transaction into ObjectStore

This will simplify the SnapMapper implementation.

Signed-off-by: Samuel Just <sam.just@inktank.com>
Context: allow C_Contexts to not have a cct, add list_to_context

This will simplify the SnapMapper implementation.

Signed-off-by: Samuel Just <sam.just@inktank.com>
ObjectStore: add Context management to Transaction

ObjectStore now appends passed contexts in queue_transaction
to the Transaction contexts and uses that to pass into
the virtual queue_transactions.

Signed-off-by: Samuel Just <sam.just@inktank.com>
DBObjectMap, hobject: add helpers for pgid bit matching

Create helpers in hobject for generating prefixes for a
pg as well as matching hobjects against a pgid/numpgs
combo.  Use these in HashIndex.cc.

Signed-off-by: Samuel Just <sam.just@inktank.com>
filestore: add debug option to verify split results

Signed-off-by: Samuel Just <sam.just@inktank.com>
common/shared_ptr.hpp: add get_next and expose VPtr and WeakVPtr types

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

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

Signed-off-by: Samuel Just <sam.just@inktank.com>
test/: add tests for map_cacher

Signed-off-by: Samuel Just <sam.just@inktank.com>
Makefile: add SnapMapper to osd

Signed-off-by: Samuel Just <sam.just@inktank.com>
osd/: Integrate SnapMapper with OSD

- SnapTrimmer now uses SnapMapper to get the next object to trim
- Entries for a snap are implicitely removed from SnapMapper when
the last object is trimmed, so no need for the adjust_local_snaps
logic.
- Scrub now compares the object_info snaps set on the object attr
with the version stored in the SnapMapper.

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