fluss icon indicating copy to clipboard operation
fluss copied to clipboard

[Test] FlussDatabaseSyncSourceITCase.testDatabaseSyc is not stable

Open wuchong opened this issue 1 year ago • 6 comments

Search before asking

  • [X] I searched in the issues and found nothing similar.

Fluss version

main

Minimal reproduce step

https://github.com/alibaba/fluss/actions/runs/12354685269/job/34476592703

Error:  Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 647.581 s <<< FAILURE! - in com.alibaba.fluss.lakehouse.paimon.source.FlussDatabaseSyncSourceITCase
Error:  com.alibaba.fluss.lakehouse.paimon.source.FlussDatabaseSyncSourceITCase.testDatabaseSyc  Time elapsed: 616.922 s  <<< ERROR!
java.lang.RuntimeException: Failed to fetch next result
	at org.apache.flink.streaming.api.operators.collect.CollectResultIterator.nextResultFromFetcher(CollectResultIterator.java:129)
	at org.apache.flink.streaming.api.operators.collect.CollectResultIterator.next(CollectResultIterator.java:108)
	at org.apache.flink.table.planner.connectors.CollectDynamicSink$CloseableRowIteratorWrapper.next(CollectDynamicSink.java:254)
	at com.alibaba.fluss.lakehouse.paimon.source.FlussDatabaseSyncSourceITCase.verifyRecordsSynced(FlussDatabaseSyncSourceITCase.java:273)
	at com.alibaba.fluss.lakehouse.paimon.source.FlussDatabaseSyncSourceITCase.verifyRecordsSyncedIgnoreOrder(FlussDatabaseSyncSourceITCase.java:261)
	at com.alibaba.fluss.lakehouse.paimon.source.FlussDatabaseSyncSourceITCase.testDatabaseSyc(FlussDatabaseSyncSourceITCase.java:146)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:138)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:185)
	at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService.executeNonConcurrentTasks(ForkJoinPoolHierarchicalTestExecutorService.java:155)
	at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService.invokeAll(ForkJoinPoolHierarchicalTestExecutorService.java:135)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:185)
	at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService.invokeAll(ForkJoinPoolHierarchicalTestExecutorService.java:129)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:185)
	at java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:189)
	at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:176)
	at org.apache.pekko.actor.Actor.aroundReceive(Actor.scala:547)
	at org.apache.pekko.actor.Actor.aroundReceive$(Actor.scala:545)
	at org.apache.pekko.actor.AbstractActor.aroundReceive(AbstractActor.scala:229)
	at org.apache.pekko.actor.ActorCell.receiveMessage(ActorCell.scala:590)
	at org.apache.pekko.actor.ActorCell.invoke(ActorCell.scala:557)
	at org.apache.pekko.dispatch.Mailbox.processMailbox(Mailbox.scala:280)
	at org.apache.pekko.dispatch.Mailbox.run(Mailbox.scala:241)
	at org.apache.pekko.dispatch.Mailbox.exec(Mailbox.scala:253)
	... 4 more
