timeout feature for runSync (per table)#823
Conversation
| @MethodSource("generateTestParametersForFormatsSyncModesAndPartitioning") | ||
| public void testVariousOperations( | ||
| String sourceTableFormat, SyncMode syncMode, boolean isPartitioned) { | ||
| // Disable the lock manager and heartbeat threads for both Catalog and Table configurations |
There was a problem hiding this comment.
This lock-impl/heartbeat disabling looks unrelated to a per-table sync timeout. Is it masking the executor/heartbeat thread leak from the RunSync change (e.g. the IT not terminating)? Please split it into its own PR or explain the connection in the description — keeping this PR scoped to the timeout feature makes it easier to review and revert.
There was a problem hiding this comment.
prior to adding those Iceberg configs, I had this CI error:
Error: Tests run: 45, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 886.7 s <<< FAILURE! -- in org.apache.xtable.ITConversionController
Error: org.apache.xtable.ITConversionController.testVariousOperations(String, SyncMode, boolean)[9] -- Time elapsed: 46.59 s <<< ERROR!
java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@103e0cca[Not completed, task = java.util.concurrent.Executors$RunnableAdapter@350a7db8[Wrapped task = org.apache.iceberg.util.LockManagers$InMemoryLockManager$$Lambda$4325/0x000000010186d040@4b35e84a]] rejected from java.util.concurrent.ScheduledThreadPoolExecutor@53e4a92a[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 21]
at java.base/java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2055)
at java.base/java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:825)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:340)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor.scheduleAtFixedRate(ScheduledThreadPoolExecutor.java:632)
at java.base/java.util.concurrent.Executors$DelegatedScheduledExecutorService.scheduleAtFixedRate(Executors.java:785)
at org.apache.iceberg.util.LockManagers$InMemoryLockManager.acquireOnce(LockManagers.java:220)
at org.apache.iceberg.util.LockManagers$InMemoryLockManager.lambda$acquire$1(LockManagers.java:249)
at org.apache.iceberg.util.Tasks$Builder.runTaskWithRetry(Tasks.java:413)
at org.apache.iceberg.util.Tasks$Builder.runSingleThreaded(Tasks.java:219)
at org.apache.iceberg.util.Tasks$Builder.run(Tasks.java:203)
at org.apache.iceberg.util.Tasks$Builder.run(Tasks.java:196)
at org.apache.iceberg.util.LockManagers$InMemoryLockManager.acquire(LockManagers.java:249)
at org.apache.iceberg.hadoop.HadoopTableOperations.renameToFinal(HadoopTableOperations.java:363)
at org.apache.iceberg.hadoop.HadoopTableOperations.commit(HadoopTableOperations.java:162)
at org.apache.iceberg.SnapshotProducer.lambda$commit$2(SnapshotProducer.java:465)
at org.apache.iceberg.util.Tasks$Builder.runTaskWithRetry(Tasks.java:413)
at org.apache.iceberg.util.Tasks$Builder.runSingleThreaded(Tasks.java:219)
at org.apache.iceberg.util.Tasks$Builder.run(Tasks.java:203)
at org.apache.iceberg.util.Tasks$Builder.run(Tasks.java:196)
at org.apache.iceberg.SnapshotProducer.commit(SnapshotProducer.java:437)
at org.apache.iceberg.StreamingDelete.commit(StreamingDelete.java:24)
at org.apache.xtable.TestIcebergTable.deletePartition(TestIcebergTable.java:241)
at org.apache.xtable.TestIcebergTable.deleteSpecialPartition(TestIcebergTable.java:246)
at org.apache.xtable.ITConversionController.testVariousOperations(ITConversionController.java:294)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
There was a problem hiding this comment.
@vinishjail97 all reviewing comments were addressed here.
… submit() instead of delayer and runAsync + cancel(true), shutdown executor in finally
the-other-tim-brown
left a comment
There was a problem hiding this comment.
Please make sure to fill out the PR description following the guidelines.
| HudiSourceConfig.PARTITION_FIELD_SPEC_CONFIG, table.getPartitionSpec()); | ||
| } | ||
| // use a single-thread executor since tasks are processed sequentially | ||
| java.util.concurrent.ExecutorService syncExecutor = Executors.newSingleThreadExecutor(); |
There was a problem hiding this comment.
Lets make sure to use imports over fully qualified names throughout this PR.
This pull request adds support for configuring a per-table timeout for the RunSync utility. A new --syncTimeout CLI option allows users to specify the maximum amount of time a single table sync is allowed to run before it is interrupted, preventing long-running or stalled sync operations from blocking subsequent work.