Skip to content

Docs: Fix tag-replacement example in Java API quickstart#17084

Open
thswlsqls wants to merge 1 commit into
apache:mainfrom
thswlsqls:fix/quickstart-tag-replace-use-replacetag
Open

Docs: Fix tag-replacement example in Java API quickstart#17084
thswlsqls wants to merge 1 commit into
apache:mainfrom
thswlsqls:fix/quickstart-tag-replace-use-replacetag

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Closes #17081

Summary

  • The "Replacing and fast forwarding" example called replaceBranch(tag, 4) on tag = "audit-tag", a tag, which throws IllegalArgumentException at runtime (UpdateSnapshotReferencesOperation.replaceBranch requires the target ref to be a branch).
  • Switched to replaceTag(tag, 4), the API ManageSnapshots provides for replacing tags.
  • Matches the same file's usage of "audit-tag" as a tag two examples earlier (useRef("audit-tag")).

Testing done

  • Docs-only change, no behavior change — no test added. Verified against core/src/main/java/org/apache/iceberg/UpdateSnapshotReferencesOperation.java (replaceBranch guard) and api/src/main/java/org/apache/iceberg/ManageSnapshots.java (replaceTag signature).

The "Replacing and fast forwarding" example called replaceBranch()
on a tag ("audit-tag"), which throws IllegalArgumentException at
runtime because UpdateSnapshotReferencesOperation.replaceBranch()
requires the target ref to be a branch. Use replaceTag() instead, the
API meant for this scenario.

Generated-by: Claude Code
@github-actions github-actions Bot added the docs label Jul 3, 2026
// Replace "audit-tag" to point to snapshot 3 and update its retention
table.manageSnapshots()
.replaceBranch(tag, 4)
.replaceTag(tag, 4)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace "audit-tag" to point to snapshot 3 and update its retention

I think we should replace 4 with 3:

Suggested change
.replaceTag(tag, 4)
.replaceTag(tag, 3)

table.manageSnapshots()
.replaceBranch(tag, 4)
.replaceTag(tag, 4)
.setMaxRefAgeMs(1000)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The setMaxRefAgeMs requires two parameters:

ManageSnapshots setMaxRefAgeMs(String name, long maxRefAgeMs);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: Fix tag-replacement example in Java API quickstart

2 participants