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
core: Fix CallOptions 'wait for ready' and toString() #1918
Conversation
test failure seems unrelated.
|
oh good catch:) |
@@ -370,7 +371,7 @@ public String toString() { | |||
toStringHelper.add("affinity", affinity); | |||
toStringHelper.add("executor", executor != null ? executor.getClass() : null); | |||
toStringHelper.add("compressorName", compressorName); | |||
toStringHelper.add("customOptions", Arrays.toString(customOptions)); | |||
toStringHelper.add("customOptions", Arrays.deepToString(customOptions)); |
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.
If we try
CallOptions.Default.withOption(option1, "v1").withOption(option1,"v2").toString()
(overwriting the same key option1),
it outputs
... customOptions=[[option1, v2], [option1, v1]], ...
Should we re-implement withOption()
so that toString()
can look nicer?
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.
@dapengzhang0 Hmm. I assume it was implemented so that withOption
doesn't have to always iterate through the whole array, and that it's probably unlikely that the same Key gets overwritten several times. Not sure whether this is a good tradeoff or premature optimization. I would assume that it's very fast to search through the array, as it's likely very small and search would just have to do ==
comparison. Maybe @elandau can comment on the implementation. I can't find any dicussion about it on the PR.
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.
@dapengzhang0 I opened a PR that changes withOption
accordingly: #1919
I don't think we need introduce a benchmark for |
@@ -295,22 +295,31 @@ public String toString() { | |||
} | |||
|
|||
/** | |||
* Set a custom option. Any existing value for the key overridden. | |||
* | |||
* Set a custom option. Any existing value for the key is overwritten. |
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.
Set -> Sets
@dapengzhang0 I think a benchmark is not strictly necessary, but I was curious about the performance impact of the additional loop. Seems like it's mostly the copying that takes the time. Also I didn't even mean to add it in this PR. I added the commit by mistake. I removed it again. |
26ee37b
to
072e99e
Compare
@buchgr Are you adding re-impl of withOptions in this PR or another one? |
@dapengzhang0 it's in #1919 ... I accidentially added the commit here. |
just one suggestion: amend the commit with a shorter title and put details in description lines before you merge, apart from that LGTM. |
- CallOptions 'wait for ready' was not passed between with*() calls and therefore it was not possible to enable it via a stub. - Properly format custom call options in toString() output.
@dapengzhang0 I made the commit msg more clear. thanks! |
thanks |
No description provided.