diff --git a/src/main/java/org/elasticsearch/index/engine/Engine.java b/src/main/java/org/elasticsearch/index/engine/Engine.java index 29dfac0bd64..1fa12398f21 100644 --- a/src/main/java/org/elasticsearch/index/engine/Engine.java +++ b/src/main/java/org/elasticsearch/index/engine/Engine.java @@ -235,8 +235,8 @@ public abstract class Engine implements Closeable { public enum SyncedFlushResult { SUCCESS, - FAILED_COMMIT_MISMATCH, - FAILED_PENDING_OPERATIONS + COMMIT_MISMATCH, + PENDING_OPERATIONS } final protected GetResult getFromSearcher(Get get) throws EngineException { diff --git a/src/main/java/org/elasticsearch/index/engine/InternalEngine.java b/src/main/java/org/elasticsearch/index/engine/InternalEngine.java index b19ca927f5f..1792051b152 100644 --- a/src/main/java/org/elasticsearch/index/engine/InternalEngine.java +++ b/src/main/java/org/elasticsearch/index/engine/InternalEngine.java @@ -670,21 +670,21 @@ public class InternalEngine extends Engine { ensureOpen(); if (indexWriter.hasUncommittedChanges()) { logger.trace("can't sync commit [{}]. have pending changes", syncId); - return SyncedFlushResult.FAILED_PENDING_OPERATIONS; + return SyncedFlushResult.PENDING_OPERATIONS; } if (expectedCommitId.idsEqual(lastCommittedSegmentInfos.getId()) == false) { logger.trace("can't sync commit [{}]. current commit id is not equal to expected.", syncId); - return SyncedFlushResult.FAILED_COMMIT_MISMATCH; + return SyncedFlushResult.COMMIT_MISMATCH; } try (ReleasableLock lock = writeLock.acquire()) { ensureOpen(); if (indexWriter.hasUncommittedChanges()) { logger.trace("can't sync commit [{}]. have pending changes", syncId); - return SyncedFlushResult.FAILED_PENDING_OPERATIONS; + return SyncedFlushResult.PENDING_OPERATIONS; } if (expectedCommitId.idsEqual(lastCommittedSegmentInfos.getId()) == false) { logger.trace("can't sync commit [{}]. current commit id is not equal to expected.", syncId); - return SyncedFlushResult.FAILED_COMMIT_MISMATCH; + return SyncedFlushResult.COMMIT_MISMATCH; } logger.trace("starting sync commit [{}]", syncId); final long translogId = translog.currentId(); diff --git a/src/main/java/org/elasticsearch/indices/SyncedFlushService.java b/src/main/java/org/elasticsearch/indices/SyncedFlushService.java index 45a20745c09..5a5d4a42ebb 100644 --- a/src/main/java/org/elasticsearch/indices/SyncedFlushService.java +++ b/src/main/java/org/elasticsearch/indices/SyncedFlushService.java @@ -347,9 +347,9 @@ public class SyncedFlushService extends AbstractComponent { switch (result) { case SUCCESS: return new SyncedFlushResponse(); - case FAILED_COMMIT_MISMATCH: + case COMMIT_MISMATCH: return new SyncedFlushResponse("commit has changed"); - case FAILED_PENDING_OPERATIONS: + case PENDING_OPERATIONS: return new SyncedFlushResponse("pending operations"); default: throw new ElasticsearchException("unknown synced flush result [" + result + "]"); diff --git a/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java b/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java index f87b59b42ee..9c7695847a5 100644 --- a/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java +++ b/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java @@ -697,10 +697,10 @@ public class InternalEngineTests extends ElasticsearchTestCase { wrongBytes[0] = (byte) ~wrongBytes[0]; Engine.CommitId wrongId = new Engine.CommitId(wrongBytes); assertThat("should fail to sync flush with wrong id (but no docs)", engine.syncFlush(syncId + "1", wrongId), - equalTo(Engine.SyncedFlushResult.FAILED_COMMIT_MISMATCH)); + equalTo(Engine.SyncedFlushResult.COMMIT_MISMATCH)); engine.create(new Engine.Create(null, newUid("2"), doc)); assertThat("should fail to sync flush with right id but pending doc", engine.syncFlush(syncId + "2", commitID), - equalTo(Engine.SyncedFlushResult.FAILED_PENDING_OPERATIONS)); + equalTo(Engine.SyncedFlushResult.PENDING_OPERATIONS)); commitID = engine.flush(); assertThat("should succeed to flush commit with right id and no pending doc", engine.syncFlush(syncId, commitID), equalTo(Engine.SyncedFlushResult.SUCCESS));