anishshri-db commented on code in PR #50595:
URL: https://github.com/apache/spark/pull/50595#discussion_r2064468828
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/StateStore.scala:
##########
@@ -1111,60 +1149,52 @@ object StateStore extends Logging {
}
}
+ // Block until we can process this partition
+ private def awaitProcessThisPartition(
+ id: StateStoreProviderId,
+ storeConf: StateStoreConf): Boolean = {
+ maintenanceThreadPoolLock.synchronized {
+ val timeoutMs = storeConf.stateStoreMaintenanceProcessingTimeout * 1000
+ val endTime = System.currentTimeMillis() + timeoutMs
+
+ // Try to process immediately first
+ if (processThisPartition(id)) return true
+
+ // Wait with timeout and process after notification
+ def timeRemaining: Long = endTime - System.currentTimeMillis()
+
+ while (timeRemaining > 0) {
+ maintenanceThreadPoolLock.wait(Math.min(timeRemaining, 10000))
+ if (processThisPartition(id)) return true
Review Comment:
Can we remove the returns and just use the conditionals and return
true/false as needed ?
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/StateStore.scala:
##########
@@ -1111,60 +1149,52 @@ object StateStore extends Logging {
}
}
+ // Block until we can process this partition
+ private def awaitProcessThisPartition(
+ id: StateStoreProviderId,
+ storeConf: StateStoreConf): Boolean = {
+ maintenanceThreadPoolLock.synchronized {
+ val timeoutMs = storeConf.stateStoreMaintenanceProcessingTimeout * 1000
+ val endTime = System.currentTimeMillis() + timeoutMs
+
+ // Try to process immediately first
+ if (processThisPartition(id)) return true
+
+ // Wait with timeout and process after notification
+ def timeRemaining: Long = endTime - System.currentTimeMillis()
+
+ while (timeRemaining > 0) {
+ maintenanceThreadPoolLock.wait(Math.min(timeRemaining, 10000))
+ if (processThisPartition(id)) return true
Review Comment:
Can we remove the returns and just use the conditionals and return
true/false as needed ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]