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-19120 Raft client should get leader metadata along while getting leader itself #2255

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

Conversation

vldpyatkov
Copy link
Contributor

@@ -41,4 +41,14 @@ public LeaderWithTerm(@Nullable Peer leader, long term) {
public long term() {
return term;
}

@Override
public String toString() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we use S.toString(LeaderWithTerm.class, this); ?

*
* @return Leader peer with corresponding term.
*/
IgniteBiTuple<PeerId, Long> getLeaderWithTer();
Copy link
Contributor

Choose a reason for hiding this comment

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

getLeaderWithTerm

}
finally {
this.readLock.unlock();
this.metrics.recordLatency("handle-read-index", Utils.monotonicMs() - startMs);
Copy link
Contributor

Choose a reason for hiding this comment

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

copy paste

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What's your proposal?

@@ -347,6 +356,83 @@ public void testNotificationToPlacementDriverAboutMajorityLoss() throws Exceptio
stopReplicationGroup(GROUP_ID, grpNodes);
}

@Test
@Disabled("IGNITE-19120 Raft client should get leader metadata along while getting leader itself")
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this test disabled with the current ticket?

1_000
);

Thread.sleep(2_000);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think that this is a good solution

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is a disable test. When the corresponding ticket be implemented, it will be able to rewrite.


list.removeAll(exceptNodes);

Collections.shuffle(list);
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need to shuffle the whole list, if we can generate random index to get?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nothing change, do you insist that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moreover, we are already using this way for the same reason in other place.

private CompletableFuture<AtomicReference<ClusterNode>> leaderFuture = new CompletableFuture<>();

private AtomicReference<ClusterNode> leaderRef = new AtomicReference<>();
// TODO:IGNITE-19120 Raft client should get leader metadata along while getting leader itself
Copy link
Contributor

Choose a reason for hiding this comment

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

todo with the current ticket number

if (leaseExpirationTime != null) {
assert msg.leaseExpirationTime().after(leaseExpirationTime) : "Invalid lease expiration time in message, msg=" + msg;
}
return readyMajority.thenCompose(unused -> raftClient.readLeaderMetadata()).thenCompose(leaderMetadata -> {
Copy link
Contributor

Choose a reason for hiding this comment

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

what if a majority was lost on the moment of the call?

.thenCompose(v -> {
if (msg.leaseExpirationTime().getPhysical() < currentTimeMillis()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the correct way to compare hybrid timestamp? I was expecting HybridTimestamp#compareTo with clock.now

* @param ex An exception
* @return True if this exception has thrown due to timeout or connection problem, false otherwise.
*/
private static boolean isConnectivityRelatedException(Throwable ex) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this method is not used anywhere

@sanpwc sanpwc self-requested a review June 28, 2023 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants