>From Michael Blow <[email protected]>:

Michael Blow has submitted this change. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19451 )

Change subject: [NO ISSUE][HYR][STO] Introduce new modification op type to 
disregard cache budget
......................................................................

[NO ISSUE][HYR][STO] Introduce new modification op type to disregard cache 
budget

+= BUDGET_FREE_MODIFICATION opType to allow an LSM modification to
proceed despite the buffer cache being full.

Ext-ref: MB-65412
Change-Id: I62ecc294e8846bdf5a38652955bdbe8b62a7a1a9
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19451
Integration-Tests: Jenkins <[email protected]>
Tested-by: Jenkins <[email protected]>
Reviewed-by: Michael Blow <[email protected]>
Reviewed-by: Ali Alsuliman <[email protected]>
---
M 
hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMMemoryComponent.java
M 
hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/LSMOperationType.java
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
M 
hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMDiskComponent.java
5 files changed, 51 insertions(+), 7 deletions(-)

Approvals:
  Michael Blow: Looks good to me, but someone else must approve
  Ali Alsuliman: Looks good to me, approved
  Jenkins: Verified; 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 34bc587..33929ad 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
@@ -89,7 +89,8 @@
     public void beforeOperation(ILSMIndex index, LSMOperationType opType, 
ISearchOperationCallback searchCallback,
             IModificationOperationCallback modificationCallback) throws 
HyracksDataException {
         super.beforeOperation(index, opType, searchCallback, 
modificationCallback);
-        if (opType == LSMOperationType.MODIFICATION || opType == 
LSMOperationType.FORCE_MODIFICATION) {
+        if (opType == LSMOperationType.MODIFICATION || opType == 
LSMOperationType.FORCE_MODIFICATION
+                || opType == LSMOperationType.BUDGET_FREE_MODIFICATION) {
             incrementNumActiveOperations(modificationCallback);
         }
     }
@@ -99,7 +100,8 @@
             ISearchOperationCallback searchCallback, 
IModificationOperationCallback modificationCallback)
             throws HyracksDataException {
         super.completeOperation(index, opType, searchCallback, 
modificationCallback);
-        if (opType == LSMOperationType.MODIFICATION || opType == 
LSMOperationType.FORCE_MODIFICATION) {
+        if (opType == LSMOperationType.MODIFICATION || opType == 
LSMOperationType.FORCE_MODIFICATION
+                || opType == LSMOperationType.BUDGET_FREE_MODIFICATION) {
             decrementNumActiveOperations(modificationCallback);
             flushIfNeeded();
         }
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/LSMOperationType.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/LSMOperationType.java
index e200bfd..52a4f94 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/LSMOperationType.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/LSMOperationType.java
@@ -26,5 +26,6 @@
     FLUSH,
     MERGE,
     REPLICATE,
-    DISK_COMPONENT_SCAN
+    DISK_COMPONENT_SCAN,
+    BUDGET_FREE_MODIFICATION
 }
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMDiskComponent.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMDiskComponent.java
index baf0931..627b853 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMDiskComponent.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMDiskComponent.java
@@ -79,6 +79,7 @@
         switch (opType) {
             case FORCE_MODIFICATION:
             case MODIFICATION:
+            case BUDGET_FREE_MODIFICATION:
             case REPLICATE:
             case SEARCH:
             case DISK_COMPONENT_SCAN:
@@ -107,6 +108,7 @@
                 break;
             case FORCE_MODIFICATION:
             case MODIFICATION:
+            case BUDGET_FREE_MODIFICATION:
             case REPLICATE:
             case SEARCH:
             case DISK_COMPONENT_SCAN:
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMMemoryComponent.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMMemoryComponent.java
index 919dc60..77c5ec2 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMMemoryComponent.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMMemoryComponent.java
@@ -110,6 +110,24 @@
                     }
                 }
                 break;
+            case BUDGET_FREE_MODIFICATION:
+                if (isMutableComponent) {
+                    if (state == ComponentState.READABLE_WRITABLE) {
+                        // Even when the memory component has the writable 
state, vbc may be temporarily full
+                        // or this memory component may be full.
+                        writerCount++;
+                    } else {
+                        return false;
+                    }
+                } else {
+                    if (state == ComponentState.READABLE_UNWRITABLE
+                            || state == 
ComponentState.READABLE_UNWRITABLE_FLUSHING) {
+                        readerCount++;
+                    } else {
+                        return false;
+                    }
+                }
+                break;
             case MODIFICATION:
                 if (isMutableComponent) {
                     if (state == ComponentState.READABLE_WRITABLE && 
!vbc.isFull(this) && !vbc.isFull()) {
@@ -161,6 +179,7 @@
         boolean cleanup = false;
         switch (opType) {
             case FORCE_MODIFICATION:
+            case BUDGET_FREE_MODIFICATION:
             case MODIFICATION:
                 if (isMutableComponent) {
                     writerCount--;
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 d019a08..6e7681d 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
@@ -220,8 +220,9 @@
                     LOGGER.warn("Failure exiting components", e);
                     throw e;
                 } finally {
-                    if (failedOperation && (opType == 
LSMOperationType.MODIFICATION
-                            || opType == LSMOperationType.FORCE_MODIFICATION)) 
{
+                    if (failedOperation
+                            && (opType == LSMOperationType.MODIFICATION || 
opType == LSMOperationType.FORCE_MODIFICATION
+                                    || opType == 
LSMOperationType.BUDGET_FREE_MODIFICATION)) {
                         //When the operation failed, completeOperation() 
method must be called
                         //in order to decrement active operation count which 
was incremented
                         // in beforeOperation() method.
@@ -331,8 +332,9 @@
             boolean needsCleanup = c.threadExit(opType, failedOperation, 
isMutableComponent);
             if (c.getType() == LSMComponentType.MEMORY) {
                 if (c.getState() == ComponentState.READABLE_UNWRITABLE) {
-                    if (isMutableComponent && (opType == 
LSMOperationType.MODIFICATION
-                            || opType == LSMOperationType.FORCE_MODIFICATION)) 
{
+                    if (isMutableComponent
+                            && (opType == LSMOperationType.MODIFICATION || 
opType == LSMOperationType.FORCE_MODIFICATION
+                                    || opType == 
LSMOperationType.BUDGET_FREE_MODIFICATION)) {
                         
lsmIndex.changeFlushStatusForCurrentMutableCompoent(true);
                     }
                 }

--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19451
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: ionic
Gerrit-Change-Id: I62ecc294e8846bdf5a38652955bdbe8b62a7a1a9
Gerrit-Change-Number: 19451
Gerrit-PatchSet: 4
Gerrit-Owner: Michael Blow <[email protected]>
Gerrit-Reviewer: Ali Alsuliman <[email protected]>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Jenkins <[email protected]>
Gerrit-Reviewer: Michael Blow <[email protected]>
Gerrit-MessageType: merged

Reply via email to