remove impl details from method name

This commit is contained in:
Britta Weber 2015-05-17 14:46:28 +02:00
parent 5ac07481eb
commit fcea10113c
6 changed files with 9 additions and 9 deletions

View File

@ -231,7 +231,7 @@ public abstract class Engine implements Closeable {
* @param expectedCommitId the expected value of
* @return true if the sync commit was made, false o.w.
*/
public abstract SyncedFlushResult syncFlushIfNoPendingChanges(String syncId, CommitId expectedCommitId) throws EngineException;
public abstract SyncedFlushResult syncFlush(String syncId, CommitId expectedCommitId) throws EngineException;
public enum SyncedFlushResult {
SUCCESS,

View File

@ -665,7 +665,7 @@ public class InternalEngine extends Engine {
}
@Override
public SyncedFlushResult syncFlushIfNoPendingChanges(String syncId, CommitId expectedCommitId) throws EngineException {
public SyncedFlushResult syncFlush(String syncId, CommitId expectedCommitId) throws EngineException {
// best effort attempt before we acquire locks
ensureOpen();
if (indexWriter.hasUncommittedChanges()) {

View File

@ -125,7 +125,7 @@ public class ShadowEngine extends Engine {
}
@Override
public SyncedFlushResult syncFlushIfNoPendingChanges(String syncId, CommitId expectedCommitId) {
public SyncedFlushResult syncFlush(String syncId, CommitId expectedCommitId) {
throw new UnsupportedOperationException(shardId + " sync commit operation not allowed on shadow engine");
}

View File

@ -691,10 +691,10 @@ public class IndexShard extends AbstractIndexShardComponent {
return completionStats;
}
public Engine.SyncedFlushResult syncFlushIfNoPendingChanges(String syncId, Engine.CommitId expectedCommitId) {
public Engine.SyncedFlushResult syncFlush(String syncId, Engine.CommitId expectedCommitId) {
verifyStartedOrRecovering();
logger.trace("trying to sync flush. sync id [{}]. expected commit id [{}]]", syncId, expectedCommitId);
return engine().syncFlushIfNoPendingChanges(syncId, expectedCommitId);
return engine().syncFlush(syncId, expectedCommitId);
}
public Engine.CommitId flush(FlushRequest request) throws ElasticsearchException {

View File

@ -342,7 +342,7 @@ public class SyncedFlushService extends AbstractComponent {
IndexService indexService = indicesService.indexServiceSafe(request.shardId().getIndex());
IndexShard indexShard = indexService.shardSafe(request.shardId().id());
logger.trace("{} performing sync flush. sync id [{}], expected commit id {}", request.shardId(), request.syncId(), request.expectedCommitId());
Engine.SyncedFlushResult result = indexShard.syncFlushIfNoPendingChanges(request.syncId(), request.expectedCommitId());
Engine.SyncedFlushResult result = indexShard.syncFlush(request.syncId(), request.expectedCommitId());
logger.trace("{} sync flush done. sync id [{}], result [{}]", request.shardId(), request.syncId(), result);
switch (result) {
case SUCCESS:

View File

@ -696,13 +696,13 @@ public class InternalEngineTests extends ElasticsearchTestCase {
byte[] wrongBytes = Base64.decode(commitID.toString());
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.syncFlushIfNoPendingChanges(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));
engine.create(new Engine.Create(null, newUid("2"), doc));
assertThat("should fail to sync flush with right id but pending doc", engine.syncFlushIfNoPendingChanges(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));
commitID = engine.flush();
assertThat("should succeed to flush commit with right id and no pending doc", engine.syncFlushIfNoPendingChanges(syncId, commitID),
assertThat("should succeed to flush commit with right id and no pending doc", engine.syncFlush(syncId, commitID),
equalTo(Engine.SyncedFlushResult.SUCCESS));
assertThat(store.readLastCommittedSegmentsInfo().getUserData().get(Engine.SYNC_COMMIT_ID), equalTo(syncId));
assertThat(engine.getLastCommittedSegmentInfos().getUserData().get(Engine.SYNC_COMMIT_ID), equalTo(syncId));