KKcorps commented on PR #20385:
URL: https://github.com/apache/pinot/pull/20385#issuecomment-7156750032
This note comes from a model of upsert thread orders that StarTree runs on
upsert PRs.
**This fixes a reset that corrupts partial upsert rows on metadataTTL tables
today, and the model found nothing new with the change.**
I replayed the model's 125 known bad orders with and without the change, and
only the reset case changed. Then a search ran for 65 minutes over 53 table
shapes, and none of its failures came from the change.
**What it fixes.** Today the NullPointerException leaves `removeSegment`
before it removes the keys, so they keep pointing at the consuming segment the
server just dropped. When the replica is reset and consumes the same offsets
again, each partial upsert row merges onto its own earlier merge. On a full
upsert table the key can vanish once the committed copy loads, because the copy
ties with the dropped segment and loses.
```mermaid
sequenceDiagram
participant H as Helix
participant C1 as Consuming segment
participant M as Upsert metadata
participant C2 as New consumer
C1->>M: addRecord(A, v=1), A points at C1
H->>C1: CONSUMING to OFFLINE
C1->>M: removeSegment, isOutOfMetadataTTL throws NPE
Note over M: A still points at C1, replica in ERROR
H->>C2: reset, OFFLINE to CONSUMING
C2->>M: addRecord(A, v=1) merges onto C1's row
Note over M: A serves v=2, the stream says v=1
```
<details><summary>Model history</summary>
```
('assign_consumer', "N0'")
('append', 'A', (0,), 0, {'v': 1}, False)
('acquire', "N0'")
('consume', "N0'", 0)
('offload', "N0'")
('step', 'offload', "N0'", 'stop')
('step', 'offload', "N0'", 'close_consumer')
('step', 'offload', "N0'", 'begin_remove')
('step', 'offload', "N0'", 'release_semaphore')
('step', 'offload', "N0'", 'untrack')
('assign_consumer', "N0'r1")
('acquire', "N0'r1")
('consume', "N0'r1", 0)
```
</details>
With the change, a reset on these tables reverts each key to its older row,
so it can now meet two older races, a segment delete or a retention drop of
that older segment at the same moment. Today's code fails on both of those
orders too.
The model covers one replica and the handoff slice of one partition, so a
clean search only means this search found nothing.
<!-- upsert-model-check head=7733fa4774d985d8af4132a7d86db0241f59a28e -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]