Skip to content

PeeringState.cc: Only populate want_acting when num_osds < bucket_max - #57381

Merged
kamoltat merged 1 commit into
ceph:mainfrom
kamoltat:wip-ksirivad-fix-65371
Aug 7, 2024
Merged

kamoltat merged 1 commit into
ceph:mainfrom
kamoltat:wip-ksirivad-fix-65371

Conversation

@kamoltat

@kamoltat kamoltat commented May 9, 2024 •

Copy link
Copy Markdown
Member

Currently, in calc_replicated_acting_stretch
we would call pop_ancester before checking whether
the next OSD we populate in the want_acting set would have
the ancestor count that is >= bucket_max.

Fixes: https://tracker.ceph.com/issues/65371

ATTENTION:

THIS PR SHOULD BE TESTED IN CONJUNCTION WITH #56233

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows
  • jenkins test rook e2e

@kamoltat kamoltat self-assigned this May 9, 2024
@kamoltat
kamoltat requested a review from a team as a code owner May 9, 2024 20:23
@github-actions github-actions Bot added the core label May 9, 2024
@kamoltat kamoltat added needs-squid-backport PR needs a squid backport needs-reef-backport core and removed core labels May 9, 2024
@kamoltat
kamoltat requested a review from gregsfortytwo May 10, 2024 14:53
@kamoltat
kamoltat force-pushed the wip-ksirivad-fix-65371 branch from 9f37ccd to f0ded5f Compare May 15, 2024 15:03
@ljflores

ljflores commented Jun 3, 2024

Copy link
Copy Markdown
Member

@gregsfortytwo we saw this bug again in bug scrub; just pinging you for a review.

@kamoltat

kamoltat commented Jun 20, 2024 •

Copy link
Copy Markdown
Member Author

@gregsfortytwo pinging again for review

@kamoltat

kamoltat commented Jul 16, 2024 •

Copy link
Copy Markdown
Member Author

/a/ksirivad-2024-07-12_16:29:18-rados-wip-ksirivad-pr-56233-plus-57381-distro-default-smithi/

