kfaraz commented on code in PR #18106:
URL: https://github.com/apache/druid/pull/18106#discussion_r2137282046


##########
extensions-core/hdfs-storage/src/main/java/org/apache/druid/storage/hdfs/HdfsDataSegmentKiller.java:
##########
@@ -70,52 +70,51 @@ public void kill(DataSegment segment) throws 
SegmentLoadingException
     final Path segmentPath = getPath(segment);
     log.info("Killing segment[%s] mapped to path[%s]", segment.getId(), 
segmentPath);
 
-    try {
+    try (final FileSystem fs = segmentPath.getFileSystem(config)) {
       String filename = segmentPath.getName();
-      final FileSystem fs = segmentPath.getFileSystem(config);
-      if (!filename.endsWith(".zip")) {
-        throw new SegmentLoadingException("Unknown file type[%s]", 
segmentPath);
-      } else {
-
-        if (!fs.exists(segmentPath)) {
-          log.warn("Segment path [%s] does not exist", segmentPath);
-          return;
-        }
-
-        // There are 3 supported path formats:
-        //    - 
hdfs://nn1/hdfs_base_directory/data_source_name/interval/version/shardNum/index.zip
-        //    - 
hdfs://nn1/hdfs_base_directory/data_source_name/interval/version/shardNum_index.zip
-        //    - 
hdfs://nn1/hdfs_base_directory/data_source_name/interval/version/shardNum_UUID_index.zip
-        String[] zipParts = filename.split("_");
-
-        Path descriptorPath = new Path(segmentPath.getParent(), 
"descriptor.json");
-        if (zipParts.length > 1) {
-          Preconditions.checkState(zipParts.length <= 3 &&
-                                   StringUtils.isNumeric(zipParts[0]) &&
-                                   "index.zip".equals(zipParts[zipParts.length 
- 1]),
-                                   "Unexpected segmentPath format [%s]", 
segmentPath
-          );
-
-          descriptorPath = new Path(
-              segmentPath.getParent(),
-              org.apache.druid.java.util.common.StringUtils.format(
-                  "%s_%sdescriptor.json",
-                  zipParts[0],
-                  zipParts.length == 2 ? "" : zipParts[1] + "_"
-              )
-          );
-        }
-
-        if (!fs.delete(segmentPath, false)) {
-          throw new SegmentLoadingException("Unable to kill segment, failed to 
delete [%s]", segmentPath.toString());

Review Comment:
   I don't think anything has changed on these lines. Could you please check 
the formatting and revert any superfluous change from the patch?



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