Fixed a bug that caused a dataset to be removed from DatasetLifecycleManager too soon
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/DatasetLifecycleManager.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/DatasetLifecycleManager.java
index 5808d3a..96f5330 100644
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/DatasetLifecycleManager.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/DatasetLifecycleManager.java
@@ -89,15 +89,13 @@
iInfo.index.deactivate(true);
}
- if (dsInfo.referenceCount == 0 && dsInfo.isOpen) {
- for (IndexInfo i : dsInfo.indexes.values()) {
- i.index.deactivate(true);
- }
+ if (dsInfo.referenceCount == 0 && dsInfo.isOpen && dsInfo.indexes.isEmpty()) {
IVirtualBufferCache vbc = getVirtualBufferCache(did);
assert vbc != null;
used -= (vbc.getNumPages() * vbc.getPageSize());
+ datasetInfos.remove(did);
}
- datasetInfos.remove(did);
+
}
@Override