osd: use a temporary object for recovery

Currently we recover objects directly into position by deleting and then
overwriting the target object.  This means that we lose the object if we
are recovering in multiple steps and we fail partway through.

This is also the last user of collection_move(), which we would like to
deprecate.

Instead, generate a unique temp object name (pgid, object version, snap
is unique), and recover to that.  Use the existing temp object cleanup
machinery to throw out a partial recovery result.

Signed-off-by: Sage Weil <sage@redhat.com>
os/ObjectStore: deprecated collection_move

You will not be missed!

Signed-off-by: Sage Weil <sage@redhat.com>
osd: use per-pool temp poolid for temp objects

Previously, all temp objects had poolid == -1.  Instead, use -2 - poolid.
This, when combined with the PG hash, provides a unique temp namespace
per pg.

This has no impact on upgrade, since we delete all temp objects on startup
by collection (coll_t::is_temp()).

Signed-off-by: Sage Weil <sage@redhat.com>
osd/osd_types: remove ancient CEPH_*_NS cruft

Signed-off-by: Sage Weil <sage@redhat.com>
osd: eliminate temp collections

The temp objects have distinct pool ids.  Old temp objects are already
blown away on OSD restart.  This patch removes all the futzing with
temp_coll and puts the temp objects in the same collection as everything
else.

Interesting, collection_move_rename is now always using the same source
and dest collection.  Hmm!

Signed-off-by: Sage Weil <sage@redhat.com>
test/osd/osd-test-helper.sh: debug filestore, ms

Signed-off-by: Sage Weil <sage@redhat.com>
os/HashIndex: use ghobject_t::get_max() instead of hobject_t one

We are working with ghobject_t's; use that max!

Signed-off-by: Sage Weil <sage@redhat.com>
hobject_t: change default pool id to INT64_MIN

We are including pool in a (more) significant part of the sort and using
negative pool IDs; the default must be the most negative (min) so that
it is a useful starting point for a search.

Signed-off-by: Sage Weil <sage@redhat.com>
hobject_t: adjust sort order (pool position)

Make pool more significant than hash (and nspace, object, and everything
else).

This won't break anything because we only care about hobject_t sort order
within the context of a PG (or possibly split) where pool is always
fixed.

Signed-off-by: Sage Weil <sage@redhat.com>
hobject_t: modify operator<<

Put the most significant fields to the left so that it matches the sort
order.  Also use unambiguous separator when the nspace is present
(like we do with the key).

Signed-off-by: Sage Weil <sage@redhat.com>
hobject_t: adjust comparator to check most-likely-different fields first

Signed-off-by: Sage Weil <sage@redhat.com>
.gitignore: ignore store_test_temp_dir

Signed-off-by: Sage Weil <sage@redhat.com>
ghobject_t: change sort order (max, shard, hobj, gen)

Go from (hobj, shard, gen) -> (max, shard, hobj, gen)

This makes the ghobject_t's sort in a way that groups them by PG, which
will likely be useful in the future for ObjectStore implementations.
Notably, we get a ghobject_t MAX value that is distinct from the
hobject_t one.

Signed-off-by: Sage Weil <sage@redhat.com>
hobject_t: fix get_boundary to work with new sorting regime

The hash is no longer the most significant field; set everything that is
more significant, too.

Signed-off-by: Sage Weil <sage@redhat.com>
ghobject_t: fix max to make embedded hobject_t also max

Signed-off-by: Sage Weil <sage@redhat.com>
ceph_objectstore_test: a few simple collection_list_partial tests

Add a simple list test, and a second one that mixes different pool ids
into the same collection.  The latter confirms that we can deal with
ghobject_t's in the temp pool space within a single collection.

Signed-off-by: Sage Weil <sage@redhat.com>
hobject_t: MIN for default

Signed-off-by: Sage Weil <sage@redhat.com>
ghobject_t: MIN for default

Signed-off-by: Sage Weil <sage@redhat.com>
os/FileStore: remove unused legacy split/create collection methods

These are no longer needed or called.

Signed-off-by: Sage Weil <sage@redhat.com>
osd: add coll_t::get_temp() helper

Generate the temp collection for a pg collection.

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