Dirty pages limit changed only by presence of exclusive write pages. Global lock on dirty pages table was removed.
@@ -231,8 +231,6 @@ public final class OWOWCache extends OAbstractWriteCache implements OWriteCache,
*/
private final ConcurrentSkipListSet<PageKey> exclusiveWritePages = new ConcurrentSkipListSet<>();
- private final OReadersWriterSpinLock dirtyPagesLock = new OReadersWriterSpinLock();
-
/**
* Container for dirty pages. Dirty pages table is concept taken from ARIES protocol. It contains earliest LSNs of operations on
* each page which is potentially changed but not flushed to the disk. It allows us by calculation of minimal LSN contained by
@@ -824,12 +822,7 @@ public final class OWOWCache extends OAbstractWriteCache implements OWriteCache,
dirtyLSN = new OLogSequenceNumber(0, 0);
}
- dirtyPagesLock.acquireReadLock();
- try {
dirtyPages.putIfAbsent(pageKey, dirtyLSN);
- } finally {
- dirtyPagesLock.releaseReadLock();
- }
}
@Override
@@ -2562,7 +2555,7 @@ public final class OWOWCache extends OAbstractWriteCache implements OWriteCache,
if (writeAheadLog != null) {
convertSharedDirtyPagesToLocal();
- if (exclusivePages > 0 || localDirtyPagesBySegment.size() >= 2) {
+ if (exclusivePages > 0) {
dirtyPagesLimit -= (int) (hardDirtyPagesLimit * 0.1);
dirtyPageUpdateTs = ts;
@@ -2637,8 +2630,6 @@ public final class OWOWCache extends OAbstractWriteCache implements OWriteCache,
}
private void convertSharedDirtyPagesToLocal() {
- dirtyPagesLock.acquireWriteLock();
- try {
for (final Map.Entry<PageKey, OLogSequenceNumber> entry : dirtyPages.entrySet()) {
final OLogSequenceNumber localLSN = localDirtyPages.get(entry.getKey());
@@ -2658,9 +2649,8 @@ public final class OWOWCache extends OAbstractWriteCache implements OWriteCache,
}
}
- dirtyPages.clear();
- } finally {
- dirtyPagesLock.releaseWriteLock();
+ for (final Map.Entry<PageKey, OLogSequenceNumber> entry : localDirtyPages.entrySet()) {
+ dirtyPages.remove(entry.getKey(), entry.getValue());
}
}
