Skip to content

[test] Stabilize RemoteLogDownloader prefetch test - #3968

Open
void-ptr974 wants to merge 1 commit into
apache:mainfrom
void-ptr974:agent/fix-flaky-remote-log-prefetch-test
Open

[test] Stabilize RemoteLogDownloader prefetch test#3968
void-ptr974 wants to merge 1 commit into
apache:mainfrom
void-ptr974:agent/fix-flaky-remote-log-prefetch-test

Conversation

@void-ptr974

@void-ptr974 void-ptr974 commented Aug 12, 2026

Copy link
Copy Markdown

Purpose

Linked issue: close #3460

RemoteLogDownloaderTest.testPrefetchNum can observe one available prefetch permit instead of two because the downloader thread may acquire a recycled permit while polling the empty request queue.

Brief change log

  • Pause the downloader fetch loop after all remote log requests are scheduled.
  • Assert that both recycled prefetch permits are available while the fetch loop is paused.
  • Resume the fetch loop after the assertion and ensure it is unblocked during cleanup.

Tests

  • mvn -pl fluss-client -am -Dtest=RemoteLogDownloaderTest#testPrefetchNum -Dsurefire.failIfNoSpecifiedTests=false test
  • Repeated RemoteLogDownloaderTest#testPrefetchNum 10 times.
  • mvn -pl fluss-client -am verify (blocked by unrelated local JMX/RMI connection failures in JMXServerTest and JMXReporterTest).

API and Format

No API or storage-format changes.

Documentation

No documentation changes.

Generative AI disclosure

  • Yes — Codex (GPT-5)

Pause the downloader fetch loop before asserting recycled prefetch permits so the background thread cannot consume a permit concurrently.
@void-ptr974 void-ptr974 changed the title [test] Stabilize remote log prefetch test [test] Stabilize RemoteLogDownloader prefetch test Aug 12, 2026
@void-ptr974
void-ptr974 marked this pull request as ready for review August 12, 2026 14:56
void fetchOnce() throws Exception {
// Pause after all requests are scheduled so the loop cannot acquire a
// recycled permit before it is asserted below.
if (scannerMetricGroup.remoteFetchRequestCount().getCount() >= 5) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice fix, nit: I think extracting 5 as a named constant (e.g. EXPECTED_COUNT) or a variable would be reasonable

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[test] Unstable test RemoteLogDownloaderTest.testPrefetchNum

2 participants