From f121cd3beb4b1b5a3acd991a099bbe4177eaa547 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Mon, 17 Jul 2017 17:47:48 +0900 Subject: [PATCH] Fix pre-6.0 response to unknown replication actions When sending replica requests for replication operations, we skip sending the request to pre-6.0 nodes for operations that such nodes would not be aware of (e.g., the background global checkpoint sync, or the primary/replica resync) since they would not know what to do with these requests. Yet, we simulate that we received responses from these nodes. Today, this is done by simulating that they sent us that their local checkpoint is unassigned sequence number. However, for pre-6.0 nodes we have introduced a special local checkpoint used in the global checkpoint tracker for such nodes and that is what we should use here too. This commit fixes this issue. Relates #25744 --- .../action/resync/TransportResyncReplicationAction.java | 2 +- .../support/replication/TransportReplicationAction.java | 6 ++++++ .../index/seqno/GlobalCheckpointSyncAction.java | 2 +- .../elasticsearch/index/seqno/GlobalCheckpointTracker.java | 3 +++ .../index/seqno/GlobalCheckpointTrackerTests.java | 2 +- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/action/resync/TransportResyncReplicationAction.java b/core/src/main/java/org/elasticsearch/action/resync/TransportResyncReplicationAction.java index c723a175ad7..6b84522d23a 100644 --- a/core/src/main/java/org/elasticsearch/action/resync/TransportResyncReplicationAction.java +++ b/core/src/main/java/org/elasticsearch/action/resync/TransportResyncReplicationAction.java @@ -93,7 +93,7 @@ public class TransportResyncReplicationAction extends TransportWriteAction lcps.localCheckpoint) { logger.trace("updated local checkpoint of [{}] from [{}] to [{}]", allocationId, lcps.localCheckpoint, localCheckpoint); lcps.localCheckpoint = localCheckpoint; diff --git a/core/src/test/java/org/elasticsearch/index/seqno/GlobalCheckpointTrackerTests.java b/core/src/test/java/org/elasticsearch/index/seqno/GlobalCheckpointTrackerTests.java index f06ffc0d45f..2f7d2dd15ce 100644 --- a/core/src/test/java/org/elasticsearch/index/seqno/GlobalCheckpointTrackerTests.java +++ b/core/src/test/java/org/elasticsearch/index/seqno/GlobalCheckpointTrackerTests.java @@ -737,7 +737,7 @@ public class GlobalCheckpointTrackerTests extends ESTestCase { private static void randomLocalCheckpointUpdate(GlobalCheckpointTracker gcp) { String allocationId = randomFrom(gcp.localCheckpoints.keySet()); long currentLocalCheckpoint = gcp.localCheckpoints.get(allocationId).getLocalCheckpoint(); - gcp.updateLocalCheckpoint(allocationId, currentLocalCheckpoint + randomInt(5)); + gcp.updateLocalCheckpoint(allocationId, Math.max(SequenceNumbersService.NO_OPS_PERFORMED, currentLocalCheckpoint + randomInt(5))); } private static void randomMarkInSync(GlobalCheckpointTracker gcp) {