summaryrefslogtreecommitdiff
path: root/core/src/main/java/org/elasticsearch
diff options
context:
space:
mode:
authorBoaz Leskes <b.leskes@gmail.com>2017-05-22 16:59:03 +0200
committerBoaz Leskes <b.leskes@gmail.com>2017-05-23 09:08:30 +0200
commita5fffa2988252ca0f5ad8befc98545ba5a74d9f7 (patch)
tree959d3929bb1d19851a38404ddcfd13736d3a528e /core/src/main/java/org/elasticsearch
parentd3c95b8d9d81fb3ee9727de59bd37665c72ddf88 (diff)
relax the assertion about the existence of MAX_UNSAFE_AUTO_ID_TIMESTAMP_COMMIT_ID in the user commit data
Since #24149 we started storing the maxUnsafeAutoIdTimestamp in the lucene commit. The assertions in that PR were built on the assumption that recovering a primary always ends up committing lucene. That is sadly [not true](https://github.com/elastic/elasticsearch/blob/a72eaa8e0f5c0f305c507c5fcd918fed7c1bf6bf/core/src/main/java/org/elasticsearch/index/engine/InternalEngine.java#L313). Closes #24809
Diffstat (limited to 'core/src/main/java/org/elasticsearch')
-rw-r--r--core/src/main/java/org/elasticsearch/index/shard/IndexShard.java8
1 files changed, 3 insertions, 5 deletions
diff --git a/core/src/main/java/org/elasticsearch/index/shard/IndexShard.java b/core/src/main/java/org/elasticsearch/index/shard/IndexShard.java
index 6e5af2b272..f294252456 100644
--- a/core/src/main/java/org/elasticsearch/index/shard/IndexShard.java
+++ b/core/src/main/java/org/elasticsearch/index/shard/IndexShard.java
@@ -1090,14 +1090,12 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
private boolean assertMaxUnsafeAutoIdInCommit() throws IOException {
final Map<String, String> userData = SegmentInfos.readLatestCommit(store.directory()).getUserData();
- if (recoveryState().getRecoverySource().getType() == RecoverySource.Type.PEER) {
+ if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_5_5_0_UNRELEASED) &&
+ // TODO: LOCAL_SHARDS need to transfer this information
+ recoveryState().getRecoverySource().getType() != RecoverySource.Type.LOCAL_SHARDS) {
// as of 5.5.0, the engine stores the maxUnsafeAutoIdTimestamp in the commit point.
// This should have baked into the commit by the primary we recover from, regardless of the index age.
assert userData.containsKey(InternalEngine.MAX_UNSAFE_AUTO_ID_TIMESTAMP_COMMIT_ID) :
- "recovery from remote but " + InternalEngine.MAX_UNSAFE_AUTO_ID_TIMESTAMP_COMMIT_ID + " is not found in commit";
- } else if (recoveryState().getRecoverySource().getType() == RecoverySource.Type.EXISTING_STORE &&
- indexSettings.getIndexVersionCreated().onOrAfter(Version.V_5_5_0_UNRELEASED)) {
- assert userData.containsKey(InternalEngine.MAX_UNSAFE_AUTO_ID_TIMESTAMP_COMMIT_ID) :
"opening index which was created post 5.5.0 but " + InternalEngine.MAX_UNSAFE_AUTO_ID_TIMESTAMP_COMMIT_ID
+ " is not found in commit";
}