You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hugegraph.apache.org by "zyxxoo (via GitHub)" <gi...@apache.org> on 2023/04/07 03:50:02 UTC

[GitHub] [incubator-hugegraph-toolchain] zyxxoo commented on a diff in pull request #451: fix: concurrency issue causing file overwrite due to identical filenames

zyxxoo commented on code in PR #451:
URL: https://github.com/apache/incubator-hugegraph-toolchain/pull/451#discussion_r1160415561


##########
hugegraph-loader/src/main/java/org/apache/hugegraph/loader/direct/loader/HBaseDirectLoader.java:
##########
@@ -145,7 +146,8 @@ String generateFiles(JavaPairRDD<ImmutableBytesWritable, KeyValue> buildAndSerRd
     public String getHFilePath(Configuration conf) throws IOException {
         FileSystem fs = FileSystem.get(conf);
         long timeStr = System.currentTimeMillis();
-        String pathStr = fs.getWorkingDirectory().toString() + "/hfile-gen" + "/" + timeStr + "/";
+        String uuid = UUID.randomUUID().toString();
+        String pathStr = fs.getWorkingDirectory().toString() + "/hfile-gen" + "/" + timeStr + "_" + uuid + "/";

Review Comment:
   时间戳有啥特殊意义嘛,可以根据时间戳+两个随机数字+count 来生成固定长度的名字



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org