Murtadha Hubail has submitted this change and it was merged.

Change subject: ASTERIXDB-1338: Prevent Metadata Datasets Eviction
......................................................................


ASTERIXDB-1338: Prevent Metadata Datasets Eviction

- Exclude metadata datasets from eviction policy.
- Fix updating used memory when a dataset is closed.

Change-Id: I56734bfe0eb7d166786cacb8d76f12f8d1a21798
Reviewed-on: https://asterix-gerrit.ics.uci.edu/707
Tested-by: Jenkins <[email protected]>
Reviewed-by: abdullah alamoudi <[email protected]>
---
M 
asterix-common/src/main/java/org/apache/asterix/common/context/DatasetLifecycleManager.java
1 file changed, 7 insertions(+), 5 deletions(-)

Approvals:
  abdullah alamoudi: Looks good to me, approved
  Jenkins: Verified



diff --git 
a/asterix-common/src/main/java/org/apache/asterix/common/context/DatasetLifecycleManager.java
 
b/asterix-common/src/main/java/org/apache/asterix/common/context/DatasetLifecycleManager.java
index 0cd88d6..eb03015 100644
--- 
a/asterix-common/src/main/java/org/apache/asterix/common/context/DatasetLifecycleManager.java
+++ 
b/asterix-common/src/main/java/org/apache/asterix/common/context/DatasetLifecycleManager.java
@@ -214,16 +214,18 @@
     }
 
     private boolean evictCandidateDataset() throws HyracksDataException {
-        // We will take a dataset that has no active transactions, it is open 
(a dataset consuming memory),
-        // that is not being used (refcount == 0) and has been least recently 
used. The sort order defined
-        // for DatasetInfo maintains this. See DatasetInfo.compareTo().
+        /**
+         * We will take a dataset that has no active transactions, it is open 
(a dataset consuming memory),
+         * that is not being used (refcount == 0) and has been least recently 
used, excluding metadata datasets.
+         * The sort order defined for DatasetInfo maintains this. See 
DatasetInfo.compareTo().
+         */
         List<DatasetInfo> datasetInfosList = new 
ArrayList<DatasetInfo>(datasetInfos.values());
         Collections.sort(datasetInfosList);
         for (DatasetInfo dsInfo : datasetInfosList) {
             PrimaryIndexOperationTracker opTracker = 
(PrimaryIndexOperationTracker) datasetOpTrackers
                     .get(dsInfo.datasetID);
             if (opTracker != null && opTracker.getNumActiveOperations() == 0 
&& dsInfo.referenceCount == 0
-                    && dsInfo.isOpen) {
+                    && dsInfo.isOpen && dsInfo.datasetID >= 
firstAvilableUserDatasetID) {
                 closeDataset(dsInfo);
                 return true;
             }
@@ -607,8 +609,8 @@
             }
             assert iInfo.referenceCount == 0;
         }
-        dsInfo.isOpen = false;
         removeDatasetFromCache(dsInfo.datasetID);
+        dsInfo.isOpen = false;
     }
 
     @Override

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/707
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I56734bfe0eb7d166786cacb8d76f12f8d1a21798
Gerrit-PatchSet: 2
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Murtadha Hubail <[email protected]>
Gerrit-Reviewer: Jenkins <[email protected]>
Gerrit-Reviewer: Murtadha Hubail <[email protected]>
Gerrit-Reviewer: abdullah alamoudi <[email protected]>

Reply via email to