From 8331442661552a0fca3eac3e16393172278f2b95 Mon Sep 17 00:00:00 2001 From: Alexey Tsvetkov Date: Tue, 26 Jan 2016 16:10:29 +0300 Subject: [PATCH] Fix clause that causes removing deleted files from LookupStorage --- .../src/org/jetbrains/kotlin/incremental/LookupStorage.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/build-common/src/org/jetbrains/kotlin/incremental/LookupStorage.kt b/build-common/src/org/jetbrains/kotlin/incremental/LookupStorage.kt index 23f74dd8c9c..d927c746f34 100644 --- a/build-common/src/org/jetbrains/kotlin/incremental/LookupStorage.kt +++ b/build-common/src/org/jetbrains/kotlin/incremental/LookupStorage.kt @@ -83,7 +83,7 @@ open class LookupStorage(private val targetDataDir: File) : BasicMapsOwner() { @Synchronized fun removeLookupsFrom(files: Sequence) { for (file in files) { - val id = fileToId[file] ?: return + val id = fileToId[file] ?: continue idToFile.remove(id) fileToId.remove(file) deletedCount++ @@ -132,8 +132,12 @@ open class LookupStorage(private val targetDataDir: File) : BasicMapsOwner() { } private fun removeGarbageIfNeeded(force: Boolean = false) { - if (!force && size <= MINIMUM_GARBAGE_COLLECTIBLE_SIZE && deletedCount.toDouble() / size <= DELETED_TO_SIZE_TRESHOLD) return + if (force || (size > MINIMUM_GARBAGE_COLLECTIBLE_SIZE && deletedCount.toDouble() / size > DELETED_TO_SIZE_TRESHOLD)) { + doRemoveGarbage() + } + } + private fun doRemoveGarbage() { for (hash in lookupMap.keys) { lookupMap[hash] = lookupMap[hash]!!.filter { it in idToFile }.toSet() }