asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amo...@apache.org
Subject asterixdb git commit: Notify waiting operation on change of component state
Date Wed, 10 May 2017 23:33:47 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master b05958734 -> 47238442d


Notify waiting operation on change of component state

The change fixes a bug in the lsm harness
that could lead to an accessor being blocked on an empty
component because a flush request used to set the state
of all components to unwritable. when the component
state was fixed, no notification was sent to the
waiting operation.

Change-Id: I6fe0aa0323a70a2702a9310339abc68ab5cf14c7
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1733
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
BAD: Jenkins <jenkins@fulliautomatix.ics.uci.edu>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/47238442
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/47238442
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/47238442

Branch: refs/heads/master
Commit: 47238442dc4a8726999c7d87d89a164fcc6e2f47
Parents: b059587
Author: Abdullah Alamoudi <bamousaa@gmail.com>
Authored: Wed May 10 14:17:37 2017 -0700
Committer: abdullah alamoudi <bamousaa@gmail.com>
Committed: Wed May 10 16:33:31 2017 -0700

----------------------------------------------------------------------
 .../common/context/PrimaryIndexOperationTracker.java      | 10 +++++-----
 .../hyracks/storage/am/lsm/common/impls/LSMHarness.java   |  9 +++++++--
 2 files changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/47238442/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/PrimaryIndexOperationTracker.java
----------------------------------------------------------------------
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 7fca039..feeb578 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
@@ -35,9 +35,9 @@ import org.apache.hyracks.storage.am.common.impls.NoOpOperationCallback;
 import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent.ComponentState;
 import org.apache.hyracks.storage.am.lsm.common.api.ILSMIndex;
 import org.apache.hyracks.storage.am.lsm.common.api.ILSMIndexAccessor;
+import org.apache.hyracks.storage.am.lsm.common.api.ILSMMemoryComponent;
 import org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTracker;
 import org.apache.hyracks.storage.am.lsm.common.api.LSMOperationType;
-import org.apache.hyracks.storage.am.lsm.common.impls.AbstractLSMIndex;
 
 public class PrimaryIndexOperationTracker extends BaseOperationTracker {
 
@@ -110,11 +110,11 @@ public class PrimaryIndexOperationTracker extends BaseOperationTracker
{
         if (needsFlush || flushOnExit) {
             //Make the current mutable components READABLE_UNWRITABLE to stop coming modify
operations from entering them until the current flush is scheduled.
             for (ILSMIndex lsmIndex : indexes) {
-                AbstractLSMIndex abstractLSMIndex = ((AbstractLSMIndex) lsmIndex);
-                ILSMOperationTracker opTracker = abstractLSMIndex.getOperationTracker();
+                ILSMOperationTracker opTracker = lsmIndex.getOperationTracker();
                 synchronized (opTracker) {
-                    if (abstractLSMIndex.getCurrentMutableComponentState() == ComponentState.READABLE_WRITABLE)
{
-                        abstractLSMIndex.setCurrentMutableComponentState(ComponentState.READABLE_UNWRITABLE);
+                    ILSMMemoryComponent memComponent = lsmIndex.getCurrentMemoryComponent();
+                    if (memComponent.getState() == ComponentState.READABLE_WRITABLE &&
memComponent.isModified()) {
+                        memComponent.setState(ComponentState.READABLE_UNWRITABLE);
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/47238442/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 494ba27..682e323 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
@@ -88,6 +88,7 @@ public class LSMHarness implements ILSMHarness {
                                     .getCurrentMutableComponentState() == ComponentState.READABLE_UNWRITABLE)
{
                                 ((AbstractLSMIndex) lsmIndex)
                                         .setCurrentMutableComponentState(ComponentState.READABLE_WRITABLE);
+                                opTracker.notifyAll();
                             }
                             return false;
                         }
@@ -367,7 +368,9 @@ public class LSMHarness implements ILSMHarness {
         }
         getAndEnterComponents(ctx, LSMOperationType.MODIFICATION, false);
         try {
-            lsmIndex.getCurrentMemoryComponent().getMetadata().put(key, value);
+            AbstractLSMMemoryComponent c = (AbstractLSMMemoryComponent) ctx.getComponentHolder().get(0);
+            c.getMetadata().put(key, value);
+            c.setModified();
         } finally {
             exitAndComplete(ctx, LSMOperationType.MODIFICATION);
         }
@@ -389,7 +392,9 @@ public class LSMHarness implements ILSMHarness {
         }
         getAndEnterComponents(ctx, LSMOperationType.FORCE_MODIFICATION, false);
         try {
-            lsmIndex.getCurrentMemoryComponent().getMetadata().put(key, value);
+            AbstractLSMMemoryComponent c = (AbstractLSMMemoryComponent) ctx.getComponentHolder().get(0);
+            c.getMetadata().put(key, value);
+            c.setModified();
         } finally {
             exitAndComplete(ctx, LSMOperationType.FORCE_MODIFICATION);
         }


Mime
View raw message