hasnain-db commented on code in PR #50391: URL: https://github.com/apache/spark/pull/50391#discussion_r2034450043
########## sql/core/src/test/scala/org/apache/spark/sql/execution/streaming/state/StateStoreSuite.scala: ########## @@ -1718,6 +1753,60 @@ abstract class StateStoreSuiteBase[ProviderClass <: StateStoreProvider] assert(encoderSpec == deserializedEncoderSpec) } + test("SPARK-51596: unloading only occurs on maintenance thread but occurs promptly") { + // Reset closeThreadNames + FakeStateStoreProviderTracksCloseThread.closeThreadNames = Nil + + val sqlConf = getDefaultSQLConf( + SQLConf.STATE_STORE_MIN_DELTAS_FOR_SNAPSHOT.defaultValue.get, + SQLConf.MAX_BATCHES_TO_RETAIN_IN_MEMORY.defaultValue.get + ) + // Make maintenance interval very large (30s) so that task thread runs before maintenance. + sqlConf.setConf(SQLConf.STREAMING_MAINTENANCE_INTERVAL, 30000L) + // Use the `MaintenanceErrorOnCertainPartitionsProvider` to run the test + sqlConf.setConf( + SQLConf.STATE_STORE_PROVIDER_CLASS, + classOf[FakeStateStoreProviderTracksCloseThread].getName + ) + + val conf = new SparkConf().setMaster("local").setAppName("test") + + withSpark(SparkContext.getOrCreate(conf)) { sc => + withCoordinatorRef(sc) { coordinatorRef => + val rootLocation = s"${Utils.createTempDir().getAbsolutePath}/spark-48997" Review Comment: nit ```suggestion val rootLocation = s"${Utils.createTempDir().getAbsolutePath}/spark-51596" ``` ########## sql/core/src/test/scala/org/apache/spark/sql/execution/streaming/state/StateStoreSuite.scala: ########## @@ -1718,6 +1753,60 @@ abstract class StateStoreSuiteBase[ProviderClass <: StateStoreProvider] assert(encoderSpec == deserializedEncoderSpec) } + test("SPARK-51596: unloading only occurs on maintenance thread but occurs promptly") { + // Reset closeThreadNames + FakeStateStoreProviderTracksCloseThread.closeThreadNames = Nil + + val sqlConf = getDefaultSQLConf( + SQLConf.STATE_STORE_MIN_DELTAS_FOR_SNAPSHOT.defaultValue.get, + SQLConf.MAX_BATCHES_TO_RETAIN_IN_MEMORY.defaultValue.get + ) + // Make maintenance interval very large (30s) so that task thread runs before maintenance. + sqlConf.setConf(SQLConf.STREAMING_MAINTENANCE_INTERVAL, 30000L) + // Use the `MaintenanceErrorOnCertainPartitionsProvider` to run the test Review Comment: nit - this seems copied from below -- this should now be `FakeStateStoreProviderTracksCloseThread` right? -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org