ChenSammi commented on a change in pull request #2433:
URL: https://github.com/apache/ozone/pull/2433#discussion_r685659433



##########
File path: 
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmKeyLocationInfoGroup.java
##########
@@ -143,16 +143,22 @@ public static OmKeyLocationInfoGroup getFromProtobuf(
   }
 
   /**
-   * Given a new block location, generate a new version list based upon this
-   * one.
+   * Given a new block location, generate a new version list based upon the
+   * version number of this object. Keep the blocks to when keepVersions is
+   * on for object versioning.
    *
    * @param newLocationList a list of new location to be added.
+   * @param keepVersions a knob to carry current locations to the next version.
    * @return newly generated OmKeyLocationInfoGroup
    */
   OmKeyLocationInfoGroup generateNextVersion(
-      List<OmKeyLocationInfo> newLocationList) {
-    Map<Long, List<OmKeyLocationInfo>> newMap =
-        new HashMap<>();
+      List<OmKeyLocationInfo> newLocationList, boolean keepVersions) {
+    Map<Long, List<OmKeyLocationInfo>> newMap = null;
+    if (keepVersions) {
+      newMap = new HashMap<>(locationVersionMap);

Review comment:
       We don‘t need to include the locationVersionMap to the new  
OmKeyLocationInfoGroup even when version is true.  
   The current OmKeyLocationInfoGroup design actually has one point to improve. 
  You can refer to @symious document 
https://docs.google.com/document/d/1UYVETpSHyVppNPjHq8VuXj2t2Y0LYQNRYa6awSTCROA/edit#heading=h.h2k2ovrsrw33
 for more detail information. 




-- 
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]

Reply via email to