← Back to Pull requests

SOLR-18062: Support arbitrary Kafka properties via env and sysprops #4185

Merged
gsingh-code merged 4 files (170 lines) on Aug 31, 2026 16:07 UTC
View on GitHub
gsingh-code gsingh-code commented on Mar 04, 2026 00:23 UTC
Author

Description

This PR completes SOLR-18062 by hardening and clarifying CrossDC Kafka pass-through property behavior.

Jira: https://issues.apache.org/jira/browse/SOLR-18062

main already included the core SOLR-18062 support for arbitrary Kafka properties via:

  • SOLR_CROSSDC_KAFKA_ environment variables

  • solr.crossdc.kafka. system properties
  • This change focuses on missing edge-case handling, precedence clarity, and testability.

    What Changed

    1) Hardened pass-through extraction in ConfUtil


  • Added a testable helper:

  • - addAdditionalKafkaProperties(Map<String,Object> properties, Map<String,String> env, Properties sysProps)
  • Preserved existing explicit config values already present in properties.

  • Added explicit precedence for pass-through collisions:

  • - solr.crossdc.kafka. system properties override SOLR_CROSSDC_KAFKA_ env values for the same normalized Kafka key.
  • Added edge-case filtering:

  • - ignore blank / empty values
    - ignore empty normalized keys (for example bare prefixes)

    2) Added focused unit coverage in ConfUtilTest


  • env mapping (SOLR_CROSSDC_KAFKA_FOO_BAR -> foo.bar)

  • sysprop mapping (solr.crossdc.kafka.foo.bar -> foo.bar)

  • precedence for env vs sysprop conflicts

  • explicit-property preservation (pass-through does not overwrite explicit value)

  • blank value and empty key filtering

  • verified pass-through values are preserved through KafkaCrossDcConf.getAdditionalProperties()
  • 3) Updated CrossDC documentation


  • Clarified key normalization behavior

  • Documented precedence (sysprop > env for same pass-through key)

  • Documented explicit setting preservation and blank-value/empty-key ignoring
  • Behavior / Compatibility

  • Backward compatible with current SOLR-18062 prefixes and behavior.

  • No changes to required CrossDC properties.

  • No change to producer/consumer wiring (getAdditionalProperties() use remains as-is).
  • Validation

    Ran locally:

  • ./gradlew :solr:modules:cross-dc:test --tests org.apache.solr.crossdc.common.ConfUtilTest

  • ./gradlew tidy :solr:modules:cross-dc:check -x test :solr:solr-ref-guide:check -x test
  • Diff: 170 lines (+149 / -21) across 4 files Reviewer: sigram Review duration: 260143m
    All Vouch review confidence checks passed
    Residual risk 0.11 = Change Risk (0.38) × (1 − Review Confidence (0.70)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.38 · 170 lines diff across 4 files
    0.38
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.54 · 5 substantive comment(s)
    0.54
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    70%
    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.308
    Real PR Conversation Timeline
    14 items
    gsingh-code gsingh-code commented on Mar 15, 2026 22:35 UTC
    Author

    Quick update: I rebased/restacked this branch on top of the latest main, and the PR now contains only the SOLR-18062 commit.

    No functional changes from the original intent, just branch hygiene to make review easier.

    gsingh-code gsingh-code commented on Mar 15, 2026 23:22 UTC
    Author

    Quick follow-up on this one: the branch is now cleanly restacked on current and the diff is focused on SOLR-18062 only. If there’s a preferred area/committer to tag for review, I can do that.

    gsingh-code gsingh-code commented on Mar 15, 2026 23:22 UTC
    Author

    Small correction to my note above: this is rebased on current main and the PR is scoped to SOLR-18062 only. Happy to adjust anything needed for review.

    gsingh-code gsingh-code commented on Apr 26, 2026 23:44 UTC
    Author

    Force-pushed after author cleanup; latest commit is 91c9549294f and is authored as openworld-maker.

    @dsmiley @epugh could you please review when you have a moment?

    epugh epugh commented on May 08, 2026 21:51 UTC
    Contributor

    We have a class called EnvUtils that I think handles a lot of this... Can you shed any light on if there is something about the cross dc stuff that prevents us from using EnvUtils? It feels like IF we can use EnvUtils, then this could be made a lot simpler?

    epugh epugh commented on May 15, 2026 12:33 UTC
    Contributor

    @gsingh-code can you review the CI checks? And then whne they pass ping me and I'll merge.

    sigram sigram commented on May 19, 2026 14:03 UTC
    Contributor

    We have a class called EnvUtils that I think handles a lot of this... Can you shed any light on if there is something about the cross dc stuff that prevents us from using EnvUtils?

    We should use it - I believe the reason was that the original crossdc contribution was developed a long time ago in the sandbox, before the introduction of EnvUtils, and then never refactored.

    epugh epugh commented on May 19, 2026 14:30 UTC
    Contributor

    > We have a class called EnvUtils that I think handles a lot of this... Can you shed any light on if there is something about the cross dc stuff that prevents us from using EnvUtils?

    > We should use it - I believe the reason was that the original crossdc contribution was developed a long time ago in the sandbox, before the introduction of EnvUtils, and then never refactored.

    Thanks for confirming the EnvUtils use. Any thing else on this PR jump out to you @sigram ? I'm hoping @gsingh-code will get tests to pass or confirm they are just flaky ones.

    sigram sigram approved these changes on May 19, 2026 14:47 UTC
    Approved Reviewer

    Looks good to me.

    epugh epugh commented on Jun 03, 2026 15:29 UTC
    Contributor

    I did a bit of spelunking, and looked at the the text added to the ref guide:

    Property names from environment variables are normalized by stripping the prefix, converting to lowercase, and replacing `_` with `.`.
    Values from `solr.crossdc.kafka.` system properties override values from `SOLR_CROSSDC_KAFKA_` environment variables when they map to the same Kafka key.
    Already-populated explicit CrossDC settings are preserved and are not overridden by pass-through values.
    Blank values and empty normalized keys are ignored
    

    So, without some more work, EnvUtils doesn't work as a direct swap.... It doesn't replicate two of our four documented guarantees — it doesn't drop blank values/empty keys, and it has no notion of preserving already-set explicit CrossDC settings — so swapping it in would silently change behavior.

    I don't know if I want to tackle makign those changes since I don't know this area very well...

    epugh epugh commented on Jun 21, 2026 18:40 UTC
    Contributor

    @sigram if you can weigh in, then I think we can get this to done...

    epugh epugh commented on Aug 17, 2026 17:53 UTC
    Contributor

    @gsingh-code can you add a changelog for this nice feature?

    epugh epugh commented on Aug 17, 2026 17:53 UTC
    Contributor

    @sigram if you can weigh in, then I think we can get this to done...

    Ping... I'd love to see this go in.. But haven't worked in this area much, so would love a +1 from you.

    Reviewers
    Assignees
    gsingh-code gsingh-code
    Labels
    risk: low confidence: 70.1% reviewed
    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: 38.1% (MEDIUM) · Higher = larger blast radius
    38.1%
    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: 70.1% · Lower = rushed or shallow review
    70.1%
    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: 11.4% · Safe to merge
    11.4%
    Repository