>From Ali Alsuliman <ali.al.solai...@gmail.com>:

Ali Alsuliman has uploaded this change for review. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/12923 )


Change subject: [NO ISSUE][STO] Improve logging
......................................................................

[NO ISSUE][STO] Improve logging

- user model changes: no
- storage format changes: no
- interface changes: no

Change-Id: I57c05bc089527e745cf1851be0814242ba89ac55
---
M 
asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/DatasetLifecycleManager.java
M 
asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/PrimaryIndexOperationTracker.java
2 files changed, 14 insertions(+), 7 deletions(-)



  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/23/12923/1

diff --git 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/DatasetLifecycleManager.java
 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/DatasetLifecycleManager.java
index 2fe100e..bd24696 100644
--- 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/DatasetLifecycleManager.java
+++ 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/DatasetLifecycleManager.java
@@ -170,9 +170,15 @@
         closeIndex(iInfo);
         dsInfo.removeIndex(resourceID);
         synchronized (dsInfo) {
-            if (dsInfo.getReferenceCount() == 0 && dsInfo.isOpen() && 
dsInfo.getIndexes().isEmpty()
-                    && !dsInfo.isExternal()) {
+            int referenceCount = dsInfo.getReferenceCount();
+            boolean open = dsInfo.isOpen();
+            boolean empty = dsInfo.getIndexes().isEmpty();
+            if (referenceCount == 0 && open && empty && !dsInfo.isExternal()) {
+                LOGGER.debug("removing dataset {} from cache", 
dsInfo.getDatasetID());
                 removeDatasetFromCache(dsInfo.getDatasetID());
+            } else {
+                LOGGER.debug("keeping dataset {} in cache, ref count {}, open 
{}, indexes count: {}",
+                        dsInfo.getDatasetID(), referenceCount, open, 
dsInfo.getIndexes().size());
             }
         }
     }
@@ -414,9 +420,10 @@
         logManager.log(waitLog);
         for (PrimaryIndexOperationTracker primaryOpTracker : 
dsr.getOpTrackers()) {
             // flush each partition one by one
-            if (primaryOpTracker.getNumActiveOperations() > 0) {
-                throw new IllegalStateException(
-                        "flushDatasetOpenIndexes is called on a dataset with 
currently active operations");
+            int numActiveOperations = 
primaryOpTracker.getNumActiveOperations();
+            if (numActiveOperations > 0) {
+                throw new IllegalStateException("flushDatasetOpenIndexes is 
called on dataset " + dsInfo.getDatasetID()
+                        + " with currently " + "active operations, count=" + 
numActiveOperations);
             }
             primaryOpTracker.setFlushOnExit(true);
             primaryOpTracker.flushIfNeeded();
diff --git 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/PrimaryIndexOperationTracker.java
 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/PrimaryIndexOperationTracker.java
index ec05702..fb001a0 100644
--- 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/PrimaryIndexOperationTracker.java
+++ 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/PrimaryIndexOperationTracker.java
@@ -145,8 +145,8 @@
                 }
             }
             if (primaryLsmIndex == null) {
-                throw new IllegalStateException(
-                        "Primary index not found in dataset " + 
dsInfo.getDatasetID() + " and partition " + partition);
+                throw new IllegalStateException("Primary index not found in 
dataset " + dsInfo.getDatasetID()
+                        + " and partition " + partition + " open indexes " + 
indexes);
             }
             for (ILSMIndex lsmIndex : indexes) {
                 ILSMOperationTracker opTracker = 
lsmIndex.getOperationTracker();

--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/12923
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: I57c05bc089527e745cf1851be0814242ba89ac55
Gerrit-Change-Number: 12923
Gerrit-PatchSet: 1
Gerrit-Owner: Ali Alsuliman <ali.al.solai...@gmail.com>
Gerrit-MessageType: newchange

Reply via email to