anishshri-db commented on code in PR #47490: URL: https://github.com/apache/spark/pull/47490#discussion_r1692364600
########## sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/IncrementalExecution.scala: ########## @@ -79,6 +79,38 @@ class IncrementalExecution( StreamingTransformWithStateStrategy :: Nil } + // Methods to enable the use of AsyncLogPurge + protected val minLogEntriesToMaintain: Int = + sparkSession.sessionState.conf.minBatchesToRetain + + val errorNotifier: ErrorNotifier = new ErrorNotifier() + + override protected def purge(threshold: Long): Unit = {} + + override protected def purgeOldest(planWithStateOpId: SparkPlan): Unit = { + planWithStateOpId.collect { + case ssw: StateStoreWriter => + ssw.operatorStateMetadataVersion match { + case 2 => + val fileManager = new OperatorStateMetadataV2FileManager( + new Path(checkpointLocation, ssw.getStateInfo.operatorId.toString), + ssw.stateSchemaFilePath(Some(StateStoreId.DEFAULT_STORE_NAME)), + hadoopConf) + fileManager.keepNEntries(minLogEntriesToMaintain) Review Comment: The logic here might not be very straight forward. We need to keep the metadata for the earliest retained state basically -- 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