bharatviswa504 commented on a change in pull request #2938:
URL: https://github.com/apache/ozone/pull/2938#discussion_r773341947
##########
File path:
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/RepeatedOmKeyInfo.java
##########
@@ -66,7 +68,7 @@ public static RepeatedOmKeyInfo getFromProto(RepeatedKeyInfo
* @return
*/
public RepeatedKeyInfo getProto(boolean compact, int clientVersion) {
- List<KeyInfo> list = new ArrayList<>();
+ List<KeyInfo> list = new CopyOnWriteArrayList<>();
for(OmKeyInfo k : omKeyInfoList) {
Review comment:
I think the correct way to fix is implement copyObject in
RepeatedOmKeyInfo properly right now it is returning same object. The correct
way is to return copy object from this API. I believe this might be exposed due
to recent fixes, where we are adding RepeatedOmKeyInfo to cache to avoid
cleanup when override.
For example refer similar thing is observed in OMKeyInfo.
https://issues.apache.org/jira/browse/HDDS-2322
Some background when we get from Table#get API's if we get new object, then
there should be no race conditions or multiple threads modifiying same object
and we will not see this issue.
You can refer this where we introduced CopyObject to solve this kind of
issue.
https://issues.apache.org/jira/browse/HDDS-2344
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]