|
|
@@ -686,12 +686,12 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
|
|
|
}
|
|
|
|
|
|
public Engine.IndexResult applyIndexOperationOnPrimary(long version, VersionType versionType, SourceToParse sourceToParse,
|
|
|
- long ifSeqNoMatch, long ifPrimaryTermMatch, long autoGeneratedTimestamp,
|
|
|
+ long ifSeqNo, long ifPrimaryTerm, long autoGeneratedTimestamp,
|
|
|
boolean isRetry)
|
|
|
throws IOException {
|
|
|
assert versionType.validateVersionForWrites(version);
|
|
|
- return applyIndexOperation(getEngine(), UNASSIGNED_SEQ_NO, operationPrimaryTerm, version, versionType, ifSeqNoMatch,
|
|
|
- ifPrimaryTermMatch, autoGeneratedTimestamp, isRetry, Engine.Operation.Origin.PRIMARY, sourceToParse);
|
|
|
+ return applyIndexOperation(getEngine(), UNASSIGNED_SEQ_NO, operationPrimaryTerm, version, versionType, ifSeqNo,
|
|
|
+ ifPrimaryTerm, autoGeneratedTimestamp, isRetry, Engine.Operation.Origin.PRIMARY, sourceToParse);
|
|
|
}
|
|
|
|
|
|
public Engine.IndexResult applyIndexOperationOnReplica(long seqNo, long version, long autoGeneratedTimeStamp,
|
|
|
@@ -702,7 +702,7 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
|
|
|
}
|
|
|
|
|
|
private Engine.IndexResult applyIndexOperation(Engine engine, long seqNo, long opPrimaryTerm, long version,
|
|
|
- @Nullable VersionType versionType, long ifSeqNoMatch, long ifPrimaryTermMatch,
|
|
|
+ @Nullable VersionType versionType, long ifSeqNo, long ifPrimaryTerm,
|
|
|
long autoGeneratedTimeStamp, boolean isRetry, Engine.Operation.Origin origin,
|
|
|
SourceToParse sourceToParse) throws IOException {
|
|
|
assert opPrimaryTerm <= this.operationPrimaryTerm: "op term [ " + opPrimaryTerm + " ] > shard term [" + this.operationPrimaryTerm
|
|
|
@@ -712,7 +712,7 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
|
|
|
try {
|
|
|
operation = prepareIndex(docMapper(sourceToParse.type()), indexSettings.getIndexVersionCreated(), sourceToParse, seqNo,
|
|
|
opPrimaryTerm, version, versionType, origin, autoGeneratedTimeStamp, isRetry,
|
|
|
- ifSeqNoMatch, ifPrimaryTermMatch);
|
|
|
+ ifSeqNo, ifPrimaryTerm);
|
|
|
Mapping update = operation.parsedDoc().dynamicMappingsUpdate();
|
|
|
if (update != null) {
|
|
|
return new Engine.IndexResult(update);
|
|
|
@@ -732,7 +732,7 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
|
|
|
public static Engine.Index prepareIndex(DocumentMapperForType docMapper, Version indexCreatedVersion, SourceToParse source, long seqNo,
|
|
|
long primaryTerm, long version, VersionType versionType, Engine.Operation.Origin origin,
|
|
|
long autoGeneratedIdTimestamp, boolean isRetry,
|
|
|
- long ifSeqNoMatch, long ifPrimaryTermMatch) {
|
|
|
+ long ifSeqNo, long ifPrimaryTerm) {
|
|
|
long startTime = System.nanoTime();
|
|
|
ParsedDocument doc = docMapper.getDocumentMapper().parse(source);
|
|
|
if (docMapper.getMapping() != null) {
|
|
|
@@ -740,7 +740,7 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
|
|
|
}
|
|
|
Term uid = new Term(IdFieldMapper.NAME, Uid.encodeId(doc.id()));
|
|
|
return new Engine.Index(uid, doc, seqNo, primaryTerm, version, versionType, origin, startTime, autoGeneratedIdTimestamp, isRetry,
|
|
|
- ifSeqNoMatch, ifPrimaryTermMatch);
|
|
|
+ ifSeqNo, ifPrimaryTerm);
|
|
|
}
|
|
|
|
|
|
private Engine.IndexResult index(Engine engine, Engine.Index index) throws IOException {
|
|
|
@@ -792,11 +792,11 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
|
|
|
}
|
|
|
|
|
|
public Engine.DeleteResult applyDeleteOperationOnPrimary(long version, String type, String id, VersionType versionType,
|
|
|
- long ifSeqNoMatch, long ifPrimaryTermMatch)
|
|
|
+ long ifSeqNo, long ifPrimaryTerm)
|
|
|
throws IOException {
|
|
|
assert versionType.validateVersionForWrites(version);
|
|
|
return applyDeleteOperation(getEngine(), UNASSIGNED_SEQ_NO, operationPrimaryTerm, version, type, id, versionType,
|
|
|
- ifSeqNoMatch, ifPrimaryTermMatch, Engine.Operation.Origin.PRIMARY);
|
|
|
+ ifSeqNo, ifPrimaryTerm, Engine.Operation.Origin.PRIMARY);
|
|
|
}
|
|
|
|
|
|
public Engine.DeleteResult applyDeleteOperationOnReplica(long seqNo, long version, String type, String id) throws IOException {
|
|
|
@@ -805,7 +805,7 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
|
|
|
}
|
|
|
|
|
|
private Engine.DeleteResult applyDeleteOperation(Engine engine, long seqNo, long opPrimaryTerm, long version, String type, String id,
|
|
|
- @Nullable VersionType versionType, long ifSeqNoMatch, long ifPrimaryTermMatch,
|
|
|
+ @Nullable VersionType versionType, long ifSeqNo, long ifPrimaryTerm,
|
|
|
Engine.Operation.Origin origin) throws IOException {
|
|
|
assert opPrimaryTerm <= this.operationPrimaryTerm : "op term [ " + opPrimaryTerm + " ] > shard term [" + this.operationPrimaryTerm
|
|
|
+ "]";
|
|
|
@@ -835,16 +835,16 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
|
|
|
}
|
|
|
final Term uid = new Term(IdFieldMapper.NAME, Uid.encodeId(id));
|
|
|
final Engine.Delete delete = prepareDelete(type, id, uid, seqNo, opPrimaryTerm, version,
|
|
|
- versionType, origin, ifSeqNoMatch, ifPrimaryTermMatch);
|
|
|
+ versionType, origin, ifSeqNo, ifPrimaryTerm);
|
|
|
return delete(engine, delete);
|
|
|
}
|
|
|
|
|
|
private Engine.Delete prepareDelete(String type, String id, Term uid, long seqNo, long primaryTerm, long version,
|
|
|
VersionType versionType, Engine.Operation.Origin origin,
|
|
|
- long ifSeqNoMatch, long ifPrimaryTermMatch) {
|
|
|
+ long ifSeqNo, long ifPrimaryTerm) {
|
|
|
long startTime = System.nanoTime();
|
|
|
return new Engine.Delete(resolveType(type), id, uid, seqNo, primaryTerm, version, versionType, origin, startTime,
|
|
|
- ifSeqNoMatch, ifPrimaryTermMatch);
|
|
|
+ ifSeqNo, ifPrimaryTerm);
|
|
|
}
|
|
|
|
|
|
private Engine.DeleteResult delete(Engine engine, Engine.Delete delete) throws IOException {
|