PG: scrubber.end should be exactly a boundary

Let scrubber.end be (foo, HEAD, 10) where the oid is foo , HEAD is the
snap, and 10 is the hash and scrubber.begin similarly be (bar, 5, 1).

After choosing to scan [(bar, 5, 1), (foo, HEAD, 10)), we block writes
on that interval.

1) A write might then come in for foo (which isn't blocked) which
creates a new snap (foo, 400, 10) which happens to fall in the interval.
This will result in a crash in _scrub() when it attempts to compare
clones since it will get (foo, 400, 10) but not the head object
(foo, HEAD, 10).

2) Alternately, the write from 1) has already happened.  When we scan
the log, we find 34'10 and 34'11 are the clone operation creating
(foo, 400, 10) and the modify on (foo, HEAD, 10) respectively.  Both
primary and replica will wait for last_update_applied to be 34'10
before scanning, but last_update_applied will in fact skip to 34'11
since 34'10 and 34'11 happened in the same transaction.  This can
result in IO hanging on the scrubber interval.

Instead, we ensure that scrubber.end is exactly a hash boundary
(min hobject_t a with the specified hash).  No such object can
exist since we don't create objects with empty oids, so no writes
can occur on that object.

Signed-off-by: Samuel Just <sam.just@inktank.com>
os/: add filestore collection_split

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

Signed-off-by: Samuel Just <sam.just@inktank.com>
os/: Add failure CollectionIndex failure injection

Several pieces of HashIndex involve multi-step operations
which are sensitive to OSD crashes.  This patch introduces
failure injection to force retries from various points in
the LFNIndex helper methods to be used with store_test.cc.

Signed-off-by: Samuel Just <sam.just@inktank.com>
os/: Add CollectionIndex::prep_delete

If an unlink is interupted between removing the file
and updating the subdir attribute, the attribute will
overestimate the number of files in the directory.  This
is by design, at worst we will merge the collection later
than intended, but closing the gap would require a second
subdir xattr update.  However, this can in extreme cases
result in a collection with subdirectories but no objects.
FileStore::_destry_collection would therefore see an
erroneous -ENOTEMPTY.

prep_delete allows the CollectionIndex implementation to
clean up state prior to removal.

Signed-off-by: Samuel Just <sam.just@inktank.com>
OSD: don't wait for superblock writes in handle_osd_map

Instead, pass the pinned maps into a Context and clear the
cache after the transaction is applied.

Signed-off-by: Samuel Just <sam.just@inktank.com>
OSD: dispatch_context only discard transaction if contexts empty

Signed-off-by: Samuel Just <sam.just@inktank.com>
PGMonitor,OSD: don't send creates on split

Splits will be handled when the map update effecting the split is
processed for the splitting pg on each OSD.  This will mesh
with the pg history which will place the new pg at the current
positions of the splitting pg.

Signed-off-by: Samuel Just <sam.just@inktank.com>
mon/OSDMonitor: enable split in Monitor

Signed-off-by: Samuel Just <sam.just@inktank.com>
PrioritizedQueue: allow caller to get items removed by removed_by_filter

Signed-off-by: Samuel Just <sam.just@inktank.com>
osd/: splitting a pg now triggers a new interval

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG: add split_into to populate child members

Signed-off-by: Samuel Just <sam.just@inktank.com>
OSD: add initial split support

PGs are split after updating to the map on which they split.
OSD::activate_map populates the set of currently "splitting"
pgs.  Messages for those pgs are delayed until the split
is complete.  We add the newly split children to pg_map
once the transaction populating their on-disk state completes.

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG: split ops for child objects into child

Signed-off-by: Samuel Just <sam.just@inktank.com>
osd/: mark info.stats as invalid after split, fix in scrub

Signed-off-by: Samuel Just <sam.just@inktank.com>
osd/: dirty info and log on child during split

Otherwise, the log may not get written out.

Signed-off-by: Samuel Just <sam.just@inktank.com>
OSD: do _remove_pg in add_newly_split_pg is pool if gone

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG: set child up/acting in split_into

Signed-off-by: Samuel Just <sam.just@inktank.com>
OSDMonitor: require --allow-experimental-feature to increase pg_num

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG: update info.last_update_started in split_into

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