Skip to content

[BugFix] Avoid redundant latestSnapshot() call in PaimonMetadata#getTableVersionRange - #72892

Merged
kevincai merged 1 commit into
StarRocks:mainfrom
love-star:dev/cache-paimon-lastest-snapshot
May 11, 2026
Merged

[BugFix] Avoid redundant latestSnapshot() call in PaimonMetadata#getTableVersionRange#72892
kevincai merged 1 commit into
StarRocks:mainfrom
love-star:dev/cache-paimon-lastest-snapshot

Conversation

@love-star

@love-star love-star commented May 7, 2026

Copy link
Copy Markdown
Contributor

What I'm doing:

Fixes #72891

Duplicate latestSnapshot() in the same method

In PaimonMetadata.getRemoteFileInfos() (source):

long latestSnapshotId = -1L;
try {
    if (paimonTable.getNativeTable().latestSnapshot().isPresent()) {       // ← 1st S3 call
        latestSnapshotId = paimonTable.getNativeTable().latestSnapshot().get().id();  // ← 2nd S3 call!
    }
} catch (Exception e) { ... }

latestSnapshot() internally calls SnapshotManager.latestSnapshot()latestSnapshotFromFileSystem() → reads the S3 LATEST hint file every time. The result is never stored in a local variable.

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
    • This pr needs auto generate documentation
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 4.1
    • 4.0
    • 3.5

@love-star
love-star requested a review from a team as a code owner May 7, 2026 06:17
@github-actions
github-actions Bot requested a review from Youngwb May 7, 2026 06:19
@github-actions

github-actions Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

@github-actions

github-actions Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

[FE Incremental Coverage Report]

pass : 0 / 0 (0%)

@github-actions

github-actions Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

[BE Incremental Coverage Report]

pass : 0 / 0 (0%)

@love-star

Copy link
Copy Markdown
Contributor Author

@Youngwb Could you take a moment to review this PR when you are free?

@love-star

Copy link
Copy Markdown
Contributor Author

@miomiocat this PR requires two approvals. If you have a minute, could you help introduce another committer to review it? Thank you so much!

@love-star

Copy link
Copy Markdown
Contributor Author

@stdpain this PR requires two approvals. If you have a minute, could you help introduce another committer to review it? Thank you so much!

@kevincai
kevincai enabled auto-merge (squash) May 11, 2026 22:44
@CelerData-Reviewer

Copy link
Copy Markdown

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@kevincai
kevincai merged commit 0340ccd into StarRocks:main May 11, 2026
88 of 104 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

@Mergifyio backport branch-3.5

@github-actions

Copy link
Copy Markdown
Contributor

@Mergifyio backport branch-4.0

@github-actions

Copy link
Copy Markdown
Contributor

@Mergifyio backport branch-4.1

@github-actions github-actions Bot removed the 4.1 label May 11, 2026
@mergify

mergify Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

backport branch-3.5

✅ Backports have been created

Details

Cherry-pick of 0340ccd has failed:

On branch mergify/bp/branch-3.5/pr-72892
Your branch is up to date with 'origin/branch-3.5'.

You are currently cherry-picking commit 0340ccd57b.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   fe/fe-core/src/main/java/com/starrocks/connector/paimon/PaimonMetadata.java

no changes added to commit (use "git add" and/or "git commit -a")

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@mergify

mergify Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

backport branch-4.0

✅ Backports have been created

Details

Cherry-pick of 0340ccd has failed:

On branch mergify/bp/branch-4.0/pr-72892
Your branch is up to date with 'origin/branch-4.0'.

You are currently cherry-picking commit 0340ccd57b.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   fe/fe-core/src/main/java/com/starrocks/connector/paimon/PaimonMetadata.java

no changes added to commit (use "git add" and/or "git commit -a")

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@mergify

mergify Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

backport branch-4.1

✅ Backports have been created

Details

wanpengfei-git pushed a commit that referenced this pull request May 12, 2026
…#getTableVersionRange (backport #72892) (#73123)

Co-authored-by: haoyuhua <haoyuhua007@gmail.com>
@kevincai

Copy link
Copy Markdown
Contributor

change PR type to bugfix

@kevincai kevincai changed the title [Enhancement] Avoid redundant latestSnapshot() call in PaimonMetadata#getTableVersionRange [BugFix] Avoid redundant latestSnapshot() call in PaimonMetadata#getTableVersionRange May 12, 2026
wanpengfei-git pushed a commit that referenced this pull request May 12, 2026
…ableVersionRange (backport #72892) (#73122)

Co-authored-by: haoyuhua <haoyuhua007@gmail.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kevincai <771299+kevincai@users.noreply.github.com>
wanpengfei-git pushed a commit that referenced this pull request May 12, 2026
…ableVersionRange (backport #72892) (#73121)

Co-authored-by: haoyuhua <haoyuhua007@gmail.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kevincai <771299+kevincai@users.noreply.github.com>
wanpengfei-git pushed a commit that referenced this pull request May 18, 2026
…ableVersionRange (backport #72892) (backport #73121) (#73430)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: haoyuhua <haoyuhua007@gmail.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kevincai <771299+kevincai@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement] Avoid redundant latestSnapshot() call in PaimonMetadata#getTableVersionRange

5 participants