Skip to content

mon/ElectionLogic: tie-breaker mon ignore proposal from marked down mon - #57906

Merged
yuriw merged 2 commits into
ceph:mainfrom
kamoltat:wip-ksirivad-stretch-mode-netsplit-test
Jul 16, 2024
Merged

yuriw merged 2 commits into
ceph:mainfrom
kamoltat:wip-ksirivad-stretch-mode-netsplit-test

Conversation

@kamoltat

@kamoltat kamoltat commented Jun 5, 2024 •

Copy link
Copy Markdown
Member

To view full analysis here:

https://docs.google.com/document/d/1YW7RKTUlMw2nxB9vzg_7Dp32i0Tf7i1WOt6gvyZOV-g/edit?usp=sharing

Problem:

Monitor election gets stuck,
resulting in the cluster being
unaccessible.

Set up stretch cluster:
DC1: mon.a,mon.b
DC2: mon.c, mon.d
Arbiter: mon.e

Apply netsplit between
DC1 and DC2, wait around
10 seconds, client tried accessing
the cluster ... failed to access.

We expect the cluster to be functional
when there is netsplit.

This was due to how we suppose to
kick one DC out of quorum and keep them in the
dark until the connection comes back (netsplit gone).
However, there is a small window where the out-of-quorum
DC is able to have an influence on the tiebreaker MON
by forcing the tiebreaker MON to bump its epoch
which then it will reject the winner MON's victory
message from in-quorum DC.

Solution:

In CONNECTIVITY election strategy,
tie-breaker MON disregard any proposal that is coming
from MONs that belongs to stretch_marked_down_mons
set. As a result, the out-of-quorum
MONs won't get the chance to force the tie-breaker
MON to increase its epoch, hence will now accept
the victory message from the in-quorum Monitors.

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

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 Jun 5, 2024
@kamoltat
kamoltat requested a review from a team as a code owner June 5, 2024 20:56
@kamoltat
kamoltat force-pushed the wip-ksirivad-stretch-mode-netsplit-test branch 7 times, most recently from eac35df to 6e3baa8 Compare June 10, 2024 14:44
@kamoltat
kamoltat force-pushed the wip-ksirivad-stretch-mode-netsplit-test branch from 6e3baa8 to 928f878 Compare June 13, 2024 17:25
@kamoltat kamoltat changed the title qa/suites/netsplit/tests/2-dc-1-arbiter-stretch-cluster-netsplit.yaml mon/ElectionLogic: ignore proposal from marked down mon Jun 17, 2024
@kamoltat

Copy link
Copy Markdown
Member Author

@kamoltat

Copy link
Copy Markdown
Member Author

make check failed:

