From 12d94e44b8306f315f9e936bc46be55fd867122b Mon Sep 17 00:00:00 2001 From: Nhat Nguyen Date: Wed, 26 Sep 2018 18:39:10 -0400 Subject: [PATCH] Adjust bwc version for max_seq_no_of_updates Relates #33967 Relates #33842 --- .../support/replication/TransportReplicationAction.java | 4 ++-- .../java/org/elasticsearch/index/engine/InternalEngine.java | 2 +- .../main/java/org/elasticsearch/index/shard/IndexShard.java | 4 ++-- .../indices/recovery/RecoveryTranslogOperationsRequest.java | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/action/support/replication/TransportReplicationAction.java b/server/src/main/java/org/elasticsearch/action/support/replication/TransportReplicationAction.java index dff635f6e74..695c9162633 100644 --- a/server/src/main/java/org/elasticsearch/action/support/replication/TransportReplicationAction.java +++ b/server/src/main/java/org/elasticsearch/action/support/replication/TransportReplicationAction.java @@ -1295,7 +1295,7 @@ public abstract class TransportReplicationAction< } else { globalCheckpoint = SequenceNumbers.UNASSIGNED_SEQ_NO; } - if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) { + if (in.getVersion().onOrAfter(Version.V_6_5_0)) { maxSeqNoOfUpdatesOrDeletes = in.readZLong(); } else { // UNASSIGNED_SEQ_NO (-2) means uninitialized, and replicas will disable @@ -1310,7 +1310,7 @@ public abstract class TransportReplicationAction< if (out.getVersion().onOrAfter(Version.V_6_0_0_alpha1)) { out.writeZLong(globalCheckpoint); } - if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) { + if (out.getVersion().onOrAfter(Version.V_6_5_0)) { out.writeZLong(maxSeqNoOfUpdatesOrDeletes); } } diff --git a/server/src/main/java/org/elasticsearch/index/engine/InternalEngine.java b/server/src/main/java/org/elasticsearch/index/engine/InternalEngine.java index 5bd1a473fb9..5f770e0d93b 100644 --- a/server/src/main/java/org/elasticsearch/index/engine/InternalEngine.java +++ b/server/src/main/java/org/elasticsearch/index/engine/InternalEngine.java @@ -2561,7 +2561,7 @@ public class InternalEngine extends Engine { final long maxSeqNoOfUpdates = getMaxSeqNoOfUpdatesOrDeletes(); // If the primary is on an old version which does not replicate msu, we need to relax this assertion for that. if (maxSeqNoOfUpdates == SequenceNumbers.UNASSIGNED_SEQ_NO) { - assert config().getIndexSettings().getIndexVersionCreated().before(Version.V_7_0_0_alpha1); + assert config().getIndexSettings().getIndexVersionCreated().before(Version.V_6_5_0); return true; } // We treat a delete on the tombstones on replicas as a regular document, then use updateDocument (not addDocument). diff --git a/server/src/main/java/org/elasticsearch/index/shard/IndexShard.java b/server/src/main/java/org/elasticsearch/index/shard/IndexShard.java index 28ff3c93096..11d8f44bef1 100644 --- a/server/src/main/java/org/elasticsearch/index/shard/IndexShard.java +++ b/server/src/main/java/org/elasticsearch/index/shard/IndexShard.java @@ -504,7 +504,7 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl if (getMaxSeqNoOfUpdatesOrDeletes() == SequenceNumbers.UNASSIGNED_SEQ_NO) { // If the old primary was on an old version that did not replicate the msu, // we need to bootstrap it manually from its local history. - assert indexSettings.getIndexVersionCreated().before(Version.V_7_0_0_alpha1); + assert indexSettings.getIndexVersionCreated().before(Version.V_6_5_0); engine.advanceMaxSeqNoOfUpdatesOrDeletes(seqNoStats().getMaxSeqNo()); } engine.restoreLocalHistoryFromTranslog((resettingEngine, snapshot) -> @@ -1957,7 +1957,7 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl if (getMaxSeqNoOfUpdatesOrDeletes() == SequenceNumbers.UNASSIGNED_SEQ_NO) { // If the old primary was on an old version that did not replicate the msu, // we need to bootstrap it manually from its local history. - assert indexSettings.getIndexVersionCreated().before(Version.V_7_0_0_alpha1); + assert indexSettings.getIndexVersionCreated().before(Version.V_6_5_0); getEngine().advanceMaxSeqNoOfUpdatesOrDeletes(seqNoStats().getMaxSeqNo()); } } diff --git a/server/src/main/java/org/elasticsearch/indices/recovery/RecoveryTranslogOperationsRequest.java b/server/src/main/java/org/elasticsearch/indices/recovery/RecoveryTranslogOperationsRequest.java index 58b5fb927b5..0ae5d507eb3 100644 --- a/server/src/main/java/org/elasticsearch/indices/recovery/RecoveryTranslogOperationsRequest.java +++ b/server/src/main/java/org/elasticsearch/indices/recovery/RecoveryTranslogOperationsRequest.java @@ -89,7 +89,7 @@ public class RecoveryTranslogOperationsRequest extends TransportRequest { } else { maxSeenAutoIdTimestampOnPrimary = IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP; } - if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) { + if (in.getVersion().onOrAfter(Version.V_6_5_0)) { maxSeqNoOfUpdatesOrDeletesOnPrimary = in.readZLong(); } else { // UNASSIGNED_SEQ_NO means uninitialized and replica won't enable optimization using seq_no @@ -107,7 +107,7 @@ public class RecoveryTranslogOperationsRequest extends TransportRequest { if (out.getVersion().onOrAfter(Version.V_6_5_0)) { out.writeZLong(maxSeenAutoIdTimestampOnPrimary); } - if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) { + if (out.getVersion().onOrAfter(Version.V_6_5_0)) { out.writeZLong(maxSeqNoOfUpdatesOrDeletesOnPrimary); } }