Copilot commented on code in PR #6981:
URL: https://github.com/apache/hive/pull/6981#discussion_r4764971791


##########
ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java:
##########
@@ -5277,7 +5295,46 @@ private static Path mvFile(HiveConf conf, FileSystem 
sourceFs, Path sourcePath,
         isRenameAllowed);
 
     if (isRenameAllowed) {
-      destFs.rename(sourcePath, destFilePath);
+      // Filesystems that take the per-query _copy_<tag> name do not use a 
numeric _copy_N
+      // counter. Parsing that tag as a counter throws or rewrites the name, 
so rename once.
+      if (FileUtils.isNonAtomicRenameFs(destFs)) {
+        destFs.rename(sourcePath, destFilePath);

Review Comment:
   This branch still ignores the boolean returned by `FileSystem.rename`. If a 
non-atomic filesystem reports `false` (for example because the tagged 
destination already exists or the rename otherwise fails), `mvFile` returns 
this path and `copyFiles` records success even though the source remains 
staged—the same silent-loss/false-success behavior this change is meant to 
prevent. Check the return value and fail (or retry with a fresh unique name) 
before reporting success.



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