-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Bug#121063 Members of one group assign different GNOs to the same transaction #736
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
Open
matias-sanchez
wants to merge
4
commits into
mysql:trunk
Choose a base branch
from
matias-sanchez:bug121063-stale-synode-reservation
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4276b11
Bug#121063 Members of one group assign different GNOs to the same tra…
267fed8
Bug#121063 Revalidate the reservation after wait_for_cache, with a un…
971d2b8
Bug#121063 Rework the unit test to use valid memberships and a real v…
matias-sanchez 549d04d
Bug#121063 Keep only the reservation check after wait_for_cache
matias-sanchez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
unittest/gunit/libmysqlgcs/xcom/gcs_xcom_stale_reservation-t.cc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| /* Copyright (c) 2026, Oracle and/or its affiliates. | ||
|
|
||
| This program is free software; you can redistribute it and/or modify | ||
| it under the terms of the GNU General Public License, version 2.0, | ||
| as published by the Free Software Foundation. | ||
|
|
||
| This program is designed to work with certain software (including | ||
| but not limited to OpenSSL) that is licensed under separate terms, | ||
| as designated in a particular file or component or in included license | ||
| documentation. The authors of MySQL hereby grant you an additional | ||
| permission to link the program and your derivative works with the | ||
| separately licensed software that they have either included with | ||
| the program or referenced in the documentation. | ||
|
|
||
| This program is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| GNU General Public License, version 2.0, for more details. | ||
|
|
||
| You should have received a copy of the GNU General Public License | ||
| along with this program; if not, write to the Free Software | ||
| Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ | ||
|
|
||
| #include <xcom/xcom_profile.h> | ||
| #include <xcom_vp.h> | ||
| #include "gcs_base_test.h" | ||
|
|
||
| #include "site_def.h" | ||
| #include "xcom_base.h" | ||
|
|
||
| namespace xcom_stale_reservation_unittest { | ||
|
|
||
| /* Bug#121063: a synode reserved under one node index must be recognised as no | ||
| longer ours once a view change gives this member a different index. */ | ||
| class XcomStaleReservation : public GcsBaseTest { | ||
| protected: | ||
| void SetUp() override { | ||
| /* The view in force when the synode is reserved: this member is node 1. */ | ||
| char const *names[]{"127.0.0.1:12341", "127.0.0.1:12342", | ||
| "127.0.0.1:12343"}; | ||
| node_address *na = new_node_address(3, names); | ||
|
|
||
| site_def *before = new_site_def(); | ||
| init_site_def(3, na, before); | ||
| before->start = synode_no{1, 10, 0}; | ||
| before->nodeno = 1; | ||
| push_site_def(before); | ||
| delete_node_address(3, na); | ||
| } | ||
|
|
||
| /* The view installed while the reservation is held: the first member is | ||
| gone, so this one is now node 0. */ | ||
| void install_new_view() { | ||
| char const *names[]{"127.0.0.1:12342", "127.0.0.1:12343"}; | ||
| node_address *na = new_node_address(2, names); | ||
|
|
||
| site_def *after = new_site_def(); | ||
| init_site_def(2, na, after); | ||
| after->start = synode_no{1, 20, 0}; | ||
| after->nodeno = 0; | ||
| push_site_def(after); | ||
| delete_node_address(2, na); | ||
| } | ||
|
|
||
| void TearDown() override { free_site_defs(); } | ||
| }; | ||
|
|
||
| /* Under the view it was taken in, the reservation is ours. */ | ||
| TEST_F(XcomStaleReservation, reservation_under_the_current_index_is_fresh) { | ||
| install_new_view(); | ||
| synode_no const reserved{1, 15, 1}; | ||
| ASSERT_FALSE(reservation_is_stale(reserved)); | ||
| } | ||
|
|
||
| /* After the renumbering, the same index belongs to another node. */ | ||
| TEST_F(XcomStaleReservation, reservation_outliving_a_renumbering_is_stale) { | ||
| synode_no const reserved{1, 25, 1}; | ||
| ASSERT_FALSE(reservation_is_stale(reserved)); | ||
| install_new_view(); | ||
| ASSERT_TRUE(reservation_is_stale(reserved)); | ||
| } | ||
|
|
||
| /* A slot that carries the index this member holds now is usable. */ | ||
| TEST_F(XcomStaleReservation, slot_matching_the_new_index_is_fresh) { | ||
| install_new_view(); | ||
| synode_no const reserved{1, 25, 0}; | ||
| ASSERT_FALSE(reservation_is_stale(reserved)); | ||
| } | ||
|
|
||
| /* Without a site there is nothing to compare against. */ | ||
| TEST_F(XcomStaleReservation, unknown_site_is_not_reported_stale) { | ||
| synode_no const other_group{99, 25, 0}; | ||
| ASSERT_FALSE(reservation_is_stale(other_group)); | ||
| } | ||
|
|
||
| } // namespace xcom_stale_reservation_unittest |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to think a bit more about this, because I don't know exactly how
find_site_defbehaves for synodes that were still in the proposal phase. It works well for synodes that are already in the stream and accepted by the group.That synode might still happen, but now necessarily with the data you are proposing. That is why we have checks like
if (match_my_msg(ep->p->learner.msg, ep->client_msg->p))There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Tiago. As far as I can tell
find_site_defdoes not treat the two cases differently: it walks thesite_defslist comparing the synode against each site's start, and has no notion of whether the synode was proposed, accepted or executed.On
match_my_msg, I think it catches a different scenario: it runs after finished(p), so the value is already learned and kept by handle_learn's re-learn guard by then.Let me know if you think I might be missing something. It is tough source code i'm not entirely familiar with.