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 {
|
public enum SyncedFlushResult {
|
||||||
SUCCESS,
|
SUCCESS,
|
||||||
FAILED_COMMIT_MISMATCH,
|
COMMIT_MISMATCH,
|
||||||
FAILED_PENDING_OPERATIONS
|
PENDING_OPERATIONS
|
||||||
}
|
}
|
||||||
|
|
||||||
final protected GetResult getFromSearcher(Get get) throws EngineException {
|
final protected GetResult getFromSearcher(Get get) throws EngineException {
|
||||||
|
|
|
@ -670,21 +670,21 @@ public class InternalEngine extends Engine {
|
||||||
ensureOpen();
|
ensureOpen();
|
||||||
if (indexWriter.hasUncommittedChanges()) {
|
if (indexWriter.hasUncommittedChanges()) {
|
||||||
logger.trace("can't sync commit [{}]. have pending changes", syncId);
|
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) {
|
if (expectedCommitId.idsEqual(lastCommittedSegmentInfos.getId()) == false) {
|
||||||
logger.trace("can't sync commit [{}]. current commit id is not equal to expected.", syncId);
|
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()) {
|
try (ReleasableLock lock = writeLock.acquire()) {
|
||||||
ensureOpen();
|
ensureOpen();
|
||||||
if (indexWriter.hasUncommittedChanges()) {
|
if (indexWriter.hasUncommittedChanges()) {
|
||||||
logger.trace("can't sync commit [{}]. have pending changes", syncId);
|
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) {
|
if (expectedCommitId.idsEqual(lastCommittedSegmentInfos.getId()) == false) {
|
||||||
logger.trace("can't sync commit [{}]. current commit id is not equal to expected.", syncId);
|
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);
|
logger.trace("starting sync commit [{}]", syncId);
|
||||||
final long translogId = translog.currentId();
|
final long translogId = translog.currentId();
|
||||||
|
|
|
@ -347,9 +347,9 @@ public class SyncedFlushService extends AbstractComponent {
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case SUCCESS:
|
case SUCCESS:
|
||||||
return new SyncedFlushResponse();
|
return new SyncedFlushResponse();
|
||||||
case FAILED_COMMIT_MISMATCH:
|
case COMMIT_MISMATCH:
|
||||||
return new SyncedFlushResponse("commit has changed");
|
return new SyncedFlushResponse("commit has changed");
|
||||||
case FAILED_PENDING_OPERATIONS:
|
case PENDING_OPERATIONS:
|
||||||
return new SyncedFlushResponse("pending operations");
|
return new SyncedFlushResponse("pending operations");
|
||||||
default:
|
default:
|
||||||
throw new ElasticsearchException("unknown synced flush result [" + result + "]");
|
throw new ElasticsearchException("unknown synced flush result [" + result + "]");
|
||||||
|
|
|
@ -697,10 +697,10 @@ public class InternalEngineTests extends ElasticsearchTestCase {
|
||||||
wrongBytes[0] = (byte) ~wrongBytes[0];
|
wrongBytes[0] = (byte) ~wrongBytes[0];
|
||||||
Engine.CommitId wrongId = new Engine.CommitId(wrongBytes);
|
Engine.CommitId wrongId = new Engine.CommitId(wrongBytes);
|
||||||
assertThat("should fail to sync flush with wrong id (but no docs)", engine.syncFlush(syncId + "1", wrongId),
|
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));
|
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),
|
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();
|
commitID = engine.flush();
|
||||||
assertThat("should succeed to flush commit with right id and no pending doc", engine.syncFlush(syncId, commitID),
|
assertThat("should succeed to flush commit with right id and no pending doc", engine.syncFlush(syncId, commitID),
|
||||||
equalTo(Engine.SyncedFlushResult.SUCCESS));
|
equalTo(Engine.SyncedFlushResult.SUCCESS));
|
||||||
|
|
Loading…
Reference in New Issue