Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18887#discussion_r137941077
  
    --- Diff: 
core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala ---
    @@ -117,17 +122,37 @@ private[history] class FsHistoryProvider(conf: 
SparkConf, clock: Clock)
       // used for logging msgs (logs are re-scanned based on file size, rather 
than modtime)
       private val lastScanTime = new java.util.concurrent.atomic.AtomicLong(-1)
     
    -  // Mapping of application IDs to their metadata, in descending end time 
order. Apps are inserted
    -  // into the map in order, so the LinkedHashMap maintains the correct 
ordering.
    -  @volatile private var applications: mutable.LinkedHashMap[String, 
FsApplicationHistoryInfo]
    -    = new mutable.LinkedHashMap()
    +  private val pendingReplayTasksCount = new 
java.util.concurrent.atomic.AtomicInteger(0)
     
    -  val fileToAppInfo = new ConcurrentHashMap[Path, 
FsApplicationAttemptInfo]()
    +  private val storePath = conf.get(LOCAL_STORE_DIR)
     
    -  // List of application logs to be deleted by event log cleaner.
    -  private var attemptsToClean = new 
mutable.ListBuffer[FsApplicationAttemptInfo]
    +  private val listing: KVStore = storePath.map { path =>
    +    val dbPath = new File(path, "listing.ldb")
     
    -  private val pendingReplayTasksCount = new 
java.util.concurrent.atomic.AtomicInteger(0)
    +    def openDB(): LevelDB = new LevelDB(dbPath, new 
KVStoreScalaSerializer())
    +
    +    try {
    +      val db = openDB()
    +      val meta = db.getMetadata(classOf[KVStoreMetadata])
    +
    +      if (meta == null) {
    +        db.setMetadata(new KVStoreMetadata(CURRENT_LISTING_VERSION, 
logDir))
    +        db
    +      } else if (meta.version != CURRENT_LISTING_VERSION || 
!logDir.equals(meta.logDir)) {
    +        logInfo("Detected mismatched config in existing DB, deleting...")
    +        db.close()
    +        Utils.deleteRecursively(dbPath)
    --- End diff --
    
    If the version does not match, we delete the files?


---

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

Reply via email to