micheal-o commented on code in PR #47875:
URL: https://github.com/apache/spark/pull/47875#discussion_r1765743115
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDB.scala:
##########
@@ -251,6 +251,11 @@ class RocksDB(
}
}
+ @GuardedBy("acquireLock")
+ private val rocksDBFileMapping: RocksDBFileMapping = new RocksDBFileMapping()
+
+ private val snapshots = new ConcurrentLinkedQueue[RocksDBSnapshot]()
+
Review Comment:
done
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDB.scala:
##########
@@ -696,54 +682,22 @@ class RocksDB(
} else true
}
- private def uploadSnapshot(): Unit = {
- var oldSnapshotsImmutable: List[RocksDBSnapshot] = Nil
- val localCheckpoint = synchronized {
- val checkpoint = latestSnapshot
- latestSnapshot = None
-
- // Convert mutable list buffer to immutable to prevent
- // race condition with commit where old snapshot is added
- oldSnapshotsImmutable = oldSnapshots.toList
- oldSnapshots.clear()
-
- checkpoint
- }
- localCheckpoint match {
- case Some(
- RocksDBSnapshot(
- localDir,
- version,
- numKeys,
- capturedFileMappings,
- columnFamilyMapping,
- maxColumnFamilyId)) =>
- try {
- val uploadTime = timeTakenMs {
- fileManager.saveCheckpointToDfs(
- localDir,
- version,
- numKeys,
- capturedFileMappings,
- Some(columnFamilyMapping.toMap),
- Some(maxColumnFamilyId)
- )
- fileManagerMetrics = fileManager.latestSaveCheckpointMetrics
- }
- logInfo(log"${MDC(LogKeys.LOG_ID, loggingId)}: Upload snapshot of
version " +
- log"${MDC(LogKeys.VERSION_NUM, version)}," +
- log" time taken: ${MDC(LogKeys.TIME_UNITS, uploadTime)} ms")
- } finally {
- localCheckpoint.foreach(_.close())
-
- // Clean up old latestSnapshots
- for (snapshot <- oldSnapshotsImmutable) {
- snapshot.close()
- }
-
+ private def uploadSnapshot(snapshot: RocksDBSnapshot): Unit = {
+ try {
Review Comment:
done
--
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]