>From Ritik Raj <[email protected]>:

Ritik Raj has uploaded this change for review. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21157?usp=email )


Change subject: [NO ISSUE][STO] Added activeOperation inc/dec method
......................................................................

[NO ISSUE][STO] Added activeOperation inc/dec method

- user model changes: yes
- storage format changes: no
- interface changes: no

Ext-ref: MB-61581

Change-Id: I55abfcc00886350db32bb5ff2d713b68476f8887
---
M 
asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/PrimaryIndexOperationTracker.java
1 file changed, 18 insertions(+), 0 deletions(-)



  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/57/21157/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 33929ad..bb61d03 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
@@ -406,6 +406,24 @@
         return numActiveOperations.get() == 0;
     }

+    /**
+     * Increments numActiveOperations to prevent from scheduling
+     * a flush between exitComponents and close() on a failed ingestion frame.
+     * Must be paired with a corresponding releaseFlushHold() call.
+     */
+    public void holdFlush() {
+        numActiveOperations.incrementAndGet();
+    }
+
+    /**
+     * Releases the hold acquired by holdFlush().
+     */
+    public void releaseFlushHold() {
+        if (numActiveOperations.decrementAndGet() < 0) {
+            throw new IllegalStateException("numActiveOperations cannot be 
negative");
+        }
+    }
+
     public Map<String, FlushOperation> getLastFlushOperation() {
         return lastFlushOperation;
     }

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

Gerrit-MessageType: newchange
Gerrit-Project: asterixdb
Gerrit-Branch: lumina
Gerrit-Change-Id: I55abfcc00886350db32bb5ff2d713b68476f8887
Gerrit-Change-Number: 21157
Gerrit-PatchSet: 1
Gerrit-Owner: Ritik Raj <[email protected]>

Reply via email to