chaoqin-li1123 commented on code in PR #41099:
URL: https://github.com/apache/spark/pull/41099#discussion_r1198620563
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDB.scala:
##########
@@ -334,25 +405,59 @@ class RocksDB(
loadedVersion = -1 // invalidate loaded version
throw t
} finally {
- if (rocksDBBackgroundThreadPaused) db.continueBackgroundWork()
- silentDeleteRecursively(checkpointDir, s"committing $newVersion")
// reset resources as either 1) we already pushed the changes and it has
been committed or
// 2) commit has failed and the current version is "invalidated".
release()
}
}
+ private def shouldCreateSnapshot(): Boolean = {
+ if (enableChangelogCheckpointing) {
+ assert(changelogWriter.isDefined)
+ val newVersion = loadedVersion + 1
+ newVersion - lastCheckpointVersion >= conf.minDeltasForSnapshot ||
+ changelogWriter.get.size > 10000
+ } else true
+ }
+
+ private def uploadSnapshot(): Unit = {
+ val localCheckpoint = synchronized {
+ val checkpoint = latestCheckpoint
+ latestCheckpoint = None
+ checkpoint
+ }
+ localCheckpoint match {
+ case Some(RocksDBCheckpoint(localDir, version, numKeys)) =>
+ try {
+ val uploadTime = timeTakenMs {
+ fileManager.saveCheckpointToDfs(localDir, version, numKeys)
+ fileManagerMetrics = fileManager.latestSaveCheckpointMetrics
+ }
+ logInfo(s"Upload snapshot of version $version, time taken:
$uploadTime ms")
Review Comment:
StateStore id added to logging.
--
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]