You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Newer-version replica admission keeps the stub version, so a later in-order commutative patch folds twice into the stub's indexed fields #3640
When a non-owner replica holder has an INVALIDATED stub at version T1 and admits a resident GET_RECORD answer at version T2 > T1 before the T2 replication entry arrives on the stream, storeReplicaRow (resources/Table.ts:11548-11578) stores the resident's T2 record body in the REPLICA row while keeping current.version (T1), current.additionalAuditRefs, and current.receivedIdentityRefs, with indexedRecord: current.value (#3610) so the stub's secondary-index keys stay at T1.
If the T2 write was a commutative patch (saveBeforeAfter: true, such as an add(1) counter increment) on an @indexed attribute, the resident's T2 body already reflects that increment. When the T2 audit entry subsequently arrives on the replication stream in order (entry.version === T2 > current.version === T1):
replicatePatch takes the in-order branch (resources/Table.ts:6248) and reads the REPLICA row via getRecordEntryToUpdate, whose .value is the resident's T2 body (already incremented once).
combineRecords applies the patch delta a second time against that body (count + 2).
putReplicationEntry sees existingEntry.residencyId !== 0 && !this.isResident(residencyList) (resources/Table.ts:6092-6097), demotes the REPLICA row back to an INVALIDATED stub at version T2, and projects the indexed fields from content — writing the double-incremented value into the stub's value and the local secondary index.
Applying the in-order patch against the stub's T1 indexed snapshot (or recording the admitted resident body's version/identity so the in-order delivery of T2 does not re-apply a delta the body already carries) would keep the stub's indexed fields consistent with the resident.
Activity