LuciferYang commented on code in PR #37648:
URL: https://github.com/apache/spark/pull/37648#discussion_r959341662


##########
resource-managers/yarn/src/test/scala/org/apache/spark/network/shuffle/ShuffleTestAccessor.scala:
##########
@@ -220,4 +219,21 @@ object ShuffleTestAccessor {
       db: DB): ConcurrentMap[ExternalShuffleBlockResolver.AppExecId, 
ExecutorShuffleInfo] = {
     ExternalShuffleBlockResolver.reloadRegisteredExecutors(db)
   }
+
+  private def initDB(dbBackend: DBBackend, file: File): DB = {
+    if (file != null) {
+      // TODO: SPARK-38888, add rocksdb implementation.
+      dbBackend match {
+        case DBBackend.LEVELDB =>
+          val options = new org.iq80.leveldb.Options()
+          options.createIfMissing(true)
+          val factory = new org.fusesource.leveldbjni.JniDBFactory()
+          new LevelDB(factory.open(file, options))
+        case _ =>
+          throw new IllegalArgumentException("Unsupported DBBackend: " + 
dbBackend)
+      }
+    } else {
+      null
+    }

Review Comment:
   do some check, I think we can directly use another `initDB` and delete this 
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]

Reply via email to