|
66 | 66 | import org.elasticsearch.common.util.BigArrays; |
67 | 67 | import org.elasticsearch.common.util.concurrent.AbstractRunnable; |
68 | 68 | import org.elasticsearch.common.util.concurrent.AsyncIOProcessor; |
69 | | -import org.elasticsearch.common.util.concurrent.ThreadContext; |
70 | 69 | import org.elasticsearch.common.xcontent.XContentFactory; |
71 | 70 | import org.elasticsearch.index.Index; |
72 | 71 | import org.elasticsearch.index.IndexModule; |
|
142 | 141 | import java.nio.channels.ClosedByInterruptException; |
143 | 142 | import java.nio.charset.StandardCharsets; |
144 | 143 | import java.util.ArrayList; |
145 | | -import java.util.Arrays; |
146 | 144 | import java.util.Collections; |
147 | 145 | import java.util.EnumSet; |
148 | 146 | import java.util.List; |
@@ -408,10 +406,12 @@ public void updateShardState(final ShardRouting newRouting, |
408 | 406 |
|
409 | 407 | if (newRouting.primary()) { |
410 | 408 | final DiscoveryNode recoverySourceNode = recoveryState.getSourceNode(); |
| 409 | + final Engine engine = getEngine(); |
411 | 410 | if (currentRouting.isRelocationTarget() == false || recoverySourceNode.getVersion().before(Version.V_6_0_0_alpha1)) { |
412 | 411 | // there was no primary context hand-off in < 6.0.0, need to manually activate the shard |
413 | | - final Engine engine = getEngine(); |
414 | 412 | engine.seqNoService().activatePrimaryMode(getEngine().seqNoService().getLocalCheckpoint()); |
| 413 | + } |
| 414 | + if (currentRouting.isRelocationTarget() == true && recoverySourceNode.getVersion().before(Version.V_6_0_0_alpha1)) { |
415 | 415 | // Flush the translog as it may contain operations with no sequence numbers. We want to make sure those |
416 | 416 | // operations will never be replayed as part of peer recovery to avoid an arbitrary mixture of operations with seq# |
417 | 417 | // (due to active indexing) and operations without a seq# coming from the translog. We therefore flush |
|
0 commit comments