FAILED: src/test/mon/CMakeFiles/unittest_mon_election.dir/test_election.cc.o 
/usr/bin/ccache /usr/bin/clang++-14 -DBOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION -DBOOST_ASIO_HAS_IO_URING -DBOOST_ASIO_NO_TS_EXECUTORS -DBOOST_DATE_TIME_DYN_LINK -DBOOST_DATE_TIME_NO_LIB -DBOOST_IOSTREAMS_DYN_LINK -DBOOST_IOSTREAMS_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_RANDOM_DYN_LINK -DBOOST_RANDOM_NO_LIB -DBOOST_SYSTEM_DYN_LINK -DBOOST_SYSTEM_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DHAVE_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_REENTRANT -D_THREAD_SAFE -D__CEPH__ -D__STDC_FORMAT_MACROS -D__linux__ -I/home/jenkins-build/build/workspace/ceph-pull-requests/build/src/include -I/home/jenkins-build/build/workspace/ceph-pull-requests/src -isystem /opt/ceph/include -isystem /home/jenkins-build/build/workspace/ceph-pull-requests/build/include -isystem /home/jenkins-build/build/workspace/ceph-pull-requests/src/jaegertracing/opentelemetry-cpp/api/include -isystem /home/jenkins-build/build/workspace/ceph-pull-requests/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/include -isystem /home/jenkins-build/build/workspace/ceph-pull-requests/src/jaegertracing/opentelemetry-cpp/ext/include -isystem /home/jenkins-build/build/workspace/ceph-pull-requests/src/jaegertracing/opentelemetry-cpp/sdk/include -isystem /home/jenkins-build/build/workspace/ceph-pull-requests/src/xxHash -isystem /home/jenkins-build/build/workspace/ceph-pull-requests/src/fmt/include -isystem /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googlemock/include -isystem /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googlemock -isystem /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include -isystem /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest -isystem /home/jenkins-build/build/workspace/ceph-pull-requests/src/rocksdb/include -isystem /home/jenkins-build/build/workspace/ceph-pull-requests/build/src/liburing/src/include -g -Werror -fPIE -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -DBOOST_PHOENIX_STL_TUPLE_H_ -Wall -fno-strict-aliasing -fsigned-char -Wtype-limits -Wignored-qualifiers -Wpointer-arith -Werror=format-security -Winit-self -Wno-unknown-pragmas -Wnon-virtual-dtor -Wno-ignored-qualifiers -ftemplate-depth-1024 -Wpessimizing-move -Wredundant-move -Wno-inconsistent-missing-override -Wno-mismatched-tags -Wno-unused-private-field -Wno-address-of-packed-member -Wno-unused-function -Wno-unused-local-typedef -Wno-varargs -Wno-gnu-designator -Wno-missing-braces -Wno-parentheses -Wno-deprecated-register -DCEPH_DEBUG_MUTEX -D_GLIBCXX_ASSERTIONS -fdiagnostics-color=auto -std=c++20 -MD -MT src/test/mon/CMakeFiles/unittest_mon_election.dir/test_election.cc.o -MF src/test/mon/CMakeFiles/unittest_mon_election.dir/test_election.cc.o.d -o src/test/mon/CMakeFiles/unittest_mon_election.dir/test_election.cc.o -c /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc
/home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:300:23: error: allocating an object of abstract class type 'Owner'
    electors[i] = new Owner(i, election_strategy, tracker_halflife, this);
                      ^
/home/jenkins-build/build/workspace/ceph-pull-requests/src/mon/ElectionLogic.h:90:16: note: unimplemented pure virtual method 'is_stretch_marked_down_mons' in 'Owner'
  virtual bool is_stretch_marked_down_mons(int rank) const = 0;
               ^
1 error generated.

@rzarzynski
rzarzynski requested a review from gregsfortytwo June 17, 2024 16:01

@gregsfortytwo gregsfortytwo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems broken: if a monitor is marked down in stretch mode, and we ignore all proposals from it, how can a monitor stop being marked down?

Comment thread src/mon/ElectionLogic.cc Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is supposed to be handled a few blocks below

// drop this message; it won't change our vote so we defer to leader

Why didn't that work?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @gregsfortytwo ,
So it didn't work because there is a scenario where out-of-quorum and in-quorum mon are all both in electing state, this is due to monmap change. Therefore, in this check:

if ((epoch % 2 == 0) &&
last_election_winner != elector->get_my_rank() &&
!elector->is_current_member(from))

We wouldn't go in because epoch % 2 != 0 since it is in electing state, therefore this allows the out of quorum mon to bump the epoch of the tiebreaker mon (in quorum) since we will continue down to

