Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osd: Fix map gaps again (bug 15943) #12571

Merged
merged 3 commits into from
Dec 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions qa/config/rados.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions qa/suites/rados/thrash/thrashers/mapgap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions src/common/config_opts.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 24 additions & 1 deletion src/osd/PG.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
Expand Down Expand Up @@ -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);
Expand Down