huanliwang-db commented on code in PR #46233:
URL: https://github.com/apache/spark/pull/46233#discussion_r1580437124


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/HDFSBackedStateStoreProvider.scala:
##########
@@ -437,6 +437,18 @@ private[sql] class HDFSBackedStateStoreProvider extends 
StateStoreProvider with
   private def putStateIntoStateCacheMap(
       newVersion: Long,
       map: HDFSBackedStateStoreMap): Unit = synchronized {
+    val loadedEntries = loadedMaps.size()
+    val lastKey: Option[Long] = if (loadedEntries > 0) 
Some(loadedMaps.lastKey()) else None
+    if (lastKey.isDefined) {
+      logInfo(s"Trying to add version=$newVersion to state cache map with " +
+        s"current_size=$loadedEntries and last_loaded_version=${lastKey.get} 
and " +

Review Comment:
   the keys are stored in the reverse order, so the last key is the earliest 
version: 
https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/HDFSBackedStateStoreProvider.scala#L385-L386



-- 
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]

Reply via email to