diff --git a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java index bc99b22..127baf1 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java @@ -2492,8 +2492,11 @@ public PrincipalPrivilegeSet get_privilege_set(HiveObjectType objectType, // we find a free space. // removed source file staging.. it's more confusing when failed. - for (int counter = 1; fs.exists(itemDest) || destExists(result, itemDest); counter++) { - itemDest = new Path(destf, name + ("_copy_" + counter) + filetype); + long timestamp; + + while (fs.exists(itemDest) || destExists(result, itemDest)) { + timestamp = System.currentTimeMillis(); + itemDest = new Path(destf, name + ("_copy_" + timestamp) + filetype); } } srcToDest.add(new Path[]{itemSource, itemDest});