if (mepoch > epoch) {
    ldout(cct, 20) << "mepoch > epoch" << dendl;
    connectivity_bump_epoch_in_election(mepoch);

For a full explanation with log evidence, go to Logs analysis on a failed test section: https://docs.google.com/document/d/1YW7RKTUlMw2nxB9vzg_7Dp32i0Tf7i1WOt6gvyZOV-g/edit

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's be careful with our language here: if we are electing, there is no quorum right now. :)
But that explanation makes sense.

@kamoltat

kamoltat commented Jun 19, 2024 •

Copy link
Copy Markdown
Member Author

Yes at the time of this comment, the solution is yet to work properly, I have an idea that we can make the check exclusive to only a tiebreaker monitor, which means it will deal with the corner case mentioned in the PR and won't block other the monitors that have been marked down from being marked back up when netsplit stops and it can reach the
non-tiebreaker monitors from the other DC. Will try it out and paste my findings.

@kamoltat
kamoltat force-pushed the wip-ksirivad-stretch-mode-netsplit-test branch from 928f878 to b5176fc Compare June 19, 2024 04:13
@kamoltat

Copy link
Copy Markdown
Member Author

New solution (check exclusive to only a tiebreaker monitor) tested 1/1 Passed: https://pulpito.ceph.com/ksirivad-2024-06-20_14:57:56-netsplit-wip-ksirivad-stretch-mode-netsplit-test-distro-default-smithi/

waiting on another test with 10 Jobs, lets see if it passes all 10

@kamoltat kamoltat changed the title mon/ElectionLogic: ignore proposal from marked down mon mon/ElectionLogic: tie-breaker mon ignore proposal from marked down mon Jun 20, 2024
@kamoltat

Copy link
Copy Markdown
Member Author

@kamoltat

kamoltat commented Jun 21, 2024 •

Copy link
Copy Markdown
Member Author

@gregsfortytwo please re-review my solution thanks!

Here is a detailed log analysis of now why the solution now work, please see section: Tested Solution iteration 2 (Success Analysis) in https://docs.google.com/document/d/1YW7RKTUlMw2nxB9vzg_7Dp32i0Tf7i1WOt6gvyZOV-g/edit#heading=h.gfha0kk53jkp

@kamoltat
kamoltat force-pushed the wip-ksirivad-stretch-mode-netsplit-test branch from b5176fc to b355a01 Compare June 25, 2024 15:46
kamoltat added 2 commits June 26, 2024 15:21
Problem:

Monitor election gets stuck,
resulting in the cluster being
unaccessible.

Set up stretch cluster:
DC1: mon.a,mon.b
DC2: mon.c, mon.d
Arbiter: mon.e

Apply netsplit between
DC1 and DC2, wait around
10 seconds, client tried accessing
the cluster ... failed to access.

We expect the cluster to be functional
when there is netsplit.

This was due to how we suppose to
kick one DC out of quorum and keep them in the
dark until the connection comes back (netsplit gone).
However, there is a small window where the out-of-quorum
DC is able to have an influence on the tiebreaker MON
by forcing the tiebreaker MON to bump its epoch
which then it will reject the winner MON's victory
message from in-quorum DC.

Solution:
In CONNECTIVITY election strategy,
tie-breaker MON disregard any proposal that is coming
from MONs that belongs to `stretch_marked_down_mons`
set. As a result, the out-of-quorum
MONs won't get the chance to force the tie-breaker
MON to increase its epoch, hence will now accept
the victory message from the in-quorum Monitors.

Also, edited src/test/mon/test_election.cc
to include `is_stretch_marked_down_mon`
and `is_tiebreaker`,
preventing the make check from breaking.

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

Signed-off-by: Kamoltat <[email protected]>
Test netsplit between 2 datacenters
in a stretch mode cluster.

Observe if:

- PGs are active
- Cluster is accessible
- Writes and Reads went through

Signed-off-by: Kamoltat <[email protected]>
@kamoltat
kamoltat force-pushed the wip-ksirivad-stretch-mode-netsplit-test branch from b355a01 to 7a90d9d Compare June 26, 2024 15:22

@gregsfortytwo gregsfortytwo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed-by: Greg Farnum [email protected]

This feels a little icky to me, I think because I don't like keeping monitors out at this part of the process. But the tiebreaker is indeed special, and constrained, and this solution nicely maps onto that by keeping the tiebreaker from changing its mind erratically, and by forcing net split DCs to connect to each other before merging them back in.

@kamoltat kamoltat added the needs-squid-backport PR needs a squid backport label Jun 26, 2024
@kamoltat

Copy link
Copy Markdown
Member Author

Thank you for your review Greg :)

@kamoltat

Copy link
Copy Markdown
Member Author

jenkins test make check

@yuriw

yuriw commented Jul 16, 2024

Copy link
Copy Markdown
Contributor

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.

4 participants