From 1e67a8a8f2330062fa49e21a1f9aba8c3ba11200 Mon Sep 17 00:00:00 2001 From: Vladimir Dolzhenko Date: Fri, 4 May 2018 16:04:24 +0200 Subject: [PATCH] Allow to trim all ops above a certain seq# with a term lower than X - fixes on PR #4 Relates to #10708 --- .../elasticsearch/action/resync/ResyncReplicationRequest.java | 4 ++-- .../java/org/elasticsearch/index/translog/Checkpoint.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/action/resync/ResyncReplicationRequest.java b/server/src/main/java/org/elasticsearch/action/resync/ResyncReplicationRequest.java index d4e2c652fa875..7be3406659e62 100644 --- a/server/src/main/java/org/elasticsearch/action/resync/ResyncReplicationRequest.java +++ b/server/src/main/java/org/elasticsearch/action/resync/ResyncReplicationRequest.java @@ -68,7 +68,7 @@ public void readFrom(final StreamInput in) throws IOException { throw new IllegalStateException("resync replication request serialization is broken in 6.0.0"); } super.readFrom(in); - if (in.getVersion().onOrAfter(Version.V_6_4_0)) { + if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) { trimAboveSeqNo = in.readZLong(); } else { trimAboveSeqNo = SequenceNumbers.UNASSIGNED_SEQ_NO; @@ -79,7 +79,7 @@ public void readFrom(final StreamInput in) throws IOException { @Override public void writeTo(final StreamOutput out) throws IOException { super.writeTo(out); - if (out.getVersion().onOrAfter(Version.V_6_4_0)) { + if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) { out.writeZLong(trimAboveSeqNo); } out.writeArray(Translog.Operation::writeOperation, operations); diff --git a/server/src/main/java/org/elasticsearch/index/translog/Checkpoint.java b/server/src/main/java/org/elasticsearch/index/translog/Checkpoint.java index b20f4b578284d..d573f36754d5f 100644 --- a/server/src/main/java/org/elasticsearch/index/translog/Checkpoint.java +++ b/server/src/main/java/org/elasticsearch/index/translog/Checkpoint.java @@ -53,7 +53,7 @@ final class Checkpoint { private static final String CHECKPOINT_CODEC = "ckp"; - // size of 6.4.0 checkpoint + // size of 7.0.0 checkpoint static final int V3_FILE_SIZE = CodecUtil.headerLength(CHECKPOINT_CODEC) + Integer.BYTES // ops