Merge pull request #12571 from athanatos/wip-15943

osd: Fix map gaps again (bug 15943)

Reviewed-by: Brad Hubbard <bhubbard@redhat.com>
Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Samuel Just 2016-12-19 13:50:15 -08:00 committed by GitHub
commit dc639fd9e5
4 changed files with 29 additions and 4 deletions

View File

@ -5,3 +5,4 @@ overrides:
osd op queue: debug_random
osd op queue cut off: debug_random
osd debug verify missing on start: true
osd debug verify cached snaps: true

View File

@ -18,6 +18,6 @@ tasks:
- osd_map_cache_size
- thrashosds:
timeout: 1800
chance_pgnum_grow: 1
chance_pgpnum_fix: 1
chance_test_map_discontinuity: 0.5
chance_pgnum_grow: 0.25
chance_pgpnum_fix: 0.25
chance_test_map_discontinuity: 2

View File

@ -841,6 +841,7 @@ OPTION(osd_debug_reject_backfill_probability, OPT_DOUBLE, 0)
OPTION(osd_debug_inject_copyfrom_error, OPT_BOOL, false) // inject failure during copyfrom completion
OPTION(osd_debug_randomize_hobject_sort_order, OPT_BOOL, false)
OPTION(osd_debug_misdirected_ops, OPT_BOOL, false)
OPTION(osd_debug_verify_cached_snaps, OPT_BOOL, false)
OPTION(osd_enable_op_tracker, OPT_BOOL, true) // enable/disable OSD op tracking
OPTION(osd_num_op_tracker_shard, OPT_U32, 32) // The number of shards for holding the ops
OPTION(osd_op_history_size, OPT_U32, 20) // Max number of completed ops to track

View File

@ -164,7 +164,7 @@ void PGPool::update(OSDMapRef map)
auid = pi->auid;
name = map->get_pool_name(id);
bool updated = false;
if ((map->get_epoch() == cached_epoch + 1) &&
if ((map->get_epoch() != cached_epoch + 1) ||
(pi->get_snap_epoch() == map->get_epoch())) {
updated = true;
pi->build_removed_snaps(newly_removed_snaps);
@ -182,6 +182,16 @@ void PGPool::update(OSDMapRef map)
}
snapc = pi->get_snap_context();
} else {
/* 1) map->get_epoch() == cached_epoch + 1 &&
* 2) pi->get_snap_epoch() != map->get_epoch()
*
* From the if branch, 1 && 2 must be true. From 2, we know that
* this map didn't change the set of removed snaps. From 1, we
* know that our cached_removed_snaps matches the previous map.
* Thus, from 1 && 2, cached_removed snaps matches the current
* set of removed snaps and all we have to do is clear
* newly_removed_snaps.
*/
newly_removed_snaps.clear();
}
cached_epoch = map->get_epoch();
@ -5694,6 +5704,19 @@ void PG::handle_advance_map(
<< dendl;
update_osdmap_ref(osdmap);
pool.update(osdmap);
if (cct->_conf->osd_debug_verify_cached_snaps) {
interval_set<snapid_t> actual_removed_snaps;
const pg_pool_t *pi = osdmap->get_pg_pool(info.pgid.pool());
assert(pi);
pi->build_removed_snaps(actual_removed_snaps);
if (!(actual_removed_snaps == pool.cached_removed_snaps)) {
derr << __func__ << ": mismatch between the actual removed snaps "
<< actual_removed_snaps << " and pool.cached_removed_snaps "
<< " pool.cached_removed_snaps " << pool.cached_removed_snaps
<< dendl;
}
assert(actual_removed_snaps == pool.cached_removed_snaps);
}
AdvMap evt(
osdmap, lastmap, newup, up_primary,
newacting, acting_primary);