remove FAILED suffix
This commit is contained in:
parent
fcea10113c
commit
a0315b5cb8
|
@ -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 {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 + "]");
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue