[
https://issues.apache.org/jira/browse/HADOOP-18003?focusedWorklogId=680590&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-680590
]
ASF GitHub Bot logged work on HADOOP-18003:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 12/Nov/21 02:10
Start Date: 12/Nov/21 02:10
Worklog Time Spent: 10m
Work Description: tasanuma commented on a change in pull request #3644:
URL: https://github.com/apache/hadoop/pull/3644#discussion_r747932879
##########
File path:
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestCallerContext.java
##########
@@ -42,6 +42,37 @@ public void testBuilderAppend() {
builder.build().getContext());
}
+ @Test
+ public void testBuilderAppendIfAbsent() {
+ Configuration conf = new Configuration();
+ conf.set(HADOOP_CALLER_CONTEXT_SEPARATOR_KEY, "$");
+ CallerContext.Builder builder = new CallerContext.Builder(null, conf);
+ CallerContext context = builder.append("key1", "value1").build();
+ Assert.assertEquals("key1:value1",
+ builder.build().getContext());
+
+ // Append an existed key.
+ builder.appendIfAbsent("key1", "value1");
Review comment:
We might want to change the value to make sure that this entry does not
overwrite an existing entry which has the same key.
```suggestion
builder.appendIfAbsent("key1", "value2");
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 680590)
Time Spent: 50m (was: 40m)
> Add a method appendIfAbsent for CallerContext
> ---------------------------------------------
>
> Key: HADOOP-18003
> URL: https://issues.apache.org/jira/browse/HADOOP-18003
> Project: Hadoop Common
> Issue Type: New Feature
> Reporter: tomscut
> Assignee: tomscut
> Priority: Minor
> Labels: pull-request-available
> Time Spent: 50m
> Remaining Estimate: 0h
>
> As we discussed here [#3635.|#discussion_r746873078]
> In some cases, when we need to add a _key:value_ to the {_}CallerContext{_},
> we need to check whether the _key_ already exists in the outer layer, which
> is a bit of a hassle. To solve this problem, we can add a new method
> {_}CallerContext#appendIfAbsent{_}.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]