Relates #30244
This commit is contained in:
Nhat Nguyen 2018-05-01 21:08:24 -04:00
parent d52ca33bd9
commit eb4281edef
2 changed files with 4 additions and 8 deletions

View File

@ -639,7 +639,7 @@ public abstract class EngineTestCase extends ESTestCase {
// intentional
assertThat(result.isCreated(), equalTo(firstOp));
assertThat(result.getVersion(), equalTo(op.version()));
assertThat(result.hasFailure(), equalTo(false));
assertThat(result.getResultType(), equalTo(Engine.Result.Type.SUCCESS));
} else {
Engine.DeleteResult result = replicaEngine.delete((Engine.Delete) op);
@ -650,7 +650,7 @@ public abstract class EngineTestCase extends ESTestCase {
// intentional
assertThat(result.isFound(), equalTo(firstOp == false));
assertThat(result.getVersion(), equalTo(op.version()));
assertThat(result.hasFailure(), equalTo(false));
assertThat(result.getResultType(), equalTo(Engine.Result.Type.SUCCESS));
}
if (randomBoolean()) {
replicaEngine.refresh("test");

View File

@ -13,7 +13,6 @@ import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.engine.Engine;
import org.elasticsearch.index.mapper.MapperException;
import org.elasticsearch.index.shard.IndexShard;
import org.elasticsearch.index.translog.Translog;
import org.elasticsearch.indices.IndicesService;
@ -68,12 +67,9 @@ public class TransportBulkShardOperationsAction
final BulkShardOperationsRequest request, final IndexShard shard, final Engine.Operation.Origin origin) throws IOException {
Translog.Location location = null;
for (final Translog.Operation operation : request.getOperations()) {
final Engine.Result result = shard.applyTranslogOperation(operation, origin, m -> {
// TODO: Figure out how to deal best with dynamic mapping updates from the leader side:
throw new MapperException("dynamic mapping updates are not allowed in follow shards [" + operation + "]");
});
final Engine.Result result = shard.applyTranslogOperation(operation, origin);
assert result.getSeqNo() == operation.seqNo();
assert result.hasFailure() == false;
assert result.getResultType() == Engine.Result.Type.SUCCESS;
location = locationToSync(location, result.getTranslogLocation());
}
assert request.getOperations().length == 0 || location != null;