You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mb...@apache.org on 2022/02/02 18:55:31 UTC
[asterixdb] 02/12: [NO ISSUE][STO] Skip flush on datasets with no open indexes
This is an automated email from the ASF dual-hosted git repository.
mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git
commit 9abc3a87479a4a62a21b6c316d3f9144ab181c2a
Author: Murtadha Hubail <mu...@couchbase.com>
AuthorDate: Fri Jan 28 01:17:16 2022 +0300
[NO ISSUE][STO] Skip flush on datasets with no open indexes
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- When attempting to flush a dataset, skip if the dataset has
no open indexes.
- Halt when no primary index is open while other indexes are
open to clear the inconsistent memory state.
Change-Id: Ib30f8bbbad03f5563ce27d573553f562d0ae484d
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/15025
Contrib: Jenkins <je...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Ali Alsuliman <al...@gmail.com>
Tested-by: Murtadha Hubail <mh...@apache.org>
---
.../asterix/common/context/PrimaryIndexOperationTracker.java | 12 ++++++++++--
.../src/main/java/org/apache/hyracks/util/ExitUtil.java | 1 +
2 files changed, 11 insertions(+), 2 deletions(-)
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 fb001a0..b0d8e02 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
@@ -51,6 +51,7 @@ import org.apache.hyracks.storage.am.lsm.common.impls.FlushOperation;
import org.apache.hyracks.storage.am.lsm.common.impls.LSMComponentId;
import org.apache.hyracks.storage.common.IModificationOperationCallback;
import org.apache.hyracks.storage.common.ISearchOperationCallback;
+import org.apache.hyracks.util.ExitUtil;
import org.apache.hyracks.util.annotations.NotThreadSafe;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -132,6 +133,11 @@ public class PrimaryIndexOperationTracker extends BaseOperationTracker implement
throw new IllegalStateException(
"Can't request a flush on an index with active operations: " + numActiveOperations.get());
}
+ if (indexes.isEmpty()) {
+ LOGGER.debug("no open indexes on dataset {} and partition {}... skipping flush",
+ dsInfo.getDatasetID(), partition);
+ return;
+ }
for (ILSMIndex lsmIndex : indexes) {
if (lsmIndex.isPrimaryIndex()) {
if (lsmIndex.isCurrentMutableComponentEmpty()) {
@@ -145,8 +151,10 @@ public class PrimaryIndexOperationTracker extends BaseOperationTracker implement
}
}
if (primaryLsmIndex == null) {
- throw new IllegalStateException("Primary index not found in dataset " + dsInfo.getDatasetID()
- + " and partition " + partition + " open indexes " + indexes);
+ LOGGER.fatal(
+ "Primary index not found in dataset {} and partition {} open indexes {}; halting to clear memory state",
+ dsInfo.getDatasetID(), partition, indexes);
+ ExitUtil.halt(ExitUtil.EC_INCONSISTENT_STORAGE_REFERENCES);
}
for (ILSMIndex lsmIndex : indexes) {
ILSMOperationTracker opTracker = lsmIndex.getOperationTracker();
diff --git a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/ExitUtil.java b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/ExitUtil.java
index f4c4183..beabb5d 100644
--- a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/ExitUtil.java
+++ b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/ExitUtil.java
@@ -56,6 +56,7 @@ public class ExitUtil {
public static final int EC_ACTIVE_RESUME_FAILURE = 18;
public static final int EC_NC_FAILED_TO_NOTIFY_TASKS_COMPLETED = 19;
public static final int EC_FAILED_TO_CANCEL_ACTIVE_START_STOP = 22;
+ public static final int EC_INCONSISTENT_STORAGE_REFERENCES = 23;
public static final int EC_IMMEDIATE_HALT = 33;
public static final int EC_HALT_ABNORMAL_RESERVED_44 = 44;
public static final int EC_IO_SCHEDULER_FAILED = 55;