This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new b8e7d99d417a [SPARK-47490][SS] Fix RocksDB Logger constructor use to 
avoid deprecation warning
b8e7d99d417a is described below

commit b8e7d99d417ab4bcc3e69d11a0eee5864cb083e3
Author: Anish Shrigondekar <anish.shrigonde...@databricks.com>
AuthorDate: Wed Mar 20 15:11:51 2024 -0700

    [SPARK-47490][SS] Fix RocksDB Logger constructor use to avoid deprecation 
warning
    
    ### What changes were proposed in this pull request?
    Fix RocksDB Logger constructor use to avoid deprecation warning
    
    ### Why are the changes needed?
    With the latest RocksDB upgrade, the Logger constructor used was deprecated 
which was throwing a compiler warning.
    ```
    [warn]     val dbLogger = new Logger(dbOptions) {
    [warn]                        ^
    [warn] one warning found
    [warn] two warnings found
    [info] compiling 36 Scala sources and 16 Java sources to 
/Users/anish.shrigondekar/spark/spark/sql/core/target/scala-2.13/classes ...
    [warn] -target is deprecated: Use -release instead to compile against the 
correct platform API.
    [warn] Applicable -Wconf / nowarn filters for this warning: msg=<part of 
the message>, cat=deprecation
    [warn] 
/Users/anish.shrigondekar/spark/spark/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDB.scala:851:24:
 constructor Logger in class Logger is deprecated
    [warn] Applicable -Wconf / nowarn filters for this warning: msg=<part of 
the message>, cat=deprecation, 
site=org.apache.spark.sql.execution.streaming.state.RocksDB.createLogger.dbLogger,
 origin=org.rocksdb.Logger.<init>
    ```
    
    Updated to use the new recommendation as mentioned here - 
https://javadoc.io/doc/org.rocksdb/rocksdbjni/latest/org/rocksdb/Logger.html
    
    Recommendation:
    ```
    
[Logger](https://javadoc.io/static/org.rocksdb/rocksdbjni/8.11.3/org/rocksdb/Logger.html#Logger-org.rocksdb.DBOptions-)([DBOptions](https://javadoc.io/static/org.rocksdb/rocksdbjni/8.11.3/org/rocksdb/DBOptions.html)
 dboptions)
    Deprecated.
    Use 
[Logger(InfoLogLevel)](https://javadoc.io/static/org.rocksdb/rocksdbjni/8.11.3/org/rocksdb/Logger.html#Logger-org.rocksdb.InfoLogLevel-)
 instead, e.g. new Logger(dbOptions.infoLogLevel()).
    ```
    
    After the fix, the warning is not seen.
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    Existing unit tests
    
    ### Was this patch authored or co-authored using generative AI tooling?
    No
    
    Closes #45616 from anishshri-db/task/SPARK-47490.
    
    Authored-by: Anish Shrigondekar <anish.shrigonde...@databricks.com>
    Signed-off-by: Dongjoon Hyun <dh...@apple.com>
---
 .../scala/org/apache/spark/sql/execution/streaming/state/RocksDB.scala  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDB.scala
 
b/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDB.scala
index 950baba9031b..8fad5ce7bd6a 100644
--- 
a/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDB.scala
+++ 
b/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDB.scala
@@ -848,7 +848,7 @@ class RocksDB(
 
   /** Create a native RocksDB logger that forwards native logs to log4j with 
correct log levels. */
   private def createLogger(): Logger = {
-    val dbLogger = new Logger(dbOptions) {
+    val dbLogger = new Logger(dbOptions.infoLogLevel()) {
       override def log(infoLogLevel: InfoLogLevel, logMsg: String) = {
         // Map DB log level to log4j levels
         // Warn is mapped to info because RocksDB warn is too verbose


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to