Skip to content
Permalink
Browse files
[NO ISSUE][STO] Keep track of flushing memory components
- user model changes: no
- storage format changes: no
- interface changes: no

Details:

- Indicate a memory component is full only if it is a component
  pending a flush.

Change-Id: I121d842f823f5a615bd3833f11370334ff28ad2e
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/9703
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
Reviewed-by: Ali Alsuliman <ali.al.solaiman@gmail.com>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
  • Loading branch information
mhubail committed Jan 21, 2021
1 parent 118a06f commit f480e26f39d09ddc6b4a28abaa0cf18768860a23
Showing 1 changed file with 4 additions and 3 deletions.
@@ -73,6 +73,7 @@ public class GlobalVirtualBufferCache implements IVirtualBufferCache, ILifeCycle
private final List<ILSMIndex> primaryIndexes = new ArrayList<>();

private final Set<ILSMIndex> flushingIndexes = Collections.synchronizedSet(new HashSet<>());
private final Set<ILSMMemoryComponent> flushingComponents = Collections.synchronizedSet(new HashSet<>());
private volatile int flushPtr;

private final int filteredMemoryComponentMaxNumPages;
@@ -164,6 +165,7 @@ public void unregister(ILSMMemoryComponent memoryComponent) {

@Override
public void flushed(ILSMMemoryComponent memoryComponent) throws HyracksDataException {
flushingComponents.remove(memoryComponent);
if (flushingIndexes.remove(memoryComponent.getLsmIndex())) {
LOGGER.info("Completed flushing {}.", memoryComponent.getIndex());
// After the flush operation is completed, we may have 2 cases:
@@ -208,8 +210,7 @@ public boolean isFull() {

@Override
public boolean isFull(ILSMMemoryComponent memoryComponent) {
return flushingIndexes.contains(memoryComponent.getLsmIndex())
|| isFilteredMemoryComponentFull(memoryComponent);
return flushingComponents.contains(memoryComponent) || isFilteredMemoryComponentFull(memoryComponent);
}

private boolean isFilteredMemoryComponentFull(ILSMMemoryComponent memoryComponent) {
@@ -508,7 +509,6 @@ private ILSMIndex selectFlushIndex() throws HyracksDataException {
// future writers
memoryComponent.setUnwritable();
}

opTracker.setFlushOnExit(true);
opTracker.flushIfNeeded();
// If the flush cannot be scheduled at this time, then there must be active writers.
@@ -522,6 +522,7 @@ private ILSMIndex selectFlushIndex() throws HyracksDataException {
if ((flushable || opTracker.isFlushLogCreated()) && !isMetadataIndex(primaryIndex)) {
// global vbc cannot wait on metadata indexes because metadata indexes support full
// ACID transactions. Waiting on metadata indexes can introduce deadlocks.
flushingComponents.add(primaryIndex.getCurrentMemoryComponent());
return primaryIndex;
}
}

0 comments on commit f480e26

Please sign in to comment.