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 2018/06/01 12:44:51 UTC
[23/26] asterixdb git commit: [NO ISSUE][STO] Only delete allocated
components
[NO ISSUE][STO] Only delete allocated components
Change-Id: I372127a0dec21148efa1a94cf6c976818963d761
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2671
Sonar-Qube: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: abdullah alamoudi <ba...@gmail.com>
Reviewed-by: Murtadha Hubail <mh...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/10cd136f
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/10cd136f
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/10cd136f
Branch: refs/heads/master
Commit: 10cd136fe6ae102bb5cdce41f57b9f4503a329e8
Parents: 683c06d
Author: Abdullah Alamoudi <ba...@gmail.com>
Authored: Wed May 30 03:00:22 2018 +0300
Committer: abdullah alamoudi <ba...@gmail.com>
Committed: Wed May 30 18:32:56 2018 -0700
----------------------------------------------------------------------
.../storage/am/lsm/common/impls/LSMHarness.java | 28 +++++++++++++-------
1 file changed, 18 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10cd136f/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMHarness.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMHarness.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMHarness.java
index 59f48d4..644508e 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMHarness.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMHarness.java
@@ -829,19 +829,24 @@ public class LSMHarness implements ILSMHarness {
throws HyracksDataException {
BlockingIOOperationCallbackWrapper ioCallback =
new BlockingIOOperationCallbackWrapper(lsmIndex.getIOOperationCallback());
- boolean deleteMemoryComponent;
+ boolean deleteMemoryComponent = false;
synchronized (opTracker) {
waitForFlushesAndMerges();
ensureNoFailedFlush();
- // We always start with the memory component
- ILSMMemoryComponent memComponent = lsmIndex.getCurrentMemoryComponent();
- deleteMemoryComponent = predicate.test(memComponent);
- if (deleteMemoryComponent) {
- // schedule a delete for flushed component
- ctx.reset();
- ctx.setOperation(IndexOperation.DELETE_MEMORY_COMPONENT);
- // ScheduleFlush is actually a try operation
- scheduleFlush(ctx, ioCallback);
+ if (lsmIndex.isMemoryComponentsAllocated()) {
+ // We always start with the memory component
+ ILSMMemoryComponent memComponent = lsmIndex.getCurrentMemoryComponent();
+ deleteMemoryComponent = predicate.test(memComponent);
+ if (deleteMemoryComponent) {
+ // schedule a delete for flushed component
+ ctx.reset();
+ ctx.setOperation(IndexOperation.DELETE_MEMORY_COMPONENT);
+ // ScheduleFlush is actually a try operation
+ scheduleFlush(ctx, ioCallback);
+ } else {
+ // shouldn't try to delete disk components while memory component is still there
+ return;
+ }
}
}
// Here, we are releasing the opTracker to allow other operations:
@@ -862,6 +867,9 @@ public class LSMHarness implements ILSMHarness {
for (ILSMDiskComponent component : diskComponents) {
if (predicate.test(component)) {
ctx.getComponentsToBeMerged().add(component);
+ } else {
+ // can't delete components while newer ones are still there
+ break;
}
}
if (ctx.getComponentsToBeMerged().isEmpty()) {