-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[fix] [common] Fix RawMessageImpl.getProperties() failed when the message metadata contains the same key but with different values #23927
Conversation
… key, but with different values issue.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #23927 +/- ##
============================================
- Coverage 73.57% 72.84% -0.74%
+ Complexity 32624 31818 -806
============================================
Files 1877 1863 -14
Lines 139502 157866 +18364
Branches 15299 19829 +4530
============================================
+ Hits 102638 114994 +12356
- Misses 28908 33548 +4640
- Partials 7956 9324 +1368
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Some questions:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to @mattisonchao's comment. We should fix the case that duplicated keys are included in the same message.
If a message has duplicated keys in its property, I think we should allow the downstream to determine how to process such duplicated keys rather than retain a random value for such keys. For example, we can support throwing an exception that contains a list of |
I think not. We define the MessageMetadata properties as followings.
We use the proto repeated to define the properties like map, and the field properties type is repeated, so the order is determined. For the map case, we should always use the new k,v to override the old k,v. They didn't care whether the message has duplicated keys, they just need use the newest k,v. |
@mattisonchao here |
That makes sense to me. I approved it because it solves the issue when duplicated keys are already written as the properties. Regarding the producer side to prevent duplicated keys in |
well, I can approve it since the umm. it seems like that was caused by proto2 not supporting map type, and we didn't limit the duplicate key on the protocol side. |
Main Issue: #23925
My fork PR: horizonzy#20
Motivation
If the message metadata contains the same key but with different values, we should make the later value override the previous value.
Modifications
Verifying this change
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: