From commits-return-4909-archive-asf-public=cust-asf.ponee.io@asterixdb.apache.org Sat Jan 27 02:17:00 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id D7803180657 for ; Sat, 27 Jan 2018 02:17:00 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id C7837160C2E; Sat, 27 Jan 2018 01:17:00 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 240CF160C50 for ; Sat, 27 Jan 2018 02:16:59 +0100 (CET) Received: (qmail 25810 invoked by uid 500); 27 Jan 2018 01:16:59 -0000 Mailing-List: contact commits-help@asterixdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@asterixdb.apache.org Delivered-To: mailing list commits@asterixdb.apache.org Received: (qmail 25801 invoked by uid 99); 27 Jan 2018 01:16:59 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 27 Jan 2018 01:16:59 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id DF6D7DFF4D; Sat, 27 Jan 2018 01:16:57 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: amoudi@apache.org To: commits@asterixdb.apache.org Message-Id: <800c5cc01257450fb8f8bd5d8769dc81@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: asterixdb git commit: [NO ISSUE][ING] Only delete records if found Date: Sat, 27 Jan 2018 01:16:57 +0000 (UTC) Repository: asterixdb Updated Branches: refs/heads/master 61cb03102 -> de7660714 [NO ISSUE][ING] Only delete records if found - user model changes: no - storage format changes: no - interface changes: no details: - Previously, change feeds that perform upserts and deletes used to blindly upsert a record for upserts and upsert an anti-matter for deletes in the absense of secondary indexes or filters. - This lead to size blow out when there are a lot of deletes for keys that don't have values in the index. - In this change, we only apply deletes strictly when a prevous value with the same key is found. Change-Id: Iac32ef87f9da2725bc1b6381a65dba6390b0d3ae Reviewed-on: https://asterix-gerrit.ics.uci.edu/2327 Sonar-Qube: Jenkins Tested-by: Jenkins Contrib: Jenkins Integration-Tests: Jenkins Reviewed-by: Till Westmann Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/de766071 Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/de766071 Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/de766071 Branch: refs/heads/master Commit: de7660714f467395c7733c94d9656fde912ffbbe Parents: 61cb031 Author: Abdullah Alamoudi Authored: Fri Jan 26 13:31:58 2018 -0800 Committer: abdullah alamoudi Committed: Fri Jan 26 17:16:42 2018 -0800 ---------------------------------------------------------------------- .../operators/LSMPrimaryUpsertOperatorNodePushable.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/asterixdb/blob/de766071/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/LSMPrimaryUpsertOperatorNodePushable.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/LSMPrimaryUpsertOperatorNodePushable.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/LSMPrimaryUpsertOperatorNodePushable.java index 0d74e30..21259cc 100644 --- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/LSMPrimaryUpsertOperatorNodePushable.java +++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/LSMPrimaryUpsertOperatorNodePushable.java @@ -136,8 +136,9 @@ public class LSMPrimaryUpsertOperatorNodePushable extends LSMIndexInsertUpdateDe tb.reset(); boolean recordWasInserted = false; boolean recordWasDeleted = false; + boolean isDelete = isDeleteOperation(tuple, numOfPrimaryKeys); resetSearchPredicate(index); - if (isFiltered || hasSecondaries) { + if (isFiltered || isDelete || hasSecondaries) { lsmAccessor.search(cursor, searchPred); if (cursor.hasNext()) { cursor.next(); @@ -154,12 +155,13 @@ public class LSMPrimaryUpsertOperatorNodePushable extends LSMIndexInsertUpdateDe searchCallback.before(key); // lock appendPreviousTupleAsMissing(); } - if (isDeleteOperation(tuple, numOfPrimaryKeys)) { + if (isDelete && prevTuple != null) { // Only delete if it is a delete and not upsert + // And previous tuple with the same key was found abstractModCallback.setOp(Operation.DELETE); lsmAccessor.forceDelete(tuple); recordWasDeleted = true; - } else { + } else if (!isDelete) { abstractModCallback.setOp(Operation.UPSERT); lsmAccessor.forceUpsert(tuple); recordWasInserted = true;