Jackie-Jiang commented on a change in pull request #8110:
URL: https://github.com/apache/pinot/pull/8110#discussion_r798899297



##########
File path: 
pinot-controller/src/main/java/org/apache/pinot/controller/api/upload/ZKOperator.java
##########
@@ -222,8 +222,36 @@ private void checkCRC(HttpHeaders headers, String 
offlineTableName, String segme
 
   private void processNewSegment(SegmentMetadata segmentMetadata, URI 
finalSegmentLocationURI,
       File currentSegmentLocation, String zkDownloadURI, HttpHeaders headers, 
String crypter, String tableNameWithType,
-      String segmentName, boolean moveSegmentToFinalLocation)
+      String segmentName, boolean moveSegmentToFinalLocation, boolean 
enableParallelPushProtection)
       throws Exception {
+    SegmentZKMetadata newSegmentZKMetadata = _pinotHelixResourceManager
+        .constructZkMetadataForNewSegment(tableNameWithType, segmentMetadata, 
zkDownloadURI, crypter);
+
+    // Lock if enableParallelPushProtection is true.
+    if (enableParallelPushProtection) {
+      
newSegmentZKMetadata.setSegmentUploadStartTime(System.currentTimeMillis());
+    }
+
+    // Update zk metadata customer map
+    String segmentZKMetadataCustomMapModifierStr = headers != null ? headers
+        
.getHeaderString(FileUploadDownloadClient.CustomHeaders.SEGMENT_ZK_METADATA_CUSTOM_MAP_MODIFIER)
 : null;
+    if (segmentZKMetadataCustomMapModifierStr != null) {
+      SegmentZKMetadataCustomMapModifier segmentZKMetadataCustomMapModifier =
+          new 
SegmentZKMetadataCustomMapModifier(segmentZKMetadataCustomMapModifierStr);
+      newSegmentZKMetadata
+          
.setCustomMap(segmentZKMetadataCustomMapModifier.modifyMap(newSegmentZKMetadata.getCustomMap()));
+    }
+
+    int expectedVersion = -1;

Review comment:
       No need to maintain `expectedVersion`. The expected version for 
releasing the lock should always be 0




-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to