micheal-o commented on code in PR #47875:
URL: https://github.com/apache/spark/pull/47875#discussion_r1765799033
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDB.scala:
##########
@@ -762,7 +716,20 @@ class RocksDB(
def doMaintenance(): Unit = {
if (enableChangelogCheckpointing) {
- uploadSnapshot()
+
+ var mostRecentSnapshot: Option[RocksDBSnapshot] = None
+ var snapshot = snapshots.poll()
+
+ while (snapshot != null) {
Review Comment:
I don't think that is any better. Also don't think we should be allocating a
new Array just for this. Below is a snippet of how that would look like and
doesn't look any better. I've added comment, so hopefully that helps
```
val snapshots = new ArrayBuffer[RocksDBSnapshot]()
var snapshot = snapshotsToUploadQueue.poll()
while (snapshot != null) {
logDebug(s"RocksDB Maintenance - polled snapshot ${snapshot.version}")
snapshots += snapshot
snapshot = snapshotsToUploadQueue.poll()
}
val mostRecentSnapshot = snapshots.lastOption
snapshots.init.foreach(_.close()) // close all snapshots except the last one
```
--
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]