abdullah alamoudi has uploaded a new change for review.
https://asterix-gerrit.ics.uci.edu/1336
Change subject: Fix Upsert to Never Enforce the First Operation
......................................................................
Fix Upsert to Never Enforce the First Operation
Change-Id: I8ec784e2d6ff39758ab701d4f36fc85c278178f2
---
M
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/AsterixLSMPrimaryUpsertOperatorNodePushable.java
1 file changed, 5 insertions(+), 2 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb
refs/changes/36/1336/1
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/AsterixLSMPrimaryUpsertOperatorNodePushable.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/AsterixLSMPrimaryUpsertOperatorNodePushable.java
index 96f9e76..bc646d9 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/AsterixLSMPrimaryUpsertOperatorNodePushable.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/AsterixLSMPrimaryUpsertOperatorNodePushable.java
@@ -185,6 +185,7 @@
accessor.reset(buffer);
LSMTreeIndexAccessor lsmAccessor = (LSMTreeIndexAccessor)
indexAccessor;
int tupleCount = accessor.getTupleCount();
+ boolean firstModification = true;
int i = 0;
try {
while (i < tupleCount) {
@@ -217,8 +218,9 @@
tb.addFieldEndOffset();
}
modCallback.setOp(Operation.DELETE);
- if (i == 0) {
+ if (firstModification) {
lsmAccessor.delete(prevTuple);
+ firstModification = false;
} else {
lsmAccessor.forceDelete(prevTuple);
}
@@ -236,8 +238,9 @@
}
if (!isNull(tuple, numOfPrimaryKeys)) {
modCallback.setOp(Operation.INSERT);
- if ((prevTuple == null) && (i == 0)) {
+ if (firstModification) {
lsmAccessor.insert(tuple);
+ firstModification = false;
} else {
lsmAccessor.forceInsert(tuple);
}
--
To view, visit https://asterix-gerrit.ics.uci.edu/1336
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8ec784e2d6ff39758ab701d4f36fc85c278178f2
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi <[email protected]>