Skip to content

Commit

Permalink
Issue #8211 was fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii0lomakin committed Apr 24, 2018
1 parent a74e69c commit f74b211
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -114,15 +112,13 @@ public void decrementReadersReferrer() {
int writers = getWriters(readersWriters);
readers--;

assert readers == 0;

while (!readersWritersReferrer.compareAndSet(readersWriters, composeReadersWriters(readers, writers))) {
readersWriters = readersWritersReferrer.get();
readers = getReaders(readersWriters);
writers = getWriters(readersWriters);
readers--;

assert readers == 0;
}

final WritersListener wl = writersListener;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit f74b211

Please sign in to comment.