Change in asterixdb[master]: Notify waiting operation on change of component state

2017-05-10 Thread abdullah alamoudi (Code Review)
abdullah alamoudi has submitted this change and it was merged.

Change subject: Notify waiting operation on change of component state
..


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 
Sonar-Qube: Jenkins 
Tested-by: Jenkins 
Integration-Tests: Jenkins 
BAD: Jenkins 
---
M 
asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/PrimaryIndexOperationTracker.java
M 
hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMHarness.java
2 files changed, 12 insertions(+), 7 deletions(-)

Approvals:
  Yingyi Bu: Looks good to me, approved
  Jenkins: Verified; No violations found; No violations found; Verified



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.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 @@
 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);
 }
 }
 }
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 @@
 .getCurrentMutableComponentState() == 
ComponentState.READABLE_UNWRITABLE) {
 ((AbstractLSMIndex) lsmIndex)
 
.setCurrentMutableComponentState(ComponentState.READABLE_WRITABLE);
+opTracker.notifyAll();
 }
 return false;
 }
@@ -367,7 +368,9 @@
 }
 getAndEnterComponents(ctx, LSMOperationType.MODIFICATION, false);
 try {
-lsmIndex.getCurrentMemoryComponent().getMetadata().put(key, value);
+AbstractLSMMemoryComponent c = (AbstractLSMMemoryComponent) 
ctx.getComponentHolder().get(0);
+

Change in asterixdb[master]: Notify waiting operation on change of component state

2017-05-10 Thread Jenkins (Code Review)
Jenkins has posted comments on this change.

Change subject: Notify waiting operation on change of component state
..


Patch Set 1: BAD+1

BAD Compatibility Tests Successful

https://asterix-jenkins.ics.uci.edu/job/asterixbad-compat/1135/ : SUCCESS

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1733
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6fe0aa0323a70a2702a9310339abc68ab5cf14c7
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi 
Gerrit-Reviewer: Jenkins 
Gerrit-Reviewer: Yingyi Bu 
Gerrit-HasComments: No


Change in asterixdb[master]: Notify waiting operation on change of component state

2017-05-10 Thread Jenkins (Code Review)
Jenkins has posted comments on this change.

Change subject: Notify waiting operation on change of component state
..


Patch Set 1: Integration-Tests+1

Integration Tests Successful

https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-integration-tests/2750/ 
: SUCCESS

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1733
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6fe0aa0323a70a2702a9310339abc68ab5cf14c7
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi 
Gerrit-Reviewer: Jenkins 
Gerrit-Reviewer: Yingyi Bu 
Gerrit-HasComments: No


Change in asterixdb[master]: Notify waiting operation on change of component state

2017-05-10 Thread Jenkins (Code Review)
Jenkins has posted comments on this change.

Change subject: Notify waiting operation on change of component state
..


Patch Set 1:

BAD Compatibility Tests Started 
https://asterix-jenkins.ics.uci.edu/job/asterixbad-compat/1135/

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1733
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6fe0aa0323a70a2702a9310339abc68ab5cf14c7
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi 
Gerrit-Reviewer: Jenkins 
Gerrit-Reviewer: Yingyi Bu 
Gerrit-HasComments: No


Change in asterixdb[master]: Notify waiting operation on change of component state

2017-05-10 Thread Yingyi Bu (Code Review)
Yingyi Bu has posted comments on this change.

Change subject: Notify waiting operation on change of component state
..


Patch Set 1: Code-Review+2

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1733
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6fe0aa0323a70a2702a9310339abc68ab5cf14c7
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi 
Gerrit-Reviewer: Jenkins 
Gerrit-Reviewer: Yingyi Bu 
Gerrit-HasComments: No


Change in asterixdb[master]: Notify waiting operation on change of component state

2017-05-10 Thread Jenkins (Code Review)
Jenkins has posted comments on this change.

Change subject: Notify waiting operation on change of component state
..


Patch Set 1:

Build Started 
https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-sonar/3759/ (6/6)

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1733
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6fe0aa0323a70a2702a9310339abc68ab5cf14c7
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi 
Gerrit-Reviewer: Jenkins 
Gerrit-Reviewer: Yingyi Bu 
Gerrit-HasComments: No


Change in asterixdb[master]: Notify waiting operation on change of component state

2017-05-10 Thread Jenkins (Code Review)
Jenkins has posted comments on this change.

Change subject: Notify waiting operation on change of component state
..


Patch Set 1:

Integration Tests Started 
https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-integration-tests/2750/

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1733
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6fe0aa0323a70a2702a9310339abc68ab5cf14c7
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi 
Gerrit-Reviewer: Jenkins 
Gerrit-Reviewer: Yingyi Bu 
Gerrit-HasComments: No


Change in asterixdb[master]: Notify waiting operation on change of component state

2017-05-10 Thread Jenkins (Code Review)
Jenkins has posted comments on this change.

Change subject: Notify waiting operation on change of component state
..


Patch Set 1:

Build Started 
https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-verify-asterix-app/370/ 
(6/6)

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1733
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6fe0aa0323a70a2702a9310339abc68ab5cf14c7
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi 
Gerrit-Reviewer: Jenkins 
Gerrit-Reviewer: Yingyi Bu 
Gerrit-HasComments: No


Change in asterixdb[master]: Notify waiting operation on change of component state

2017-05-10 Thread Jenkins (Code Review)
Jenkins has posted comments on this change.

Change subject: Notify waiting operation on change of component state
..


Patch Set 1:

Build Started 
https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-sonar/3756/ (5/6)

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1733
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6fe0aa0323a70a2702a9310339abc68ab5cf14c7
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi 
Gerrit-Reviewer: Jenkins 
Gerrit-Reviewer: Yingyi Bu 
Gerrit-HasComments: No


Change in asterixdb[master]: Notify waiting operation on change of component state

2017-05-10 Thread Jenkins (Code Review)
Jenkins has posted comments on this change.

Change subject: Notify waiting operation on change of component state
..


Patch Set 1:

Build Started 
https://asterix-jenkins.ics.uci.edu/job/asterix-verify-storage/292/ (4/6)

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1733
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6fe0aa0323a70a2702a9310339abc68ab5cf14c7
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi 
Gerrit-Reviewer: Jenkins 
Gerrit-Reviewer: Yingyi Bu 
Gerrit-HasComments: No


Change in asterixdb[master]: Notify waiting operation on change of component state

2017-05-10 Thread Jenkins (Code Review)
Jenkins has posted comments on this change.

Change subject: Notify waiting operation on change of component state
..


Patch Set 1:

Build Started 
https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-notopic/5233/ (3/6)

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1733
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6fe0aa0323a70a2702a9310339abc68ab5cf14c7
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi 
Gerrit-Reviewer: Jenkins 
Gerrit-Reviewer: Yingyi Bu 
Gerrit-HasComments: No


Change in asterixdb[master]: Notify waiting operation on change of component state

2017-05-10 Thread Jenkins (Code Review)
Jenkins has posted comments on this change.

Change subject: Notify waiting operation on change of component state
..


Patch Set 1:

Build Started 
https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-asterix-app/553/ (2/6)

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1733
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6fe0aa0323a70a2702a9310339abc68ab5cf14c7
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi 
Gerrit-Reviewer: Jenkins 
Gerrit-Reviewer: Yingyi Bu 
Gerrit-HasComments: No


Change in asterixdb[master]: Notify waiting operation on change of component state

2017-05-10 Thread Jenkins (Code Review)
Jenkins has posted comments on this change.

Change subject: Notify waiting operation on change of component state
..


Patch Set 1:

WARNING: THIS CHANGE CONTAINS CROSS-PRODUCT CHANGES IN:
* asterixdb
* hyracks-fullstack

PLEASE REVIEW CAREFULLY AND LOOK FOR API CHANGES!

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1733
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6fe0aa0323a70a2702a9310339abc68ab5cf14c7
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi 
Gerrit-Reviewer: Jenkins 
Gerrit-Reviewer: Yingyi Bu 
Gerrit-HasComments: No


Change in asterixdb[master]: Notify waiting operation on change of component state

2017-05-10 Thread Jenkins (Code Review)
Jenkins has posted comments on this change.

Change subject: Notify waiting operation on change of component state
..


Patch Set 1:

Build Started 
https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-verify-no-installer-app/367/
 (1/6)

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1733
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6fe0aa0323a70a2702a9310339abc68ab5cf14c7
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi 
Gerrit-Reviewer: Jenkins 
Gerrit-Reviewer: Yingyi Bu 
Gerrit-HasComments: No


Change in asterixdb[master]: Notify waiting operation on change of component state

2017-05-10 Thread abdullah alamoudi (Code Review)
abdullah alamoudi has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/1733

Change subject: Notify waiting operation on change of component state
..

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
---
M 
asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/PrimaryIndexOperationTracker.java
M 
hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMHarness.java
2 files changed, 12 insertions(+), 7 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/33/1733/1

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.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 @@
 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);
 }
 }
 }
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 @@
 .getCurrentMutableComponentState() == 
ComponentState.READABLE_UNWRITABLE) {
 ((AbstractLSMIndex) lsmIndex)
 
.setCurrentMutableComponentState(ComponentState.READABLE_WRITABLE);
+opTracker.notifyAll();
 }
 return false;
 }
@@ -367,7 +368,9 @@
 }
 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 @@
 }
 getAndEnterComponents(ctx, LSMOperationType.FORCE_MODIFICATION, false);
 try {
-