Skip to content

[KYUUBI #7644][FLINK] Prevent concurrent access to bootstrap job IDs - #7646

Open
wForget wants to merge 1 commit into
apache:masterfrom
wForget:KYUUBI-7644
Open

[KYUUBI #7644][FLINK] Prevent concurrent access to bootstrap job IDs#7646
wForget wants to merge 1 commit into
apache:masterfrom
wForget:KYUUBI-7644

Conversation

@wForget

@wForget wForget commented Aug 21, 2026

Copy link
Copy Markdown
Member

Why are the changes needed?

Closes #7644.

In Flink YARN application mode, Kyuubi retains Flink's original application job ID list for the bootstrap job and uses a thread-safe copy for subsequent jobs. However, the list was selected based on whether the original list was empty.

Because the engine frontend could become available before bootstrap completed, the bootstrap query and a client query could both receive the original non-thread-safe ArrayList. Concurrent additions could then cause an ArrayIndexOutOfBoundsException.

This patch atomically reserves the original list for one bootstrap executor and completes bootstrap before exposing the engine frontend.

How was this patch tested?

Added EmbeddedExecutorFactorySuite to verify that the original Flink application job ID list is returned to only one executor and subsequent executors use the thread-safe collection.

Was this patch assisted by generative AI tooling?

Assisted-by: Codex with GPT-5


private static Collection<JobID> bootstrapJobIds;

private static boolean bootstrapJobIdsClaimed;

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.

should it be volatile?

val claimMethod = classOf[EmbeddedExecutorFactory]
.getDeclaredMethod("claimJobIdsForExecutor")
claimMethod.setAccessible(true)
claimMethod.invoke(null).asInstanceOf[Collection[JobID]]

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.

seems can be simplified by org.scalatest.PrivateMethodTester

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.

Flaky Test: FlinkOperationSuiteOnYarn: execute statement - select column name with dots

2 participants