Commit Graph

99394 Commits

Author SHA1 Message Date
Sage Weil
a960f2faa7 qa/standalone/scrub/osd-scrub-repair: fix 'scrub ok' grep
The log now also has a 'purged_snaps scrub ok' message that (generally)
precedes the first scrubbed PG.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-04 18:27:37 -05:00
Sage Weil
70ad54a0b3 osd/osd_types: remove 'snap_context' from SnapSet::dump()
We no longer have a snaps field with real values, so dumping this as a
"snap_context" is silly.  Instead, just dump the seq.

Adjust qa/standalone/scrub/osd-scrub-repair.sh accordingly.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-04 18:24:41 -05:00
Sage Weil
0a48392ce0 mon/OSDMonitor: fix _lookup_snap to verify the pool matches
We don't want to get false positives from keys for other pools.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-03 15:59:44 -05:00
Sage Weil
51c50d0001 ceph_test_rados_api_*: make failing to clean up namespace non-fatal
If we leak snaps, failing to clean up a namespace can happen and won't
get fixed until we scrub purged_snaps.  Make this a non-fatal condition.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-03 13:30:55 -05:00
Sage Weil
65b7143cd4 osd: store purged_snaps history under separate object
We can't put this in the snapmapper object because filestore does not
allow multiple concurrent omap iterators on the same object.  (This is a
limitation that could be fixed with some read/write locking, but not
without some significant changes to DBObjectMap; since that is old crufty
legacy code let's avoid touching it!)

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-03 13:29:15 -05:00
Sage Weil
b17850a665 osd: drop osd_lock during scrub
We do not want to hold osd_lock while calling apply_transaction or else
we may cause a deadlock due to a completion event that needs osd_lock.

Also, we don't need to hold the lock here, so don't.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 10:51:57 -05:00
Sage Weil
adacc20046 ceph_test_rados_api_tier_pp: tolerate ENOENT or success from deleted snap
Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:51 -05:00
Sage Weil
5b0ed6ff9e osd: automatically scrub purged_snaps every deep scrub interval
With randomization.

We do this from tick() for simplicity.  It is a rare event, will take 10s
of seconds at most, and nothing else particularly time-sensitive is
happening from tick().

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:51 -05:00
Sage Weil
647cfb4603 osd: move scrub_purged_snaps to helper
Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:51 -05:00
Sage Weil
fc2a96638d osd/OSDMap: SERVER_OCTOPUS feature bit is now significant
Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:51 -05:00
Sage Weil
0d10e63d8d ceph_test_rados_api_snapshots_pp: drop unnecessary assert
Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:51 -05:00
Sage Weil
85ddc1a034 mon/OSDMonitor: record last_purged_snaps_scrub from beacon to osdmap
Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:51 -05:00
Sage Weil
4f4dedb8d6 osd: report last_purged_snaps_scrub as part of beacon
Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:51 -05:00
Sage Weil
ab475cda08 osd: log purged_snaps scrub to cluster log
Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:51 -05:00
Sage Weil
a03e8ab662 osd: record last_purged_snaps_scrub in superblock
Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:51 -05:00
Sage Weil
e4aed74cd4 osd/OSDMap: add last_purged_snaps_stamp to osd_xinfo_t
Record OSDs' last scrub of purged_snaps in the OSDMap.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:51 -05:00
Sage Weil
6b26fcd1bd mon/OSDMonitor: fix bug in try_prune_purged_snaps
If 'begin' isn't found, we'll get a [pbegin,pend) range back that was
nearby.  Only if it overlaps the [begin,end) range do we want to shorten
our range to [begin,pbegin); the old assert was making the assumption
that the lookup would only return a range that was after 'begin', but in
reality it can return was that comes before it too.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:51 -05:00
Sage Weil
d831abeae1 mon/OSDMonitor: record snap removal seq as purged
When we delete a selfmanaged snap we have to bump seq.  Record this as
purged so that we avoid discontinuities in the history and so our storage
is a bit more efficient.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:51 -05:00
Sage Weil
bc0553147b mon/OSDMonitor: do not bother reporting gaps in removed_snaps
Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:51 -05:00
Sage Weil
d3d06bcd7c osdc/Objecter: don't worry about gap_removed_snaps from map gaps
This was an attempt to ensure that we didn't let removed_snaps slip by
when we had a discontiguous stream of OSDMaps.  In octopus, this can still
happen, but it's mostly harmless--the OSDs will periodically scrub to
clean up any resulting stray clones.  It's not worth the complexity.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:51 -05:00
Sage Weil
a1f649c2e7 mds/SnapServer: make not about pre-octopus compat code
Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:51 -05:00
Sage Weil
6192fb6031 osd: implement scrub_purged_snaps command
This a naive one-shot implementation that does the full scan synchronously
in the command thread.  It shouldn't block any IO except to the extent
that it will compete for IO reading the underlying snapmapper omap object.

When we discover mapped objects that are covered by ranges of snaps that
should be purged, we requeue the snapid for trim on the relevant PG(s).
For these 'repeat' trims we skip the final step(s) to mark the snapid as
purged, since that presumably already happened some time ago.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:51 -05:00
Sage Weil
7628474723 osd/PrimaryLogPG: always remove the snap we are trimming
This doesn't change behavior (yet), since we only trim snaps that are
marked for removal in the OSDMap.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:50 -05:00
Sage Weil
8d9a27f5ea ceph_test_rados_api_snapshots_pp: (partial) test to reproduce stray clones
The test creates a snap, removes it, waits for it to (hopefully) purge,
and then uses that snapid in a snapc to generate a clone.

This isn't a complete test because (1) it doesn't wait for the purge to
happen (e.g., by watching the osdmaps go by), and (2) it doesn't trigger
an osd scrub_purged_snaps afterwards.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:50 -05:00
Sage Weil
81f7edc6bd osd: sync old purged_snaps on startup after upgrade or osd creation
This path only triggers after an upgrade or osd creation, when
purged_snaps_last < current_epoch.  When that happens, we slurp down the
old purged snaps so that we have a full history recorded locally.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:50 -05:00
Sage Weil
87b539c2b6 osd: record purged_snaps when we store new maps
When we get a new map, record the (new) purged_snaps.

Only do this if the OSD has purged_snaps that are in sync with the latest
OSDMap.  That means that after an upgrade, if the OSD didn't sync the
old purged_snaps on startup, it won't sync anything until it *next* starts
up.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:50 -05:00
Sage Weil
7315d3fdba mon/OSDMonitor: add messages to get past purged_snaps
Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:50 -05:00
Sage Weil
4e5093cee3 mon/OSDMonitor: record pre-octopus purged snaps with first octopus map
When we public our first require_osd_release >= octopus osdmap, record
all prior purged snaps in a key linked to the previous osdmap.  We assume
this will encode and fit into a single key and transaction because the
even larger set of removed_snaps is already a member of pg_pool_t, which
is included in every osdmap.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:50 -05:00
Sage Weil
47fb89c072 mon/OSDMonitor: record purged_snaps for each epoch
Only do this if the mons are all running octopus (and thus there is also
a record for all the pre-octopus purged snaps).

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:50 -05:00
Sage Weil
847dc5fb78 mon/OSDMonitor: make_snap_epoch_key -> make_removed_snap_epoch_key
Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:50 -05:00
Sage Weil
3217ca77cb osd/osd_types: add purged_snaps_last to OSDSuperblock
Make this 0 for old encodings or new superblocks.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:50 -05:00
Sage Weil
61d8407514 osd/osd_types: clean up initial values for OSDSuperblock
Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:50 -05:00
Sage Weil
acd7e903d3 mon/OSDMonitor: make {removed,purged}_snap storage more efficient
Merge adjacent extents to keep the database smaller and lookups more
efficient.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:50 -05:00
Sage Weil
1e7718c37c mon/OSDMonitor: move (removed, purged) snap update into a helper
This is trivial at the moment, but we'll make it clever next.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:50 -05:00
Sage Weil
c0233801a8 mon/OSDMonitor: generalize/refactor lookup_*_snap
Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:50 -05:00
Sage Weil
c0f3624345 mon/OSDMonitor: refactor snap key and value helpers
Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:50 -05:00
Sage Weil
19a590e114 mon/OSDMonitor: make_snap_key -> make_removed_snap_key, make_purged_snap_key
Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:50 -05:00
Sage Weil
441f42b8ad mon/OSDMonitor: fix lookup_purged_snap implementation
- look at purged, not removed snap keys
- fix the key check to look at the *key name* prefix, not the overall
  prefix (the one implemented by the KeyValueDB interface).

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:50 -05:00
Sage Weil
a12d80a813 mon/OSDMonitor: lookup_pruned_snap -> lookup_purged_snap
This confused me and sent me into the weeds.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:50 -05:00
Sage Weil
94ebe0eab9 osd: adjust snapmapper keys on first start as octopus
Convert snapmapper keys to the new form the first time we start up running
octopus.

This is an incompat feature--once you start as octopus you can't go back.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:49 -05:00
Sage Weil
84bea65d3e osd/SnapMapper: include poolid in snap index
We want to sort starting with (pool, snapid, ...) so that we align with
the structure of the purged_snaps.  Simply flattening all snaps across
pools is less than ideal because the purge records are intervals (with the
snap in the key the last snap for the interval); flattening means we'd have
to look at many records (across pools) to conclude anything.  Putting
these in the form we really want them simplifies things going forward.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:49 -05:00
Sage Weil
14fdb52c50 mon/OSDMonitor: document osd snap metadata format
Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:49 -05:00
Sage Weil
e8a359814c osd/SnapMapper: document stored keys and values
Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:49 -05:00
Sage Weil
ec4cd08261 mon/OSDMonitor: use structured binding for prepare_remove_snaps
No functional change

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:49 -05:00
Sage Weil
e457b73075 mon/OSDMonitor: send MRemoveSnaps back to octopus MDS
The octopus MDS wants an explicit ack when snaps are removed.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:49 -05:00
Sage Weil
ab405ab560 mds/SnapServer: handle MRemoveSnaps acks from mon
Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:49 -05:00
Sage Weil
7eeee5b49b CMakeLists: include 'cephfs' (which includes libcephfs) in 'vstart' target
This ensures 'make vstart' will build libcephfs, which lets the mgr volumes
module start, such that we can successfully vstart.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:49 -05:00
Sage Weil
bc4c31a439 mon/PaxosService: add C_ReplyOp
Generic helper context to reply to an op on (successful) finish.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:49 -05:00
Sage Weil
75edd21c45 vnewosd.sh: add script to add a new osd to an existing vstart
Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:49 -05:00
Sage Weil
dcc8b6b28a vstart.sh: remove useless auth add for osds
'osd new' installs the key.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-07-02 08:37:49 -05:00