Luo Chen has submitted this change and it was merged.

Change subject: [ASTERIXDB-2467][STO] Fix locking protocol with bad tuples
......................................................................


[ASTERIXDB-2467][STO] Fix locking protocol with bad tuples

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

Details:
- The current locking protocol is not correct when there are bad tuples,
e.g., duplicates. When locking fails, the write must push partial frames
so that the previous acquired locks are released. However, if there are
bad tuples in the frame, after bad tuples are removed from the frame, the
state of pushed partial frames will be completely lost.

Change-Id: I86baa1f21ef7390777c8e2b0ce226095528e7f18
Reviewed-on: https://asterix-gerrit.ics.uci.edu/3003
Reviewed-by: Xikui Wang <[email protected]>
Sonar-Qube: Jenkins <[email protected]>
Tested-by: Jenkins <[email protected]>
Integration-Tests: Jenkins <[email protected]>
Reviewed-by: Murtadha Hubail <[email protected]>
---
M 
asterixdb/asterix-common/src/main/java/org/apache/asterix/common/dataflow/LSMInsertDeleteOperatorNodePushable.java
1 file changed, 7 insertions(+), 4 deletions(-)

Approvals:
  Anon. E. Moose #1000171: 
  Xikui Wang: Looks good to me, but someone else must approve
  Jenkins: Verified; No violations found; Verified
  Murtadha Hubail: Looks good to me, approved



diff --git 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/dataflow/LSMInsertDeleteOperatorNodePushable.java
 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/dataflow/LSMInsertDeleteOperatorNodePushable.java
index 1401c0a..5e4b5a1 100644
--- 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/dataflow/LSMInsertDeleteOperatorNodePushable.java
+++ 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/dataflow/LSMInsertDeleteOperatorNodePushable.java
@@ -80,6 +80,10 @@
 
     @Override
     public void open() throws HyracksDataException {
+        i = 0;
+        currentTupleIdx = 0;
+        lastFlushedTupleIdx = 0;
+        flushedPartialTuples = false;
         accessor = new FrameTupleAccessor(inputRecDesc);
         writeBuffer = new VSizeFrame(ctx);
         appender = new FrameTupleAppender(writeBuffer);
@@ -109,10 +113,6 @@
 
     @Override
     public void nextFrame(ByteBuffer buffer) throws HyracksDataException {
-        currentTupleIdx = 0;
-        lastFlushedTupleIdx = 0;
-        flushedPartialTuples = false;
-
         accessor.reset(buffer);
         ILSMIndexAccessor lsmAccessor = (ILSMIndexAccessor) indexAccessor;
         int tupleCount = accessor.getTupleCount();
@@ -164,6 +164,9 @@
             FrameUtils.flushFrame(writeBuffer.getBuffer(), writer);
         }
         i = 0;
+        currentTupleIdx = 0;
+        lastFlushedTupleIdx = 0;
+        flushedPartialTuples = false;
     }
 
     /**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I86baa1f21ef7390777c8e2b0ce226095528e7f18
Gerrit-PatchSet: 3
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Luo Chen <[email protected]>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Ian Maxon <[email protected]>
Gerrit-Reviewer: Jenkins <[email protected]>
Gerrit-Reviewer: Luo Chen <[email protected]>
Gerrit-Reviewer: Murtadha Hubail <[email protected]>
Gerrit-Reviewer: Xikui Wang <[email protected]>

Reply via email to