Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bugfix] Handling null value for kafka client id suffix #13279

Merged
merged 2 commits into from
Jun 1, 2024

Conversation

tibrewalpratik17
Copy link
Contributor

@tibrewalpratik17 tibrewalpratik17 commented May 30, 2024

label:
bugfix

A small follow-up fix to #13168. I recently deployed this patch to one of our clusters and found null getting appending to client id. This patch fixes that issue.

String clientIdSuffix =
        instanceDataManagerConfig != null ? instanceDataManagerConfig.getConsumerClientIdSuffix() : "";
    if (StringUtils.isNotBlank(clientIdSuffix)) {
      clientIdSuffix = "-" + clientIdSuffix;
    }
    _clientId = _tableNameWithType + "-" + streamTopic + "-" + _partitionGroupId + clientIdSuffix;

Above if ciientIdSuffix is null, we were not substituting it with "".

cc @Jackie-Jiang

@codecov-commenter
Copy link

codecov-commenter commented May 30, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 62.16%. Comparing base (59551e4) to head (d35cde3).
Report is 522 commits behind head on master.

Files Patch % Lines
.../starter/helix/HelixInstanceDataManagerConfig.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #13279      +/-   ##
============================================
+ Coverage     61.75%   62.16%   +0.40%     
+ Complexity      207      198       -9     
============================================
  Files          2436     2536     +100     
  Lines        133233   139401    +6168     
  Branches      20636    21548     +912     
============================================
+ Hits          82274    86653    +4379     
- Misses        44911    46259    +1348     
- Partials       6048     6489     +441     
Flag Coverage Δ
custom-integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration <0.01% <0.00%> (-0.01%) ⬇️
integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration2 0.00% <0.00%> (ø)
java-11 62.13% <0.00%> (+0.42%) ⬆️
java-21 62.04% <0.00%> (+0.42%) ⬆️
skip-bytebuffers-false 62.15% <0.00%> (+0.40%) ⬆️
skip-bytebuffers-true 62.02% <0.00%> (+34.29%) ⬆️
temurin 62.16% <0.00%> (+0.40%) ⬆️
unittests 62.15% <0.00%> (+0.40%) ⬆️
unittests1 46.74% <ø> (-0.16%) ⬇️
unittests2 27.74% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@Jackie-Jiang Jackie-Jiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest handling null within RealtimeSegmentDataManager constructor:

    String clientIdSuffix =
        instanceDataManagerConfig != null ? instanceDataManagerConfig.getConsumerClientIdSuffix() : null;
    if (StringUtils.isNotBlank(clientIdSuffix)) {
      _clientId = _tableNameWithType + "-" + streamTopic + "-" + _partitionGroupId + "-" + clientIdSuffix;
    } else {
      _clientId = _tableNameWithType + "-" + streamTopic + "-" + _partitionGroupId;
    }

@Jackie-Jiang Jackie-Jiang merged commit 3dd653a into apache:master Jun 1, 2024
18 of 19 checks passed
@eaugene
Copy link
Contributor

eaugene commented Jun 6, 2024

Thanks for catching this @tibrewalpratik17 .
TIL : null in string concatenation is converted to "null" in java . Ref

gortiz pushed a commit to gortiz/pinot that referenced this pull request Jun 14, 2024
@tibrewalpratik17 tibrewalpratik17 deleted the nit_bug_fix branch June 14, 2024 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants