fluss icon indicating copy to clipboard operation
fluss copied to clipboard

[test] Unstable test FlinkSourceEnumeratorTest.testBatchPartitionFilterOnlyGeneratesMatchingPartitionSplits

Open github-actions[bot] opened this issue 1 week ago • 1 comments

https://github.com/apache/fluss/actions/runs/44739083853/job/136297820507

[ERROR] org.apache.fluss.flink.source.enumerator.FlinkSourceEnumeratorTest.testBatchPartitionFilterOnlyGeneratesMatchingPartitionSplits  Time elapsed: 0.061 s  <<< ERROR!
org.apache.flink.util.FlinkRuntimeException: Failed to list splits for test-flink-db.test-flink-table_56955ff352094cddb9a38b148b312d29 to read due to 
	at org.apache.fluss.flink.source.enumerator.FlinkSourceEnumerator.handleSplitsAdd(FlinkSourceEnumerator.java:1411)
	at org.apache.flink.api.connector.source.mocks.MockSplitEnumeratorContext.lambda$null$4(MockSplitEnumeratorContext.java:160)
	at org.apache.flink.util.ThrowableCatchingRunnable.run(ThrowableCatchingRunnable.java:40)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.apache.fluss.exception.FlussRuntimeException: Failed to list offsets for table buckets: [0, 1, 2] due to
	at org.apache.fluss.client.initializer.BucketOffsetsRetrieverImpl.listOffsets(BucketOffsetsRetrieverImpl.java:96)
	at org.apache.fluss.client.initializer.BucketOffsetsRetrieverImpl.latestOffsets(BucketOffsetsRetrieverImpl.java:56)
	at org.apache.fluss.client.initializer.LatestOffsetsInitializer.getBucketOffsets(LatestOffsetsInitializer.java:39)
	at org.apache.fluss.flink.source.enumerator.FlussOnlyBatchSplitGenerator.getLogSplits(FlussOnlyBatchSplitGenerator.java:191)
	at org.apache.fluss.flink.source.enumerator.FlussOnlyBatchSplitGenerator.generateLogTableSplits(FlussOnlyBatchSplitGenerator.java:109)
	at org.apache.fluss.flink.source.enumerator.FlussOnlyBatchSplitGenerator.generate(FlussOnlyBatchSplitGenerator.java:85)
	at org.apache.fluss.flink.source.enumerator.FlinkSourceEnumerator.generateFlussOnlyBatchSplits(FlinkSourceEnumerator.java:782)
	at org.apache.fluss.flink.source.enumerator.FlinkSourceEnumerator.lambda$startInBatchMode$1(FlinkSourceEnumerator.java:746)
	at org.apache.flink.api.connector.source.mocks.MockSplitEnumeratorContext.lambda$null$4(MockSplitEnumeratorContext.java:149)
	... 7 more
Caused by: org.apache.fluss.exception.UnknownTableOrBucketException: Unknown table or bucket: TableBucket{tableId=20, partitionId=32, bucket=1}

github-actions[bot] avatar Nov 21 '26 04:11 github-actions[bot]

I hit this failure three times while running CI on PR #5289.

Root Cause

testBatchPartitionFilterOnlyGeneratesMatchingPartitionSplits reads an empty auto-partitioned log table in batch mode. It starts the enumerator immediately after waitUntilPartitions, which only checks ZooKeeper znode existence. It does not wait for tablet servers to process LeaderAndIsrRequest and finish creating bucket replicas. When the batch enumerator starts and calls listOffsets, the tablet server throws UnknownTableOrBucketException.

Fix Approach

In FlinkSourceEnumeratorTest#testBatchPartitionFilterOnlyGeneratesMatchingPartitionSplits: Capture the tableId from createTable(...) and wait for the target partition replicas and leader to be ready before starting the enumerator:

FLUSS_CLUSTER_EXTENSION.waitUntilTablePartitionReady(tableId, targetPartition.getKey());

I can open a PR with this fix if that sounds good and input's are welcome

pbanakar avatar Nov 21 '26 07:11 pbanakar