← Back to Pull requests

perf(inkless:metadata): read topic type flags without copying the topic config #875

Closed
unknown closed this pull request without merging on Nov 17, 2026 10:37 UTC
View on GitHub
unknown unknown commented on Nov 17, 2026 07:04 UTC
Author

InklessMetadataView.isDisklessTopic and isConsolidatingDisklessTopic run for each partition on the produce, fetch, and leader-change paths. Each call copied every override of the topic into a new Properties, and isConsolidatingDisklessTopic made two copies. The flags now read one key from a read-only view of the metadata image, so the cost no longer grows with the number of overrides.

InklessMetadataViewTopicFlagBenchmark measures one call on an image of 1000 topics. The additional overrides column doesn't count the two flag overrides that the diskless topics, half of the image, also have. Each cell shows the value before the change, then after it. Time is the JMH average per call. Allocation is the bytes allocated per call (-prof gc).

| Method | Additional overrides | Time (ns) | Allocation (B) |
| ------------------------------ | -------------------- | ---------- | -------------- |
| isDisklessTopic | 0 | 36 → 13 | 160 → 40 |
| isDisklessTopic | 10 | 174 → 16 | 640 → 24 |
| isDisklessTopic | 30 | 601 → 18 | 1816 → 24 |
| isConsolidatingDisklessTopic | 0 | 53 → 15 | 360 → 40 |
| isConsolidatingDisklessTopic | 10 | 278 → 18 | 1036 → 24 |
| isConsolidatingDisklessTopic | 30 | 881 → 19 | 2760 → 24 |

The change also makes the diskless partition scans read one image. Before, if a new image deleted a topic during a scan, the scan threw NoSuchElementException to its caller: the retention scheduler or the consolidated log pruner.

A flag value other than true or false, ignoring case, such as a padded true that an alter can store, still throws, as on main: no boolean reading of it is safe for both diskless and classic topics. The broker now also logs a warning when a topic config update has such a value.

Commits

  • test(inkless:metadata): add JMH benchmark for topic type flag reads: adds InklessMetadataViewTopicFlagBenchmark. It needs jmh-benchmarks to depend on :storage:inkless.

  • perf(inkless:metadata): read topic type flags without copying the topic config: changes the flag reads and the partition scans, and documents the contract in the MetadataView Javadoc.
  • See the commit messages for the reasoning behind each step.

    Testing

  • InklessMetadataViewTest builds a real MetadataImage for the flag tests instead of a stub of topicConfig. It keeps the true, TRUE, false, empty, and unrelated-key cases.

  • testTopicFlagsThrowOnValueThatIsNotBoolean checks that a padded or non-boolean flag throws, and testUpdateTopicConfigWarnsOnFlagThatIsNotBoolean checks the warning.

  • testTopicFlagsReadOneImageWithoutCopyingTopicConfig checks that the flag methods never call topicConfig and that isConsolidatingDisklessTopic reads the image once.

  • testGetDisklessTopicPartitionsReadOneImageForAllTopics checks that a scan reads one image and doesn't make any other call on the cache.

  • testGetConsolidatingDisklessTopicPartitionsListsTopicsFromImageNotFromConfigs checks that a config for a topic missing from the image doesn't give any partitions.

  • To reproduce the numbers, run ./jmh-benchmarks/jmh.sh -prof gc InklessMetadataViewTopicFlagBenchmark on each commit. The benchmark commit gives the before column, and the perf commit gives the after column.
  • Diff: 435 lines (+326 / -109) across 5 files Reviewer: giuseppelillo Review duration: 213m
    All Vouch review confidence checks passed
    Residual risk 0.27 = Change Risk (0.68) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.68 · 435 lines diff across 5 files
    0.68
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.364
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.068
    Real PR Conversation Timeline
    1 comments
    "Review active on #875"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 68.4% (HIGH) · Higher = larger blast radius
    68.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 27% · Safe to merge
    27%
    Repository