Commit d81d23e
authored
[server][protocol] Add active unique key count tracking for store versions (linkedin#2676)
Introduces an exact per-partition active key count and exposed via OTel and Tehuti
metrics. The count is built in three stages: a batch baseline that counts all valid PUTs
during ingestion, an optional RMD for batch push for hybrid stores to distinguish
batch keys without extra reads, and hybrid ingestion continuing to build on top of
batch baseline. This design ensures accuracy while minimizing I/O by avoiding
redundant value column family reads and delegating computation primarily to the leader.
- Exact per-partition count via `AtomicLong` in `PartitionConsumptionState`
- Persisted with offsets in `PartitionState v22` (PR `linkedin#2761`)
- Metrics:
- OTel `ASYNC_GAUGE` → `ingestion.key.active_count`
- Tehuti `AsyncGauge` → `active_key_count`
# Approach
- Controlled by 3 configs
## Batch RMD (Hybrid)
- Config: `server.add.rmd.to.batch.push.for.hybrid.stores`
- Add `ts=0` RMD for batch `PUT`s only
- Helps with zero-I/O detection of batch keys
## Batch Baseline
- Config: `server.active.key.count.for.all.batch.push.enabled`
- Count `PUT`s during SOP→EOP
- Filters: chunk fragments + duplicates
- SOP: `-1 → 0`; missed SOP ⇒ stays `-1`
- Persist via `syncOffset()`
## RT Signals
- Config: `server.active.key.count.for.hybrid.store.enabled`
- Leader computes alive state change
- Emits `+1/-1/0` via `"kcs"` header
- Followers mirror without DCR or value lookup
# Key Decisions
- `ACTIVE_KEY_COUNT_NOT_TRACKED = -1` sentinel
- Any inconsistency ⇒ invalidate the counting for that version
- `decrementActiveKeyCount()` detects underflow
- `keyExists` failure ⇒ invalidate, continue ingestion
- Batch `DELETE` has no `ts=0` RMD
- 3-tier lookup: cache → transient → `keyExists`1 parent 6574798 commit d81d23e
33 files changed
Lines changed: 3762 additions & 44 deletions
File tree
- clients
- da-vinci-client/src
- main/java/com/linkedin/davinci
- config
- kafka/consumer
- stats
- ingestion
- store
- rocksdb
- test/java/com/linkedin/davinci
- kafka/consumer
- stats
- ingestion
- venice-push-job/src
- main/java/com/linkedin/venice/common
- test/java/com/linkedin/venice/hadoop/input/kafka/ttl
- internal
- venice-client-common/src/main/java/com/linkedin/venice/schema/rmd
- venice-common/src
- main/java/com/linkedin/venice
- offsets
- serialization/avro
- writer
- test/java/com/linkedin/venice/writer
- venice-test-common/src/integrationTest/java/com/linkedin/venice/endToEnd
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
332 | | - | |
333 | 332 | | |
334 | 333 | | |
335 | 334 | | |
| |||
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
77 | 79 | | |
| 80 | + | |
78 | 81 | | |
79 | 82 | | |
80 | 83 | | |
| |||
722 | 725 | | |
723 | 726 | | |
724 | 727 | | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
725 | 731 | | |
726 | 732 | | |
727 | 733 | | |
| |||
1246 | 1252 | | |
1247 | 1253 | | |
1248 | 1254 | | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
1249 | 1261 | | |
1250 | 1262 | | |
1251 | 1263 | | |
| |||
2261 | 2273 | | |
2262 | 2274 | | |
2263 | 2275 | | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
| 2286 | + | |
| 2287 | + | |
2264 | 2288 | | |
2265 | 2289 | | |
2266 | 2290 | | |
| |||
Lines changed: 280 additions & 6 deletions
Large diffs are not rendered by default.
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
24 | 29 | | |
25 | 30 | | |
26 | 31 | | |
| |||
35 | 40 | | |
36 | 41 | | |
37 | 42 | | |
| 43 | + | |
| 44 | + | |
38 | 45 | | |
39 | 46 | | |
40 | 47 | | |
| |||
43 | 50 | | |
44 | 51 | | |
45 | 52 | | |
| 53 | + | |
| 54 | + | |
46 | 55 | | |
47 | 56 | | |
48 | 57 | | |
| |||
77 | 86 | | |
78 | 87 | | |
79 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
80 | 99 | | |
81 | 100 | | |
82 | 101 | | |
| |||
Lines changed: 80 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| 38 | + | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| |||
348 | 350 | | |
349 | 351 | | |
350 | 352 | | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
351 | 363 | | |
352 | 364 | | |
353 | 365 | | |
| |||
415 | 427 | | |
416 | 428 | | |
417 | 429 | | |
| 430 | + | |
418 | 431 | | |
419 | 432 | | |
420 | 433 | | |
| |||
450 | 463 | | |
451 | 464 | | |
452 | 465 | | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
453 | 533 | | |
454 | 534 | | |
455 | 535 | | |
| |||
0 commit comments