diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/cache/OCachePointer.java b/core/src/main/java/com/orientechnologies/orient/core/storage/cache/OCachePointer.java index 502921d4e84..2e83938c6c4 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/cache/OCachePointer.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/cache/OCachePointer.java @@ -89,14 +89,12 @@ public void incrementReadersReferrer() { int readers = getReaders(readersWriters); int writers = getWriters(readersWriters); readers++; - assert readers == 1; while (!readersWritersReferrer.compareAndSet(readersWriters, composeReadersWriters(readers, writers))) { readersWriters = readersWritersReferrer.get(); readers = getReaders(readersWriters); writers = getWriters(readersWriters); readers++; - assert readers == 1; } final WritersListener wl = writersListener; @@ -114,7 +112,6 @@ public void decrementReadersReferrer() { int writers = getWriters(readersWriters); readers--; - assert readers == 0; while (!readersWritersReferrer.compareAndSet(readersWriters, composeReadersWriters(readers, writers))) { readersWriters = readersWritersReferrer.get(); @@ -122,7 +119,6 @@ public void decrementReadersReferrer() { writers = getWriters(readersWriters); readers--; - assert readers == 0; } final WritersListener wl = writersListener; diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/cache/local/twoq/O2QCache.java b/core/src/main/java/com/orientechnologies/orient/core/storage/cache/local/twoq/O2QCache.java index 2e1d65e109d..ca8f38c4ade 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/cache/local/twoq/O2QCache.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/cache/local/twoq/O2QCache.java @@ -1190,6 +1190,8 @@ private boolean processFetchedPage(boolean removeColdPages, OCachePointer dataPo final long pageIndex = dataPointer.getPageIndex(); if (pinnedPages.containsKey(new PinnedPage(fileId, pageIndex))) { + dataPointer.decrementReadersReferrer(); + return removeColdPages; }