This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-paimon.git
The following commit(s) were added to refs/heads/master by this push:
new 9b6c35269 [core] Use overwrite instead of delete-and-write when commit
hint file (#2859)
9b6c35269 is described below
commit 9b6c352694b858881690c92038c7de9967fc29cf
Author: Aitozi <[email protected]>
AuthorDate: Thu Feb 22 10:45:01 2024 +0800
[core] Use overwrite instead of delete-and-write when commit hint file
(#2859)
---
.../src/main/java/org/apache/paimon/utils/SnapshotManager.java | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git
a/paimon-core/src/main/java/org/apache/paimon/utils/SnapshotManager.java
b/paimon-core/src/main/java/org/apache/paimon/utils/SnapshotManager.java
index 2f0a1d859..e614af7c8 100644
--- a/paimon-core/src/main/java/org/apache/paimon/utils/SnapshotManager.java
+++ b/paimon-core/src/main/java/org/apache/paimon/utils/SnapshotManager.java
@@ -429,7 +429,7 @@ public class SnapshotManager implements Serializable {
int retryNumber = 0;
while (retryNumber++ < READ_HINT_RETRY_NUM) {
try {
- return Long.parseLong(fileIO.readFileUtf8(path));
+ return
fileIO.readOverwrittenFileUtf8(path).map(Long::parseLong).orElse(null);
} catch (Exception ignored) {
}
try {
@@ -470,7 +470,6 @@ public class SnapshotManager implements Serializable {
throws IOException {
Path snapshotDir = snapshotDirByBranch(branchName);
Path hintFile = new Path(snapshotDir, fileName);
- fileIO.delete(hintFile, false);
- fileIO.writeFileUtf8(hintFile, String.valueOf(snapshotId));
+ fileIO.overwriteFileUtf8(hintFile, String.valueOf(snapshotId));
}
}