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

[#3216] fix(core): Fix the issue of method checkValue in the ConfigOption #3217

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

qqqttt123
Copy link
Contributor

@qqqttt123 qqqttt123 commented Apr 29, 2024

What changes were proposed in this pull request?

Fix the issue of method checkValue in the ConfigOption. If we use checkValue in the wrong position, it won't work.

Why are the changes needed?

Fix: #3216

Does this PR introduce any user-facing change?

No.

How was this patch tested?

UT.

@qqqttt123 qqqttt123 requested a review from jerryshao April 29, 2024 08:14
@qqqttt123 qqqttt123 self-assigned this Apr 29, 2024
@qqqttt123 qqqttt123 added need backport Issues that need to backport to another branch branch-0.5 labels Apr 29, 2024
@qqqttt123 qqqttt123 changed the title [#3216] fix(core): Fix the issue of method checkValue in the ConfigOption [#3216] fix(core): Fix the issue of method checkValue in the ConfigOption Apr 29, 2024
@qqqttt123 qqqttt123 force-pushed the ISSUE-3216 branch 3 times, most recently from 22d537e to f8ffd73 Compare April 29, 2024 08:55
ConfigEntry<List<T>> conf =
new ConfigEntry<>(key, version, doc, alternatives, isPublic, isDeprecated);
conf.setValueConverter((String str) -> strToSeq(str, valueConverter));
conf.setStringConverter((List<T> val) -> seqToStr(val, stringConverter));
conf.setStringConverter((List<T> val) -> val == null ? "null" : seqToStr(val, stringConverter));
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is a little weird to use "null" for null config value, can we use null directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK.

.checkValue(
valueList ->
valueList != null && valueList.stream().allMatch(StringUtils::isNotBlank),
ConfigConstants.NOT_BLANK_ERROR_MSG)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the ordering matters? I think it is not just simply changing the ordering to fix the issue. We can misuse it if the implementation is strongly relying on the ordering, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I modify the implement to fix the issue.

  1. If we call this method before toSequence, it will check every element.
  2. If we call this method after toSequeue, it will check the list.

Copy link
Contributor

@jerryshao jerryshao left a comment

Choose a reason for hiding this comment

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

LGTM.

@jerryshao jerryshao merged commit 5a1b7c2 into apache:main Apr 30, 2024
22 checks passed
github-actions bot pushed a commit that referenced this pull request Apr 30, 2024
…Option (#3217)

### What changes were proposed in this pull request?
Fix the issue of method `checkValue` in the ConfigOption. If we use
`checkValue` in the wrong position, it won't work.

### Why are the changes needed?

Fix: #3216

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
UT.

Co-authored-by: Heng Qin <[email protected]>
@qqqttt123 qqqttt123 deleted the ISSUE-3216 branch April 30, 2024 06:29
diqiu50 pushed a commit to diqiu50/gravitino that referenced this pull request Jun 13, 2024
…ConfigOption (apache#3217)

### What changes were proposed in this pull request?
Fix the issue of method `checkValue` in the ConfigOption. If we use
`checkValue` in the wrong position, it won't work.

### Why are the changes needed?

Fix: apache#3216

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
UT.

Co-authored-by: Heng Qin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need backport Issues that need to backport to another branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug report] Fix the issue of method checkValue in the ConfigOption
2 participants