Skip to content

Commit f2fcecb

Browse files
committed
Track maxSeqNoOfNonAppendOnlyOperations
Models the fix implemented in elastic/elasticsearch#28787
1 parent 0e31664 commit f2fcecb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ReplicaEngine/tla/ReplicaEngine.tla

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ end process
176176
process ConsumerProcess = "Consumer"
177177
variables
178178
maxUnsafeAutoIdTimestamp \in {0, DocAutoIdTimestamp - 1, DocAutoIdTimestamp, DocAutoIdTimestamp + 1},
179+
maxSeqNoOfNonAppendOnlyOperations \in {0, 2, request_count + 1},
179180
req, plan,
180181
deleteFromLucene, currentlyDeleted,
181182
currentNotFoundOrDeleted, useLuceneUpdateDocument, indexIntoLucene,
@@ -194,6 +195,8 @@ begin
194195

195196
(* planDeletionAsNonPrimary *)
196197

198+
maxSeqNoOfNonAppendOnlyOperations := Max(maxSeqNoOfNonAppendOnlyOperations, req.seqno);
199+
197200
if req.seqno <= localCheckPoint
198201
then
199202
(* OP_STALE_OR_EQUAL *)
@@ -282,12 +285,17 @@ begin
282285

283286
if /\ req.type = ADD
284287
/\ maxUnsafeAutoIdTimestamp < req.autoIdTimeStamp
288+
/\ maxSeqNoOfNonAppendOnlyOperations < req.seqno \* PR #28787
285289
then
286290
plan := "optimisedAppendOnly";
287291
currentNotFoundOrDeleted := TRUE;
288292
useLuceneUpdateDocument := FALSE;
289293
indexIntoLucene := TRUE;
290294
else
295+
if FALSE = (req.type \in {ADD, RETRY_ADD})
296+
then
297+
maxSeqNoOfNonAppendOnlyOperations := Max(maxSeqNoOfNonAppendOnlyOperations, req.seqno);
298+
end if;
291299

292300
(* All other operations are planned normally *)
293301
versionMap_needsSafeAccess := TRUE;

0 commit comments

Comments
 (0)