Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import org.apache.paimon.spark.catalog.WithPaimonCatalog
import org.apache.paimon.spark.commands.FixedBucketExpression
import org.apache.paimon.utils.ExceptionUtils

import org.apache.spark.SparkConf
import org.apache.spark.{SparkConf, TaskContext, TaskKilledException}
import org.apache.spark.scheduler.{SparkListener, SparkListenerStageSubmitted, SparkListenerTaskStart}
import org.apache.spark.sql.{Row, SparkSession}
import org.apache.spark.sql.connector.catalog.{Identifier, TableCapability, TableCatalog}
Expand Down Expand Up @@ -526,9 +526,21 @@ class V2WriteRequireDistributionTest extends PaimonSparkTestBase with AdaptiveSp
session.udf.register(
"ctas_interrupt_input",
(id: Long) => {
Thread.sleep(30000)
// Before Spark 4.0 (SPARK-44818), a kill that lands after the executor's kill check
// but before Task.run records the task thread only marks the TaskContext: the thread
// is never interrupted and the task keeps running. Poll the mark as well, otherwise
// the cancelled task keeps a local[2] slot and can starve the later cases.
val context = TaskContext.get()
val deadline = System.currentTimeMillis() + 30000
while (System.currentTimeMillis() < deadline) {
if (context.isInterrupted()) {
throw new TaskKilledException("ctas_interrupt_input was cancelled")
}
Thread.sleep(20)
}
id.toInt
})
}
)
val driver = new Thread("interrupted-ctas-driver") {
override def run(): Unit = {
SparkSession.setActiveSession(session)
Expand Down
Loading