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

IGNITE-24206 Add index and term to RaftGroupConfiguration #5083

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

alievmirza
Copy link
Contributor

https://issues.apache.org/jira/browse/IGNITE-24206

Thank you for submitting the pull request.

To streamline the review process of the patch and ensure better code quality
we ask both an author and a reviewer to verify the following:

The Review Checklist

  • Formal criteria: TC status, codestyle, mandatory documentation. Also make sure to complete the following:
    - There is a single JIRA ticket related to the pull request.
    - The web-link to the pull request is attached to the JIRA ticket.
    - The JIRA ticket has the Patch Available state.
    - The description of the JIRA ticket explains WHAT was made, WHY and HOW.
    - The pull request title is treated as the final commit message. The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
  • Design: new code conforms with the design principles of the components it is added to.
  • Patch quality: patch cannot be split into smaller pieces, its size must be reasonable.
  • Code quality: code is clean and readable, necessary developer documentation is added if needed.
  • Tests code quality: test set covers positive/negative scenarios, happy/edge cases. Tests are effective in terms of execution time and resources.

Notes

@alievmirza alievmirza changed the title IGNITE-24206 IGNITE-24206 Add index and term to RaftGroupConfiguration Jan 21, 2025
@IgniteToStringInclude
private final List<String> peers;
@IgniteToStringInclude
private final List<String> learners;



Copy link
Contributor

Choose a reason for hiding this comment

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

Extra blank line

@@ -34,6 +34,8 @@ public class RaftGroupConfigurationSerializer extends VersionedSerializer<RaftGr

@Override
protected void writeExternalData(RaftGroupConfiguration config, IgniteDataOutput out) throws IOException {
out.writeLong(config.index());
Copy link
Contributor

Choose a reason for hiding this comment

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

This PR is not going to go to release 3.0 and this is a breaking change. Let's create second version of the serializer. Another option is to agree on the mailing list to include this issue to the release.

@@ -61,10 +65,12 @@ void serializationAndDeserializationWithNulls() {

@Test
void v1CanBeDeserialized() {
Copy link
Contributor

Choose a reason for hiding this comment

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

If this PR is not going to be included in the 3.0 release, then changes to this test need to be reverted and another test needs to be added (v2CanBeDeserialized())

@@ -57,6 +57,10 @@ public interface SnapshotMeta extends Message {

long lastIncludedTerm();

long cfgIndex();
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need these fields for all raft groups or just for partitions (or for partitions + metastorage)? If not for all of them, then probably they don't need to be added here as they are not part of the Raft protocol. If only partitions need them, PartitionSnapshotMeta seems to be a more suitable place to add these fields.

@@ -32,11 +32,16 @@
public class RaftGroupConfiguration implements Serializable {
Copy link
Contributor

Choose a reason for hiding this comment

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

This class now seems to be identical to CommittedConfiguration. Do we need to keep both?


assertTrue(cluster.stop(newPeer.getPeerId()));

// apply something more
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// apply something more
// Apply something more.

Comment on lines +3593 to +3595
assertEquals(3, cluster.getFsms().size());
for (MockStateMachine fsm : cluster.getFsms())
assertEquals(20, fsm.getLogs().size(), fsm.getPeerId().toString());
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are these assertions needed? They don't seem to relate to the thing the test is testing, so they just serve as an obstacle when trying to understand what happens here

Comment on lines +3532 to +3533
metaTerm.set(meta.cfgTerm());
metaIndex.set(meta.cfgIndex());
Copy link
Contributor

Choose a reason for hiding this comment

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

Can any of 3 nodes write its index+term to atomics or just the leader? How about restricting this explicitly by peerId?

Copy link
Contributor

Choose a reason for hiding this comment

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

If we only need indexes and terms from the leader, then why do we need other nodes? Why one of them is stopped?


// Leader hasn't been changed, term must stay the same
assertEquals(1, term.get());
// idx_2 == joint consensus, idx_3 is expected final cfg
Copy link
Contributor

Choose a reason for hiding this comment

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

If I'm not mistaken, the scenario starts with having just [A] as voting set and then expands it to [ABC]. It looks like joint config is the final configuration. Does it really require 2 steps?

@@ -3506,6 +3507,102 @@ public void onRawConfigurationCommitted(ConfigurationEntry conf) {
);
}

@Test
public void testIndexAndTermOfCfgArePropagatedToSnapshotMeta() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

The scenario is pretty lengthy and complex. Could you please elaborate on it in the javadoc? What it tests for, what the scenario is, what verifications are made...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants