Skip to content

Commit

Permalink
fix(interactive): Fix bugs of Groot Bulk Load When Retrying to Downlo…
Browse files Browse the repository at this point in the history
…ad Source Files (#3438)

Due to the instability of the network and tunneling tools, a certain
store encountered an error while downloading the original file. At this
point, the file already exists but only a portion has been downloaded,
causing subsequent retry operations to result in a `FileAlreadyExisted`
error. This PR addresses the issue by enabling the `REPLACE_EXISTING`
option, allowing the overwriting of existing files.
  • Loading branch information
shirly121 authored Dec 18, 2023
1 parent ebecc72 commit c28caca
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Map;
Expand Down Expand Up @@ -56,7 +57,7 @@ public static String generateRandomString(int length) {
public void downloadDataWithMove(String srcPath, String dstPath) throws IOException {
String tmpPath = dstPath + "." + generateRandomString(6);
downloadDataSimple(srcPath, tmpPath);
Files.move(Path.of(tmpPath), Path.of(dstPath));
Files.move(Path.of(tmpPath), Path.of(dstPath), StandardCopyOption.REPLACE_EXISTING);
}

public void downloadDataWithRetry(String srcPath, String dstPath) throws IOException {
Expand Down

0 comments on commit c28caca

Please sign in to comment.