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/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new 4cf23302e [core] Adjust update tag metadata for the same snapshot
4cf23302e is described below
commit 4cf23302ecdbdcd36e85faf583efe5b36faabef4
Author: Jingsong <[email protected]>
AuthorDate: Tue Jun 25 15:52:35 2024 +0800
[core] Adjust update tag metadata for the same snapshot
---
.../java/org/apache/paimon/utils/TagManager.java | 36 +++++++++-------------
1 file changed, 14 insertions(+), 22 deletions(-)
diff --git a/paimon-core/src/main/java/org/apache/paimon/utils/TagManager.java
b/paimon-core/src/main/java/org/apache/paimon/utils/TagManager.java
index b814bd7bb..b35b55cf4 100644
--- a/paimon-core/src/main/java/org/apache/paimon/utils/TagManager.java
+++ b/paimon-core/src/main/java/org/apache/paimon/utils/TagManager.java
@@ -106,31 +106,23 @@ public class TagManager {
: snapshot.toJson();
Path tagPath = tagPath(tagName);
- // update tag metadata into for the same snapshot of the same tag name.
- if (tagExists(tagName)) {
- Snapshot tagged = taggedSnapshot(tagName);
- Preconditions.checkArgument(
- tagged.id() == snapshot.id(), "Tag name '%s' already
exists.", tagName);
- try {
+ try {
+ if (tagExists(tagName)) {
+ Snapshot tagged = taggedSnapshot(tagName);
+ Preconditions.checkArgument(
+ tagged.id() == snapshot.id(), "Tag name '%s' already
exists.", tagName);
+ // update tag metadata into for the same snapshot of the same
tag name.
fileIO.overwriteFileUtf8(tagPath, content);
- } catch (IOException e) {
- throw new RuntimeException(
- String.format(
- "Tag already exists. Failed to update tag
metadata info for tag '%s' (path %s).",
- tagName, tagPath),
- e);
- }
- } else {
- try {
+ } else {
fileIO.writeFileUtf8(tagPath, content);
- } catch (IOException e) {
- throw new RuntimeException(
- String.format(
- "Exception occurs when committing tag '%s'
(path %s). "
- + "Cannot clean up because we can't
determine the success.",
- tagName, tagPath),
- e);
}
+ } catch (IOException e) {
+ throw new RuntimeException(
+ String.format(
+ "Exception occurs when committing tag '%s' (path
%s). "
+ + "Cannot clean up because we can't
determine the success.",
+ tagName, tagPath),
+ e);
}
try {