Skip to content

[client] Reuse the coordinator gateway factory for BulkLoad - #5402

Merged
wuchong merged 1 commit into
apache:mainfrom
wuchong:refactor/bulkload-coordinator-gateway
Nov 27, 2026
Merged

wuchong merged 1 commit into
apache:mainfrom
wuchong:refactor/bulkload-coordinator-gateway

Conversation

@wuchong

@wuchong wuchong commented Nov 27, 2026

Copy link
Copy Markdown
Member

Purpose

Follow up on #5399 and the BulkLoad Java SDK in #4225, part of #4222. MetadataUpdater.newCoordinatorServerClient() already creates a gateway backed by the connection's RPC client and looks up the current Coordinator for each request. BulkLoad can reuse that factory.

Brief change log

  • Pass the connection's MetadataUpdater to TableBulkLoad and create one gateway per BulkLoad instance for its transaction operations and bucket writers.
  • Remove the BulkLoad-specific gateway cache and its lazy initialization from FlussConnection.

Tests

All four BulkLoadBucketWriterITCase tests passed, including recovery after a Coordinator outage during bucket commit. The broader client run reported 1,001 tests, with one skipped and two failures. FlussAdminITCase.testGetTableInfoAndSchema encountered a refused TabletServer connection, and LogFetcherTest.testSendFetchesRechecksFetchableBucketsAfterMetadataUpdate timed out. Both passed on a targeted rerun. Spotless and Checkstyle passed.

API and Format

The removed FlussConnection helper was marked @Internal. Public client APIs, RPC messages and snapshot formats are unchanged.

Documentation

The existing BulkLoad client guide still applies.

  • Generative AI was used. Tool: OpenAI Codex.

…nitialization

Co-Authored-By: Codex <noreply@openai.com>
AI-Contributed/Feature: 30/30
AI-Contributed/UT: 0/0

@utafrali utafrali left a comment

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.

Clean, well-scoped refactor. Removing the double-checked locking singleton from FlussConnection and delegating to MetadataUpdater.newCoordinatorServerClient() is correct: CoordinatorGateway extends AdminGateway so all BulkLoad RPC methods are available, and the proxy resolves the coordinator dynamically on each call, which actually improves failover behavior compared to the cached approach. The change aligns with the existing newRandomTabletServerClient / newTabletServerClientForNode pattern already in MetadataUpdater.

@platinumhamburg platinumhamburg left a comment

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.

LGTM

@wuchong
wuchong merged commit 2c3035f into apache:main Nov 27, 2026
9 checks passed
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.

3 participants