From 1eb69fff9020e30a704c0a6bb9d3be88a4e1e843 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Wed, 10 Mar 2021 10:47:14 +0100 Subject: [PATCH] update jackon, caffeine GitOrigin-RevId: d7eb2583aed4730e4339cc41901daa9420902995 --- .idea/libraries/caffeine.xml | 6 +- .idea/libraries/commons_net.xml | 6 +- .idea/libraries/jackson.xml | 6 +- .idea/libraries/jackson_databind.xml | 10 +-- .idea/libraries/jackson_datatype_joda.xml | 4 +- .idea/libraries/jackson_module_kotlin.xml | 6 +- .idea/libraries/snakeyaml.xml | 6 +- .idea/libraries/zip_signer.xml | 13 +--- .../src/org/jetbrains/mvstore/MVStore.java | 65 +++---------------- .../com/intellij/ui/svg/SvgCacheManager.java | 4 +- .../ui/svg/SvgPrebuiltCacheManager.java | 4 +- 11 files changed, 35 insertions(+), 95 deletions(-) diff --git a/.idea/libraries/caffeine.xml b/.idea/libraries/caffeine.xml index 5f614fe44f7a..f78f30828658 100644 --- a/.idea/libraries/caffeine.xml +++ b/.idea/libraries/caffeine.xml @@ -1,12 +1,12 @@ - + - + - + \ No newline at end of file diff --git a/.idea/libraries/commons_net.xml b/.idea/libraries/commons_net.xml index 0a076f05b728..6b94dca0d03b 100644 --- a/.idea/libraries/commons_net.xml +++ b/.idea/libraries/commons_net.xml @@ -1,12 +1,12 @@ - + - + - + \ No newline at end of file diff --git a/.idea/libraries/jackson.xml b/.idea/libraries/jackson.xml index e2b687dac34a..d4776c83fd8f 100644 --- a/.idea/libraries/jackson.xml +++ b/.idea/libraries/jackson.xml @@ -1,15 +1,15 @@ - + - + - + \ No newline at end of file diff --git a/.idea/libraries/jackson_databind.xml b/.idea/libraries/jackson_databind.xml index ef0151eb14ca..4494703b3cb3 100644 --- a/.idea/libraries/jackson_databind.xml +++ b/.idea/libraries/jackson_databind.xml @@ -1,18 +1,18 @@ - + - - + + - - + + \ No newline at end of file diff --git a/.idea/libraries/jackson_datatype_joda.xml b/.idea/libraries/jackson_datatype_joda.xml index c0cb91a9118f..f9d777e89990 100644 --- a/.idea/libraries/jackson_datatype_joda.xml +++ b/.idea/libraries/jackson_datatype_joda.xml @@ -1,6 +1,6 @@ - + @@ -8,7 +8,7 @@ - + diff --git a/.idea/libraries/jackson_module_kotlin.xml b/.idea/libraries/jackson_module_kotlin.xml index 457bdd980ede..91af54e739ad 100644 --- a/.idea/libraries/jackson_module_kotlin.xml +++ b/.idea/libraries/jackson_module_kotlin.xml @@ -1,12 +1,12 @@ - + - + - + \ No newline at end of file diff --git a/.idea/libraries/snakeyaml.xml b/.idea/libraries/snakeyaml.xml index e687a64eaf34..889bc900dfe5 100644 --- a/.idea/libraries/snakeyaml.xml +++ b/.idea/libraries/snakeyaml.xml @@ -1,12 +1,12 @@ - + - + - + \ No newline at end of file diff --git a/.idea/libraries/zip_signer.xml b/.idea/libraries/zip_signer.xml index 281a1a6060e3..951a33a0fb18 100644 --- a/.idea/libraries/zip_signer.xml +++ b/.idea/libraries/zip_signer.xml @@ -1,23 +1,12 @@ - - - - - - - - - - + - - \ No newline at end of file diff --git a/platform/util-ex/src/org/jetbrains/mvstore/MVStore.java b/platform/util-ex/src/org/jetbrains/mvstore/MVStore.java index 16f5e5315eaa..37ca1b439944 100644 --- a/platform/util-ex/src/org/jetbrains/mvstore/MVStore.java +++ b/platform/util-ex/src/org/jetbrains/mvstore/MVStore.java @@ -214,7 +214,7 @@ public final class MVStore implements AutoCloseable { * sequential number within containing chunk into byte position * within chunk's image. Cache keyed by chunk id. */ - private final Cache chunksToC; + private final Cache chunkIdToToC; /** * The newest chunk. If nothing was stored yet, this field is not set. @@ -415,7 +415,7 @@ public final class MVStore implements AutoCloseable { if (config.recordCacheStats) { chunksToCacheBuilder.recordStats(); } - chunksToC = chunksToCacheBuilder.build(); + chunkIdToToC = chunksToCacheBuilder.build(); // make sure pages will fit into cache nonLeafPageSplitSize = Math.min(maxNonLeafWeight, config.pageSplitSize); @@ -424,7 +424,7 @@ public final class MVStore implements AutoCloseable { else { nonLeafPageCache = null; leafPageCache = null; - chunksToC = null; + chunkIdToToC = null; nonLeafPageSplitSize = Long.MAX_VALUE; leafPageSplitSize = Long.MAX_VALUE; } @@ -1759,7 +1759,7 @@ public final class MVStore implements AutoCloseable { ++nonLeafCount; } } - chunksToC.put(chunk.id, toc); + chunkIdToToC.put(chunk.id, toc); } private void storeBuffer(Chunk chunk, ByteBuf buf, Collection> changed) { @@ -2059,9 +2059,6 @@ public final class MVStore implements AutoCloseable { // similarly, all task submissions to bufferSaveExecutor // are done under serializationLock, and upon waitAllTasksExecuted() // it will be no pending / in-progress task here - //if (bufferSaveExecutor != null) { - // bufferSaveExecutor.waitAllTasksExecuted(10, TimeUnit.MINUTES); - //} saveChunkLock.lock(); try { if (lastChunk != null && reuseSpace && getFillRate() <= targetFillRate) { @@ -2644,8 +2641,7 @@ public final class MVStore implements AutoCloseable { private @NotNull LongArrayList getToC(Chunk chunk) { assert chunk.tocPos != 0; - LongArrayList toc = chunksToC.get(chunk.id, __ -> chunk.readToC(fileStore)); - assert toc != null; + LongArrayList toc = chunkIdToToC.get(chunk.id, __ -> chunk.readToC(fileStore)); assert toc.size() == chunk.pageCount : toc.size() + " != " + chunk.pageCount; return toc; } @@ -3086,7 +3082,7 @@ public final class MVStore implements AutoCloseable { if (nonLeafPageCache != null) { nonLeafPageCache.invalidateAll(); leafPageCache.invalidateAll(); - chunksToC.invalidateAll(); + chunkIdToToC.invalidateAll(); } } @@ -3253,11 +3249,6 @@ public final class MVStore implements AutoCloseable { return null; } - //private int getMapId(String name) { - // Integer m = mapNameToMetadata.get(name); - // return m == null ? -1 : m; - //} - public void triggerAutoSave() { triggerAutoSave(false); } @@ -3448,34 +3439,6 @@ public final class MVStore implements AutoCloseable { } } - ///** - // * Get the amount of memory used for caching, in MB. - // * Note that this does not include the page chunk references cache, which is - // * 25% of the size of the page cache. - // * - // * @return the amount of memory used for caching - // */ - //public int getCacheSizeUsed() { - // if (cache == null) { - // return 0; - // } - // return (int) (cache.stats().>> 20); - //} - - ///** - // * Get the maximum cache size, in MB. - // * Note that this does not include the page chunk references cache, which is - // * 25% of the size of the page cache. - // * - // * @return the cache size - // */ - //public int getCacheSize() { - // if (cache == null) { - // return 0; - // } - // return (int) (cache.getMaxMemory() >> 20); - //} - /** * Get the cache. * @@ -3494,18 +3457,6 @@ public final class MVStore implements AutoCloseable { return fileStore != null && fileStore.isReadOnly(); } - //public int getTocCacheHitRatio() { - // return getCacheHitRatio(chunksToC); - //} - - //private static int getCacheHitRatio(CacheLongKeyLIRS cache) { - // if (cache == null) { - // return 0; - // } - // long hits = cache.getHits(); - // return (int) (100 * hits / (hits + cache.getMisses() + 1)); - //} - public int getLeafRatio() { return (int)(leafCount * 100 / Math.max(1, leafCount + nonLeafCount)); } @@ -3617,9 +3568,9 @@ public final class MVStore implements AutoCloseable { continue; } // purge dead pages from cache - LongArrayList toc = chunksToC == null ? null : chunksToC.getIfPresent(chunk.id); + LongArrayList toc = chunkIdToToC == null ? null : chunkIdToToC.getIfPresent(chunk.id); if (toc != null) { - chunksToC.invalidate(chunk); + chunkIdToToC.invalidate(chunk.id); for (LongListIterator iterator = toc.iterator(); iterator.hasNext(); ) { long tocElement = iterator.nextLong(); long pagePos = DataUtil.getPageInfo(chunk.id, tocElement); diff --git a/platform/util/ui/src/com/intellij/ui/svg/SvgCacheManager.java b/platform/util/ui/src/com/intellij/ui/svg/SvgCacheManager.java index 81c2ae57a196..7057d8334241 100644 --- a/platform/util/ui/src/com/intellij/ui/svg/SvgCacheManager.java +++ b/platform/util/ui/src/com/intellij/ui/svg/SvgCacheManager.java @@ -43,10 +43,10 @@ public final class SvgCacheManager { public void accept(Throwable e, MVStore store) { Logger logger = getLogger(); if (isStoreOpened) { - logger.error("Icon Cache Error, (db=" + store.getFileStore() + ')'); + logger.error("Icon cache error (db=" + store.getFileStore() + ')'); } else { - logger.warn("Icon Cache will be recreated or previous version of data reused, (db=" + store.getFileStore() + ')'); + logger.warn("Icon cache will be recreated or previous version of data reused, (db=" + store.getFileStore() + ')'); } logger.debug(e); } diff --git a/platform/util/ui/src/com/intellij/ui/svg/SvgPrebuiltCacheManager.java b/platform/util/ui/src/com/intellij/ui/svg/SvgPrebuiltCacheManager.java index 983c17cae518..48a13656487a 100644 --- a/platform/util/ui/src/com/intellij/ui/svg/SvgPrebuiltCacheManager.java +++ b/platform/util/ui/src/com/intellij/ui/svg/SvgPrebuiltCacheManager.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ui.svg; import com.intellij.diagnostic.StartUpMeasurer; @@ -27,7 +27,7 @@ public final class SvgPrebuiltCacheManager { MVStore.Builder storeBuilder = new MVStore.Builder() .readOnly() .backgroundExceptionHandler((e, store) -> { - SvgCacheManager.getLogger().error("Icon Cache Error (db=" + store.getFileStore() + ")", e); + SvgCacheManager.getLogger().error("Icon cache error (db=" + store.getFileStore() + ")", e); }) .autoCommitDelay(60_000) .compressHigh();