mirror of https://github.com/apache/lucene.git
LUCENE-8720: fix int overflow in NameIntCacheLRU
This commit is contained in:
parent
9edc557f45
commit
c1bea96cf9
|
@ -22,6 +22,9 @@ Bug fixes
|
|||
* LUCENE-8712: Polygon2D does not detect crossings through segment edges.
|
||||
(Ignacio Vera)
|
||||
|
||||
* LUCENE-8720: NameIntCacheLRU (in the facets module) had an int
|
||||
overflow bug that disabled cleaning of the cache (Russell A Brown)
|
||||
|
||||
Improvements
|
||||
|
||||
* LUCENE-8673: Use radix partitioning when merging dimensional points instead
|
||||
|
|
|
@ -112,7 +112,7 @@ public class LruTaxonomyWriterCache implements TaxonomyWriterCache {
|
|||
// visible to us we need to make sure that the changes have been
|
||||
// committed and we reopen the reader. Because this is a slow
|
||||
// operation, we don't delete entries one-by-one but rather in bulk
|
||||
// (put() removes the 2/3rd oldest entries).
|
||||
// (put() removes the 1/3rd oldest entries).
|
||||
if (ret) {
|
||||
cache.makeRoomLRU();
|
||||
}
|
||||
|
|
|
@ -109,13 +109,13 @@ class NameIntCacheLRU {
|
|||
* if anything was removed, false otherwise.
|
||||
*
|
||||
* See comment in DirectoryTaxonomyWriter.addToCache(CategoryPath, int) for an
|
||||
* explanation why we clean 2/3rds of the cache, and not just one entry.
|
||||
* explanation why we clean 1/3rd of the cache, and not just one entry.
|
||||
*/
|
||||
boolean makeRoomLRU() {
|
||||
if (!isCacheFull()) {
|
||||
return false;
|
||||
}
|
||||
int n = cache.size() - (2*maxCacheSize)/3;
|
||||
int n = cache.size() - (int)((2L*maxCacheSize)/3);
|
||||
if (n<=0) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue