KKcorps opened a new pull request, #20161:
URL: https://github.com/apache/pinot/pull/20161
## Summary
A legacy snapshot pass can save the live TTL watermark while leaving an
older segment's bitmap stale. On restart, ConcurrentMap can classify that
segment as expired and restore its bitmap without reconciling newer ownership.
This returns duplicate rows even though the current writer caps newly persisted
watermarks.
Treat missing or unversioned watermarks as untrusted and reconstruct
ownership before enabling the TTL skip. Keep expired rows visible while holding
key cleanup until every assigned ONLINE segment has loaded. This bootstrap
guard also applies to trusted capped snapshots, because a newer segment can
advance the live watermark before historical replay finishes.
```mermaid
flowchart TD
A[Load watermark] --> B{Version trusted}
B -->|No| C[Reconcile snapshot ownership without TTL skips]
C --> D[Wait for assigned ONLINE segments]
D --> E[Take capped snapshot]
E --> F[Atomically publish number and version]
F --> G[Enable legacy TTL skip and cleanup]
B -->|Yes| H[Use existing capped TTL skip]
H --> I[Hold cleanup until assigned ONLINE segments load]
```
## Compatibility and cost
The version is appended to the existing double in the same watermark file.
Older readers still read the number, and an older writer truncates the suffix
when it rewrites the file. Restart after interrupted publication retries
recovery. Offload removes keys retained during recovery before their segment is
destroyed.
This changes ConcurrentMap metadata-TTL recovery. It adds no configuration
or metrics. Recovery can retain substantially more historical keys, and an
unloaded or ERROR segment holds cleanup across the table until initial loading
completes. Heap cost has not been benchmarked. RocksDB reuse, broker SQL and
full distribution upgrade certification are outside this validation.
## Validation
- `UpsertSnapshotRestartTest`: 42 cases passed through ordinary TestNG
providers. Covers stale, missing and fresh legacy snapshots, capped snapshots,
both load orders, preload on/off, interrupted migration, missing watermark,
failed publication, downgrade, offload, another restart and the Helix readiness
gate.
- `ConcurrentMapPartitionUpsertMetadataManagerTest`: 40 cases passed.
- Scoped Spotless, Checkstyle and license checks passed.
```sh
./mvnw -o -pl pinot-segment-local -am -Dtest=UpsertSnapshotRestartTest
-Dsurefire.failIfNoSpecifiedTests=false -Ppinot-fastdev test
./mvnw -o -P '!pinot-fastdev' -pl pinot-segment-local spotless:apply
checkstyle:check license:check
```
--
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]