Caused by: java.lang.IllegalArgumentException: table not found in cluster
	at com.alibaba.fluss.cluster.Cluster.lambda$getTableOrElseThrow$4(Cluster.java:252)
	at java.util.Optional.orElseThrow(Optional.java:290)
	at com.alibaba.fluss.cluster.Cluster.getTableOrElseThrow(Cluster.java:252)
	at com.alibaba.fluss.client.metadata.MetadataUpdater.getTableInfoOrElseThrow(MetadataUpdater.java:96)
	at com.alibaba.fluss.client.table.FlussTable.<init>(FlussTable.java:144)
	at com.alibaba.fluss.client.FlussConnection.getTable(FlussConnection.java:76)
	at com.alibaba.fluss.connector.flink.source.reader.FlinkSourceSplitReader.<init>(FlinkSourceSplitReader.java:116)
	at com.alibaba.fluss.connector.flink.source.reader.FlinkSourceReader.lambda$new$0(FlinkSourceReader.java:65)
	at org.apache.flink.connector.base.source.reader.fetcher.SplitFetcherManager.createSplitFetcher(SplitFetcherManager.java:259)
	at org.apache.flink.connector.base.source.reader.fetcher.SingleThreadFetcherManager.addSplits(SingleThreadFetcherManager.java:148)
	at org.apache.flink.connector.base.source.reader.SourceReaderBase.addSplits(SourceReaderBase.java:315)
	at org.apache.flink.streaming.api.operators.SourceOperator.handleAddSplitsEvent(SourceOperator.java:606)
	at org.apache.flink.streaming.api.operators.SourceOperator.handleOperatorEvent(SourceOperator.java:575)
	at org.apache.flink.streaming.runtime.tasks.OperatorEventDispatcherImpl.dispatchEventToHandlers(OperatorEventDispatcherImpl.java:72)
	at org.apache.flink.streaming.runtime.tasks.RegularOperatorChain.dispatchOperatorEvent(RegularOperatorChain.java:80)
	at org.apache.flink.streaming.runtime.tasks.StreamTask.lambda$dispatchOperatorEvent$24(StreamTask.java:1609)
	at org.apache.flink.streaming.runtime.tasks.StreamTaskActionExecutor$1.runThrowing(StreamTaskActionExecutor.java:50)
	at org.apache.flink.streaming.runtime.tasks.mailbox.Mail.run(Mail.java:101)
	at org.apache.flink.streaming.runtime.tasks.mailbox.MailboxProcessor.runMail(MailboxProcessor.java:414)
	at org.apache.flink.streaming.runtime.tasks.mailbox.MailboxProcessor.processMailsWhenDefaultActionUnavailable(MailboxProcessor.java:383)
	at org.apache.flink.streaming.runtime.tasks.mailbox.MailboxProcessor.processMail(MailboxProcessor.java:368)
	at org.apache.flink.streaming.runtime.tasks.mailbox.MailboxProcessor.runMailboxLoop(MailboxProcessor.java:229)
	at org.apache.flink.streaming.runtime.tasks.StreamTask.runMailboxLoop(StreamTask.java:973)
	at org.apache.flink.streaming.runtime.tasks.StreamTask.invoke(StreamTask.java:917)
	at org.apache.flink.runtime.taskmanager.Task.runWithSystemExitMonitoring(Task.java:970)
	at org.apache.flink.runtime.taskmanager.Task.restoreAndInvoke(Task.java:949)
	at org.apache.flink.runtime.taskmanager.Task.doRun(Task.java:763)
	at org.apache.flink.runtime.taskmanager.Task.run(Task.java:575)
	at java.lang.Thread.run(Thread.java:750)

What doesn't meet your expectations?

Unstable tests

Anything else?

No response

Are you willing to submit a PR?

  • [ ] I'm willing to submit a PR!

wuchong avatar Dec 17 '24 02:12 wuchong

Made a pr/proposal #423 for the issue.

The issue described is reproduced on ci/cd for both methods (testDatabaseSync,testDatabaseSyncWithFilter) located in the class FlussDatabaseSyncSourceITCase.

Since this is an async operation

execEnv.executeAsync();

There is the chance that the record changes are not fully propagated when the assertion takes place. I went for the approach of retrying. I could not find any code/library for retries in the tests, I assume other unstable tests are of the same nature.

Provided the solution proposed on the pr is acceptable I can introduce it to other tests. I proceeded with the approach of implementing the retry logic with some backoff instead of introducing an extra library on the test scope. If there is a library preference for retries (for example resilience4j) can proceed with that one.

gkatzioura avatar Feb 18 '25 06:02 gkatzioura

@gkatzioura I just saw there is a retry helper function in the test-utils here https://github.com/alibaba/fluss/blob/main/fluss-test-utils/src/main/java/com/alibaba/fluss/testutils/common/CommonTestUtils.java#L135

polyzos avatar Feb 19 '25 13:02 polyzos

I switched to using the CommonTestUtils class. I added a method there. Added a new method since the existing methods are waiting for certain conditions or are bound to junit assertions. retryOnException has the purpose to wait, until a task finishes successfully and retrieve its results.

gkatzioura avatar Feb 20 '25 07:02 gkatzioura

Made a pr/proposal #423 for the issue.

The issue described is reproduced on ci/cd for both methods (testDatabaseSync,testDatabaseSyncWithFilter) located in the class FlussDatabaseSyncSourceITCase.

Since this is an async operation

execEnv.executeAsync();

There is the chance that the record changes are not fully propagated when the assertion takes place. I went for the approach of retrying. I could not find any code/library for retries in the tests, I assume other unstable tests are of the same nature.

Provided the solution proposed on the pr is acceptable I can introduce it to other tests. I proceeded with the approach of implementing the retry logic with some backoff instead of introducing an extra library on the test scope. If there is a library preference for retries (for example resilience4j) can proceed with that one.

Thanks for investigating it. But if record changes are not fully propagated, it will wait to read the rowIter utils get the exepcted rows.. So, it should throw the exception Caused by: java.lang.IllegalArgumentException: table not found in cluster

luoyuxia avatar Feb 20 '25 09:02 luoyuxia

Hi @wuchong @loserwang1024 Can you assign this to me ?

Anurag15v avatar Oct 03 '26 15:10 Anurag15v

@Anurag15v assigned

polyzos avatar Oct 05 '26 07:10 polyzos