287/316 Passed (scheduled against RADOS suite, using a branch that combines #56233 with #57381 
wip-ksirivad-pr-56233-plus-57381



FAILED & DEAD jobs unrelated



7798816, 7798892, 7798966, 7799045 https://tracker.ceph.com/issues/66881 qa/workunits/cephtool/test.sh: cannot remove '/tmp/foo': Operation not permitted
7798822, 7798839, 7798981, 7798912, 7799122 https://tracker.ceph.com/issues/61774 centos 9 testing reveals rocksdb "Leak_StillReachable" memory leak in mons
7798870, 7799029 https://tracker.ceph.com/issues/62972 ERROR: test_list_enabled_module (tasks.mgr.dashboard.test_mgr_module.MgrModuleTest)
7798904, tracker.ceph.com/issues/63784 qa/standalone/mon/mkfs.sh:'mkfs/a' already exists and is not empty: monitor may already exist
7798953 https://tracker.ceph.com/issues/66922 rados/dashboard/{0-single-container-host debug/mgr mon_election/classic random-objectstore$/{bluestore-comp-zlib} tasks/e2e}
7798962 https://tracker.ceph.com/issues/66209 ec-rados-plugin=jerasure-k=8-m=6-crush: too many values to unpack (expected 1)
7799030 https://tracker.ceph.com/issues/66658 qa/workunits/dencoder/test-dencoder.sh: Error encountered in subprocess. Command: ['ceph-dencoder', 'type', 'cls_rgw_reshard_get_ret’]
7799035 https://tracker.ceph.com/issues/66602 cluster [WRN] Health check failed: 1 pool(s) do not have an application enabled (POOL_APP_NOT_ENABLED)" in cluster log
7799054 https://tracker.ceph.com/issues/61774 centos 9 testing reveals rocksdb "Leak_StillReachable" memory leak in mons
7799111 https://tracker.ceph.com/issues/64870 Health check failed: 1 osds down (OSD_DOWN)

RADOS approved

@athanatos

athanatos commented Jul 24, 2024 •

Copy link
Copy Markdown
Contributor

I'm actually not sure this is the correct fix. The original code:

  while (!aheap.is_empty() && want->size() < pool.info.size) {
    auto next = aheap.pop();
    pop_ancestor(next.get());
    if (next.get().get_num_selected() < bucket_max) {
      aheap.push_if_nonempty(next);
    }
  }

suggests that the invariant is that next.get().get_num_selected() < bucket_max is supposed to be true for all elements in aheap. The condition there is that we re-add it if next.get().get_num_selected() < bucket_max after we call pop_ancestor(next.get()). Instead, I suspect that the problem is that the previous loop

  bucket_heap_t aheap;
  std::for_each(ancestors.begin(), ancestors.end(), [&](auto &anc) {
    aheap.push_if_nonempty(anc.second);
  });

doesn't actually enforce that invariant. Specifically, the ancestors for any primary or up osds we added up in step 1):

  auto add_required = [&](int osd) {
    if (!used(osd)) {
      want->push_back(osd);
      acting_backfill->insert(
	pg_shard_t(osd, shard_id_t::NO_SHARD));
      get_ancestor(osd)->inc_selected();
    }
  };
  add_required(primary->first.osd);
  ss << " osd " << primary->first.osd << " primary accepted "
     << osd_info(primary->first.osd) << std::endl;
  for (auto upcand: up) {
    auto upshard = pg_shard_t(upcand, shard_id_t::NO_SHARD);
    auto &curinfo = osd_info(upcand);
    if (usable_osd(upcand)) {
      ss << " osd " << upcand << " (up) accepted " << curinfo << std::endl;
      add_required(upcand);
    } else {

via add_required will already have had inc_selected() called and could possibly already have hit bucket_max. I think the better fix would be to correct the loop above to check for the bucket_max condition in addition to whether the ancestor is empty:

  bucket_heap_t aheap;
  std::for_each(ancestors.begin(), ancestors.end(), [&](auto &anc) {
    if (anc.second.get_num_selected() < bucket_max) {
      aheap.push_if_nonempty(anc.second);
    }
  });

@kamoltat

kamoltat commented Jul 25, 2024 •

Copy link
Copy Markdown
Member Author

@athanatos
Hmm I'm not sure if I agree, using the example where I reproduced the issue in the tracker:

calc_replicated_acting_stretch
bucket_max: 2
 osd 8 primary accepted 15.6( v 971'2 (0'0,971'2] local-lis/les=982/983 n=0 ec=964/964 lis/c=982/969 les/c/f=983/971/0 sis=984)
 osd 8 (up) accepted 15.6( v 971'2 (0'0,971'2] local-lis/les=982/983 n=0 ec=964/964 lis/c=982/969 les/c/f=983/971/0 sis=984)
 osd 6 (up) accepted 15.6( v 971'2 (0'0,971'2] local-lis/les=982/983 n=0 ec=964/964 lis/c=982/969 les/c/f=983/971/0 sis=984)
want: [8,6]
acting: [8,6,7]
ancestors: {-9=candidates[<>]}
 up set insufficient, considering remaining osds
 acting candidate 7 15.6( v 971'2 (0'0,971'2] local-lis/les=982/983 n=0 ec=964/964 lis/c=982/969 les/c/f=983/971/0 sis=984)
 next: candidates[<0,971'2,7>]
pop_ancestor accepting candidate 7
want is now: [8,6,7]
acting_backfill is now: 6,7,8
 num_selected: 3

Here based on the code:

  auto add_required = [&](int osd) {
    if (!used(osd)) {
      want->push_back(osd);
      acting_backfill->insert(
	pg_shard_t(osd, shard_id_t::NO_SHARD));
      get_ancestor(osd)->inc_selected();
    }
  };
  add_required(primary->first.osd);
  ss << " osd " << primary->first.osd << " primary accepted "
     << osd_info(primary->first.osd) << std::endl;
  for (auto upcand: up) {
    auto upshard = pg_shard_t(upcand, shard_id_t::NO_SHARD);
    auto &curinfo = osd_info(upcand);
    if (usable_osd(upcand)) {
      ss << " osd " << upcand << " (up) accepted " << curinfo << std::endl;
      add_required(upcand);
    } else {

I'm pretty certain that during the time we logged

 osd 8 primary accepted 15.6( v 971'2 (0'0,971'2] local-lis/les=982/983 n=0 ec=964/964 lis/c=982/969 les/c/f=983/971/0 sis=984)
 osd 8 (up) accepted 15.6( v 971'2 (0'0,971'2] local-lis/les=982/983 n=0 ec=964/964 lis/c=982/969 les/c/f=983/971/0 sis=984)
 osd 6 (up) accepted 15.6( v 971'2 (0'0,971'2] local-lis/les=982/983 n=0 ec=964/964 lis/c=982/969 les/c/f=983/971/0 sis=984)

num_selected = 2
because add_required(primary->first.osd) osd.8 would increment num_selected, then added to want so the next time osd.8 accepts as the upset, it won't increment because it is already used. Now we go to osd.6 which will increment num_selected because it is yet in the want set. So the remaining candidate is osd.9 which will not get incremented until pop_ancestor is called which is in:

  while (!aheap.is_empty() && want->size() < pool.info.size) {
    auto next = aheap.pop();
    pop_ancestor(next.get());
    if (next.get().get_num_selected() < bucket_max) {
      aheap.push_if_nonempty(next);
    }
  }

Therefore, if we were to add a check when populating the aheap, num_selected will still be < bucket_max

@athanatos

Copy link
Copy Markdown
Contributor

@kamoltat In your example, 8, 6, and 7 all have the same common ancestor right? If 8 and 6 are in up and bucket_max is 2,

  bucket_heap_t aheap;
  std::for_each(ancestors.begin(), ancestors.end(), [&](auto &anc) {
    if (anc.second.get_num_selected() < bucket_max) {
      aheap.push_if_nonempty(anc.second);
    }
  });

would skip adding 9 to aheap as anc.second.get_num_selected() would already be 2 and therefore >= bucket_max.

@kamoltat
kamoltat force-pushed the wip-ksirivad-fix-65371 branch from f0ded5f to 4693cf8 Compare August 5, 2024 12:11
Currently, in `calc_replicated_acting_stretch` we would
call `pop_ancester` before checking whether the next
OSD we populate in the want_acting set would have
the ancestor count that is >= bucket_max.

Fixes: https://tracker.ceph.com/issues/65371

Signed-off-by: Kamoltat <[email protected]>
@kamoltat
kamoltat force-pushed the wip-ksirivad-fix-65371 branch from 4693cf8 to e26545f Compare August 5, 2024 12:13
@kamoltat

kamoltat commented Aug 7, 2024 •

Copy link
Copy Markdown
Member Author

RADOS APPROVED

/ksirivad-2024-08-06_15:03:07-rados-wip-ksirivad-57381-and-56233-distro-default-smithi/

Known Failures:

  1. https://tracker.ceph.com/issues/66883 OSDs - marked "down and dead" during rados/thrash-old-clients tests time out in recovery
  2. https://tracker.ceph.com/issues/62972 - ERROR: test_list_enabled_module (tasks.mgr.dashboard.test_mgr_module.MgrModuleTest)
  3. https://tracker.ceph.com/issues/66602 - rados/upgrade: Health check failed: 1 pool(s) do not have an application enabled (POOL_APP_NOT_ENABLED)
  4. https://tracker.ceph.com/issues/67263 - ceph-dencoder.sh fail beacuse no backword compability to cls_rgw_reshard_entry
  5. https://tracker.ceph.com/issues/67225 - cephadm TLS/SSL connection has been closed
  6. https://tracker.ceph.com/issues/67302 - KarnelDevice showing Conditional jump or move depends on uninitialised value(s) valgrind error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants