This is an automated email from the ASF dual-hosted git repository. mhubail pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/asterixdb.git
The following commit(s) were added to refs/heads/master by this push: new 0821193 [NO ISSUE][STO] Improve logging 0821193 is described below commit 0821193be6c84b1ab80e85b75780f6cbcfb2f1e6 Author: Ali Alsuliman <ali.al.solai...@gmail.com> AuthorDate: Sun Aug 22 03:37:30 2021 +0300 [NO ISSUE][STO] Improve logging - user model changes: no - storage format changes: no - interface changes: no Change-Id: I57c05bc089527e745cf1851be0814242ba89ac55 Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/12923 Reviewed-by: Murtadha Hubail <mhub...@apache.org> Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu> --- .../asterix/common/context/DatasetLifecycleManager.java | 17 ++++++++++++----- .../common/context/PrimaryIndexOperationTracker.java | 4 ++-- 2 files changed, 14 insertions(+), 7 deletions(-) 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 @@ public class DatasetLifecycleManager implements IDatasetLifecycleManager, ILifeC 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 @@ public class DatasetLifecycleManager implements IDatasetLifecycleManager, ILifeC 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 @@ public class PrimaryIndexOperationTracker extends BaseOperationTracker implement } } 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();