[NO ISSUE][RT] follow IFrameWriter protocol in SplitOperatorDescriptor
- user model changes: no
- storage format changes: no
- interface changes: no
details:
- Previously, the SplitOperatorDescriptor didn't follow the
IFrameWriter protocol in case of failure which lead to having
some open resources after the job.
- This caused so many failures in Cancellation tests.
- This change also increases the rate of cancellation during the
cancellation tests to ensure that similar problems are found.
Change-Id: I3166895589e1ab7355d689397f676f7da5c9809f
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2399
Reviewed-by: Taewoo Kim <wangsaeu@gmail.com>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/CancellationTestExecutor.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/CancellationTestExecutor.java
index 41aa23f..a1e70dc 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/CancellationTestExecutor.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/CancellationTestExecutor.java
@@ -63,11 +63,16 @@
}
};
Future<InputStream> future = executor.submit(query);
- if (cancellable) {
- Thread.sleep(20);
- // Cancels the query request while the query is executing.
- int rc = cancelQuery(getEndpoint(Servlets.RUNNING_REQUESTS), newParams);
- Assert.assertTrue(rc == 200 || rc == 404);
+ while (!future.isDone()) {
+ if (cancellable) {
+ Thread.sleep(10);
+ // Cancels the query request while the query is executing.
+ int rc = cancelQuery(getEndpoint(Servlets.RUNNING_REQUESTS), newParams);
+ Assert.assertTrue(rc == 200 || rc == 404);
+ if (rc == 200) {
+ break;
+ }
+ }
}
InputStream inputStream = future.get();
// Since the current cancellation (i.e., abort) implementation is based on thread.interrupt and we did not
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/indexing/ExternalFileIndexAccessor.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/indexing/ExternalFileIndexAccessor.java
index 5a9852e..58a2413 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/indexing/ExternalFileIndexAccessor.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/indexing/ExternalFileIndexAccessor.java
@@ -35,7 +35,7 @@
import org.apache.hyracks.api.context.IHyracksTaskContext;
import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.api.util.DestroyUtils;
+import org.apache.hyracks.api.util.CleanupUtils;
import org.apache.hyracks.dataflow.common.comm.io.ArrayTupleBuilder;
import org.apache.hyracks.dataflow.common.comm.io.ArrayTupleReference;
import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
@@ -138,7 +138,7 @@
public void close() throws HyracksDataException {
Throwable failure = ResourceReleaseUtils.close(fileIndexSearchCursor, null);
- failure = DestroyUtils.destroy(failure, fileIndexSearchCursor, fileIndexAccessor);
+ failure = CleanupUtils.destroy(failure, fileIndexSearchCursor, fileIndexAccessor);
failure = ResourceReleaseUtils.close(indexDataflowHelper, failure);
if (failure != null) {
throw HyracksDataException.create(failure);
diff --git a/hyracks-fullstack/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/std/SplitOperatorDescriptor.java b/hyracks-fullstack/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/std/SplitOperatorDescriptor.java
index 2314f88..4f90985 100644
--- a/hyracks-fullstack/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/std/SplitOperatorDescriptor.java
+++ b/hyracks-fullstack/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/std/SplitOperatorDescriptor.java
@@ -20,6 +20,7 @@
import java.nio.ByteBuffer;
+import org.apache.commons.lang3.mutable.MutableBoolean;
import org.apache.hyracks.algebricks.data.IBinaryIntegerInspector;
import org.apache.hyracks.algebricks.data.IBinaryIntegerInspectorFactory;
import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
@@ -34,6 +35,7 @@
import org.apache.hyracks.api.dataflow.value.RecordDescriptor;
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.api.job.IOperatorDescriptorRegistry;
+import org.apache.hyracks.api.util.CleanupUtils;
import org.apache.hyracks.data.std.api.IPointable;
import org.apache.hyracks.data.std.primitive.VoidPointable;
import org.apache.hyracks.dataflow.common.comm.io.FrameTupleAccessor;
@@ -102,6 +104,7 @@
final FrameTupleReference tRef = new FrameTupleReference();;
final IBinaryIntegerInspector intInsepctor = intInsepctorFactory.createBinaryIntegerInspector(ctx);
final IScalarEvaluator eval = brachingExprEvalFactory.createScalarEvaluator(ctx);
+ final MutableBoolean hasFailed = new MutableBoolean(false);
for (int i = 0; i < numberOfNonMaterializedOutputs; i++) {
appenders[i] = new FrameTupleAppender(new VSizeFrame(ctx), true);
}
@@ -160,28 +163,44 @@
@Override
public void close() throws HyracksDataException {
- HyracksDataException hde = null;
- for (int i = 0; i < numberOfNonMaterializedOutputs; i++) {
- if (isOpen[i]) {
- try {
- appenders[i].write(writers[i], true);
- writers[i].close();
- } catch (Throwable th) {
- if (hde == null) {
- hde = HyracksDataException.create(th);
- } else {
- hde.addSuppressed(th);
+ Throwable hde = null;
+ // write if hasn't failed
+ if (!hasFailed.booleanValue()) {
+ for (int i = 0; i < numberOfNonMaterializedOutputs; i++) {
+ if (isOpen[i]) {
+ try {
+ appenders[i].write(writers[i], true);
+ } catch (Throwable th) {
+ hde = th;
+ break;
}
}
}
}
+
+ // fail the writers
if (hde != null) {
- throw hde;
+ for (int i = 0; i < numberOfNonMaterializedOutputs; i++) {
+ if (isOpen[i]) {
+ CleanupUtils.fail(writers[i], hde);
+ }
+ }
+ }
+
+ // close
+ for (int i = 0; i < numberOfNonMaterializedOutputs; i++) {
+ if (isOpen[i]) {
+ hde = CleanupUtils.close(writers[i], hde);
+ }
+ }
+ if (hde != null) {
+ throw HyracksDataException.create(hde);
}
}
@Override
public void fail() throws HyracksDataException {
+ hasFailed.setTrue();
HyracksDataException hde = null;
for (int i = 0; i < numberOfNonMaterializedOutputs; i++) {
if (isOpen[i]) {
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/CleanupUtils.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/CleanupUtils.java
new file mode 100644
index 0000000..a67c133
--- /dev/null
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/CleanupUtils.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.hyracks.api.util;
+
+import org.apache.hyracks.api.comm.IFrameWriter;
+import org.apache.hyracks.api.dataflow.IDestroyable;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+public class CleanupUtils {
+
+ private static final Logger LOGGER = LogManager.getLogger();
+
+ private CleanupUtils() {
+ }
+
+ public static Throwable destroy(Throwable root, IDestroyable... destroyables) {
+ for (int i = 0; i < destroyables.length; i++) {
+ if (destroyables[i] != null) {
+ IDestroyable destroyable = destroyables[i];
+ if (destroyable != null) {
+ try {
+ destroyable.destroy();
+ } catch (Throwable th) { // NOSONAR. Had to be done to satisfy contracts
+ try {
+ LOGGER.log(Level.WARN, "Failure destroying a destroyable resource", th);
+ } catch (Throwable ignore) {
+ // Do nothing
+ }
+ root = ExceptionUtils.suppress(root, th);
+ }
+ }
+ }
+ }
+ return root;
+ }
+
+ /**
+ * Close the IFrameWriter and suppress any Throwable thrown by the close call.
+ * This method must NEVER throw any Throwable
+ *
+ * @param writer
+ * the writer to close
+ * @param root
+ * the first exception encountered during release of resources
+ * @return the root Throwable if not null or a new Throwable if any was thrown, otherwise, it returns null
+ */
+ public static Throwable close(IFrameWriter writer, Throwable root) {
+ if (writer != null) {
+ try {
+ writer.close();
+ } catch (Throwable th) { // NOSONAR Will be re-thrown
+ try {
+ LOGGER.log(Level.WARN, "Failure closing a closeable resource", th);
+ } catch (Throwable loggingFailure) {
+ // Do nothing
+ }
+ root = ExceptionUtils.suppress(root, th);
+ }
+ }
+ return root;
+ }
+
+ /**
+ * Fail the IFrameWriter and suppress any Throwable thrown by the fail call.
+ * This method must NEVER throw any Throwable
+ *
+ * @param writer
+ * the writer to fail
+ * @param root
+ * the root failure
+ */
+ public static void fail(IFrameWriter writer, Throwable root) {
+ try {
+ writer.fail();
+ } catch (Throwable th) { // NOSONAR Will be re-thrown
+ try {
+ LOGGER.log(Level.WARN, "Failure failing " + writer.getClass().getSimpleName(), th);
+ } catch (Throwable loggingFailure) {
+ // Do nothing
+ }
+ root.addSuppressed(th);
+ }
+ }
+}
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/DestroyUtils.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/DestroyUtils.java
deleted file mode 100644
index 97c284d..0000000
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/DestroyUtils.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.hyracks.api.util;
-
-import org.apache.hyracks.api.dataflow.IDestroyable;
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-public class DestroyUtils {
-
- private static final Logger LOGGER = LogManager.getLogger();
-
- private DestroyUtils() {
- }
-
- public static Throwable destroy(Throwable root, IDestroyable... destroyables) {
- for (int i = 0; i < destroyables.length; i++) {
- if (destroyables[i] != null) {
- IDestroyable destroyable = destroyables[i];
- if (destroyable != null) {
- try {
- destroyable.destroy();
- } catch (Throwable th) { // NOSONAR. Had to be done to satisfy contracts
- try {
- LOGGER.log(Level.WARN, "Failure destroying a destroyable resource", th);
- } catch (Throwable ignore) {
- // Do nothing
- }
- root = ExceptionUtils.suppress(root, th);
- }
- }
- }
- }
- return root;
- }
-}
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTreeOpContext.java b/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTreeOpContext.java
index 60fa145..96370fe 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTreeOpContext.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTreeOpContext.java
@@ -24,7 +24,7 @@
import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory;
import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.api.util.DestroyUtils;
+import org.apache.hyracks.api.util.CleanupUtils;
import org.apache.hyracks.dataflow.common.comm.io.ArrayTupleBuilder;
import org.apache.hyracks.dataflow.common.comm.io.ArrayTupleReference;
import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
@@ -392,7 +392,7 @@
return;
}
destroyed = true;
- Throwable failure = DestroyUtils.destroy(null, accessor, cursor);
+ Throwable failure = CleanupUtils.destroy(null, accessor, cursor);
if (failure != null) {
throw HyracksDataException.create(failure);
}
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/IndexSearchOperatorNodePushable.java b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/IndexSearchOperatorNodePushable.java
index f562379..ab9359f 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/IndexSearchOperatorNodePushable.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/IndexSearchOperatorNodePushable.java
@@ -29,7 +29,7 @@
import org.apache.hyracks.api.dataflow.value.RecordDescriptor;
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.api.job.profiling.IOperatorStats;
-import org.apache.hyracks.api.util.DestroyUtils;
+import org.apache.hyracks.api.util.CleanupUtils;
import org.apache.hyracks.api.util.ExceptionUtils;
import org.apache.hyracks.control.common.job.profiling.OperatorStats;
import org.apache.hyracks.dataflow.common.comm.io.ArrayTupleBuilder;
@@ -252,7 +252,7 @@
@Override
public void close() throws HyracksDataException {
Throwable failure = releaseResources();
- failure = ResourceReleaseUtils.close(writer, failure);
+ failure = CleanupUtils.close(writer, failure);
if (failure != null) {
throw HyracksDataException.create(failure);
}
@@ -281,7 +281,7 @@
}
}
failure = ResourceReleaseUtils.close(cursor, failure);
- failure = DestroyUtils.destroy(failure, cursor, indexAccessor);
+ failure = CleanupUtils.destroy(failure, cursor, indexAccessor);
failure = ResourceReleaseUtils.close(indexHelper, failure);
}
return failure;
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorNodePushable.java b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorNodePushable.java
index 90b50c6..d5ea8bc 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorNodePushable.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorNodePushable.java
@@ -24,6 +24,7 @@
import org.apache.hyracks.api.comm.VSizeFrame;
import org.apache.hyracks.api.context.IHyracksTaskContext;
import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.util.CleanupUtils;
import org.apache.hyracks.api.util.ExceptionUtils;
import org.apache.hyracks.dataflow.common.comm.io.ArrayTupleBuilder;
import org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender;
@@ -39,7 +40,6 @@
import org.apache.hyracks.storage.am.common.impls.IndexAccessParameters;
import org.apache.hyracks.storage.am.common.impls.NoOpOperationCallback;
import org.apache.hyracks.storage.am.common.impls.TreeIndexDiskOrderScanCursor;
-import org.apache.hyracks.storage.am.common.util.ResourceReleaseUtils;
import org.apache.hyracks.storage.common.IIndexAccessParameters;
import org.apache.hyracks.storage.common.ISearchOperationCallback;
import org.apache.hyracks.storage.common.LocalResource;
@@ -74,7 +74,7 @@
failure = ExceptionUtils.suppress(failure, failFailure);
}
} finally {
- failure = ResourceReleaseUtils.close(writer, failure);
+ failure = CleanupUtils.close(writer, failure);
}
if (failure != null) {
throw HyracksDataException.create(failure);
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/util/ResourceReleaseUtils.java b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/util/ResourceReleaseUtils.java
index 50b6e59..b597b60 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/util/ResourceReleaseUtils.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/util/ResourceReleaseUtils.java
@@ -20,7 +20,6 @@
import java.util.List;
-import org.apache.hyracks.api.comm.IFrameWriter;
import org.apache.hyracks.api.util.ExceptionUtils;
import org.apache.hyracks.storage.am.common.api.IIndexDataflowHelper;
import org.apache.hyracks.storage.common.IIndexCursor;
@@ -129,30 +128,4 @@
}
return root;
}
-
- /**
- * Close the IFrameWriter and suppress any Throwable thrown by the close call.
- * This method must NEVER throw any Throwable
- *
- * @param writer
- * the writer to close
- * @param root
- * the first exception encountered during release of resources
- * @return the root Throwable if not null or a new Throwable if any was thrown, otherwise, it returns null
- */
- public static Throwable close(IFrameWriter writer, Throwable root) {
- if (writer != null) {
- try {
- writer.close();
- } catch (Throwable th) { // NOSONAR Will be re-thrown
- try {
- LOGGER.log(Level.WARN, "Failure closing a closeable resource", th);
- } catch (Throwable loggingFailure) {
- // Do nothing
- }
- root = ExceptionUtils.suppress(root, th);
- }
- }
- return root;
- }
}
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeDiskComponentScanCursor.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeDiskComponentScanCursor.java
index dacd41f..a120296 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeDiskComponentScanCursor.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeDiskComponentScanCursor.java
@@ -20,7 +20,7 @@
package org.apache.hyracks.storage.am.lsm.btree.impls;
import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.api.util.DestroyUtils;
+import org.apache.hyracks.api.util.CleanupUtils;
import org.apache.hyracks.api.util.ExceptionUtils;
import org.apache.hyracks.data.std.api.IValueReference;
import org.apache.hyracks.data.std.primitive.BooleanPointable;
@@ -178,7 +178,7 @@
Throwable failure = null;
if (lsmHarness != null) {
if (rangeCursors != null) {
- failure = DestroyUtils.destroy(failure, rangeCursors);
+ failure = CleanupUtils.destroy(failure, rangeCursors);
rangeCursors = null;
}
try {
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeOpContext.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeOpContext.java
index 7795075..7969ba3 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeOpContext.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeOpContext.java
@@ -23,7 +23,7 @@
import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory;
import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.api.util.DestroyUtils;
+import org.apache.hyracks.api.util.CleanupUtils;
import org.apache.hyracks.storage.am.btree.api.IBTreeLeafFrame;
import org.apache.hyracks.storage.am.btree.impls.BTree;
import org.apache.hyracks.storage.am.btree.impls.BTreeOpContext;
@@ -186,9 +186,9 @@
return;
}
destroyed = true;
- Throwable failure = DestroyUtils.destroy(null, mutableBTreeAccessors);
- failure = DestroyUtils.destroy(failure, mutableBTreeOpCtxs);
- failure = DestroyUtils.destroy(failure, insertSearchCursor, memCursor);
+ Throwable failure = CleanupUtils.destroy(null, mutableBTreeAccessors);
+ failure = CleanupUtils.destroy(failure, mutableBTreeOpCtxs);
+ failure = CleanupUtils.destroy(failure, insertSearchCursor, memCursor);
if (failure != null) {
throw HyracksDataException.create(failure);
}
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeRangeSearchCursor.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeRangeSearchCursor.java
index d8feab1..0cb7d1c 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeRangeSearchCursor.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeRangeSearchCursor.java
@@ -23,7 +23,7 @@
import java.util.PriorityQueue;
import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.api.util.DestroyUtils;
+import org.apache.hyracks.api.util.CleanupUtils;
import org.apache.hyracks.dataflow.common.comm.io.ArrayTupleBuilder;
import org.apache.hyracks.dataflow.common.comm.io.ArrayTupleReference;
import org.apache.hyracks.dataflow.common.utils.TupleUtils;
@@ -341,8 +341,8 @@
btreeAccessors = new BTreeAccessor[numBTrees];
} else if (rangeCursors.length != numBTrees) {
// should destroy first
- Throwable failure = DestroyUtils.destroy(null, btreeAccessors);
- failure = DestroyUtils.destroy(failure, rangeCursors);
+ Throwable failure = CleanupUtils.destroy(null, btreeAccessors);
+ failure = CleanupUtils.destroy(failure, rangeCursors);
if (failure != null) {
throw HyracksDataException.create(failure);
}
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexOpContext.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexOpContext.java
index cf95f78..1fe4bd2 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexOpContext.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexOpContext.java
@@ -23,7 +23,7 @@
import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory;
import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.api.util.DestroyUtils;
+import org.apache.hyracks.api.util.CleanupUtils;
import org.apache.hyracks.storage.am.common.impls.NoOpIndexAccessParameters;
import org.apache.hyracks.storage.am.common.tuples.PermutingTupleReference;
import org.apache.hyracks.storage.am.lsm.common.api.ILSMIndex;
@@ -103,8 +103,8 @@
return;
}
destroyed = true;
- Throwable failure = DestroyUtils.destroy(null, mutableInvIndexAccessors);
- failure = DestroyUtils.destroy(failure, deletedKeysBTreeAccessors);
+ Throwable failure = CleanupUtils.destroy(null, mutableInvIndexAccessors);
+ failure = CleanupUtils.destroy(failure, deletedKeysBTreeAccessors);
if (failure != null) {
throw HyracksDataException.create(failure);
}
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeOpContext.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeOpContext.java
index c3c74b8..858f6e0 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeOpContext.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeOpContext.java
@@ -23,7 +23,7 @@
import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory;
import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.api.util.DestroyUtils;
+import org.apache.hyracks.api.util.CleanupUtils;
import org.apache.hyracks.storage.am.btree.impls.BTree;
import org.apache.hyracks.storage.am.btree.impls.BTreeOpContext;
import org.apache.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
@@ -138,10 +138,10 @@
return;
}
destroyed = true;
- Throwable failure = DestroyUtils.destroy(null, mutableRTreeAccessors);
- failure = DestroyUtils.destroy(failure, rtreeOpContexts);
- failure = DestroyUtils.destroy(failure, mutableBTreeAccessors);
- failure = DestroyUtils.destroy(failure, btreeOpContexts);
+ Throwable failure = CleanupUtils.destroy(null, mutableRTreeAccessors);
+ failure = CleanupUtils.destroy(failure, rtreeOpContexts);
+ failure = CleanupUtils.destroy(failure, mutableBTreeAccessors);
+ failure = CleanupUtils.destroy(failure, btreeOpContexts);
if (failure != null) {
throw HyracksDataException.create(failure);
}