-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Replicate write failures #23314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replicate write failures #23314
Changes from all commits
56b0517
e8e999d
02b7eda
5e829bb
3b67b88
c6384c8
65c1a2a
d464285
d096474
8d4d646
4180727
90e2419
4878565
2f33df8
7f6b97a
8905c94
8f325df
d153fdc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -569,28 +569,34 @@ private Engine.IndexResult index(Engine engine, Engine.Index index) throws IOExc | |
| return result; | ||
| } | ||
|
|
||
| public Engine.NoOp prepareMarkingSeqNoAsNoOp(long seqNo, String reason) { | ||
| verifyReplicationTarget(); | ||
| long startTime = System.nanoTime(); | ||
| return new Engine.NoOp(seqNo, primaryTerm, Engine.Operation.Origin.REPLICA, startTime, reason); | ||
| } | ||
|
|
||
| public Engine.NoOpResult markSeqNoAsNoOp(Engine.NoOp noOp) throws IOException { | ||
|
||
| ensureWriteAllowed(noOp); | ||
| Engine engine = getEngine(); | ||
| return engine.noOp(noOp); | ||
| } | ||
|
|
||
| public Engine.Delete prepareDeleteOnPrimary(String type, String id, long version, VersionType versionType) { | ||
| verifyPrimary(); | ||
| final DocumentMapper documentMapper = docMapper(type).getDocumentMapper(); | ||
| final MappedFieldType uidFieldType = documentMapper.uidMapper().fieldType(); | ||
| final Query uidQuery = uidFieldType.termQuery(Uid.createUid(type, id), null); | ||
| final Term uid = MappedFieldType.extractTerm(uidQuery); | ||
| final Term uid = extractUid(type, id); | ||
| return prepareDelete(type, id, uid, SequenceNumbersService.UNASSIGNED_SEQ_NO, primaryTerm, version, | ||
| versionType, Engine.Operation.Origin.PRIMARY); | ||
| } | ||
|
|
||
| public Engine.Delete prepareDeleteOnReplica(String type, String id, long seqNo, long primaryTerm, | ||
| long version, VersionType versionType) { | ||
| verifyReplicationTarget(); | ||
| final DocumentMapper documentMapper = docMapper(type).getDocumentMapper(); | ||
| final MappedFieldType uidFieldType = documentMapper.uidMapper().fieldType(); | ||
| final Query uidQuery = uidFieldType.termQuery(Uid.createUid(type, id), null); | ||
| final Term uid = MappedFieldType.extractTerm(uidQuery); | ||
| final Term uid = extractUid(type, id); | ||
| return prepareDelete(type, id, uid, seqNo, primaryTerm, version, versionType, Engine.Operation.Origin.REPLICA); | ||
| } | ||
|
|
||
| static Engine.Delete prepareDelete(String type, String id, Term uid, long seqNo, long primaryTerm, long version, | ||
| VersionType versionType, Engine.Operation.Origin origin) { | ||
| private static Engine.Delete prepareDelete(String type, String id, Term uid, long seqNo, long primaryTerm, long version, | ||
| VersionType versionType, Engine.Operation.Origin origin) { | ||
| long startTime = System.nanoTime(); | ||
| return new Engine.Delete(type, id, uid, seqNo, primaryTerm, version, versionType, origin, startTime); | ||
| } | ||
|
|
@@ -601,6 +607,13 @@ public Engine.DeleteResult delete(Engine.Delete delete) throws IOException { | |
| return delete(engine, delete); | ||
| } | ||
|
|
||
| private Term extractUid(String type, String id) { | ||
| final DocumentMapper documentMapper = docMapper(type).getDocumentMapper(); | ||
| final MappedFieldType uidFieldType = documentMapper.uidMapper().fieldType(); | ||
| final Query uidQuery = uidFieldType.termQuery(Uid.createUid(type, id), null); | ||
| return MappedFieldType.extractTerm(uidQuery); | ||
| } | ||
|
|
||
| private Engine.DeleteResult delete(Engine engine, Engine.Delete delete) throws IOException { | ||
| active.set(true); | ||
| final Engine.DeleteResult result; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To follow the standard that we have use here, I think this should be named
prepareNoOpOnReplica(...)(since we haveprepareDeleteOnReplicaandprepareIndexOnReplica)