From issues-return-3682-archive-asf-public=cust-asf.ponee.io@phoenix.apache.org Tue Jan 1 19:44:06 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 6B65718066C for ; Tue, 1 Jan 2019 19:44:05 +0100 (CET) Received: (qmail 18548 invoked by uid 500); 1 Jan 2019 18:44:04 -0000 Mailing-List: contact issues-help@phoenix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.apache.org Delivered-To: mailing list issues@phoenix.apache.org Received: (qmail 18536 invoked by uid 99); 1 Jan 2019 18:44:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Jan 2019 18:44:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id B4921180E97 for ; Tue, 1 Jan 2019 18:44:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id dtIQGkO1YRhw for ; Tue, 1 Jan 2019 18:44:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 32CC260F4E for ; Tue, 1 Jan 2019 18:44:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 6BDC1E00E1 for ; Tue, 1 Jan 2019 18:44:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 2A5AF253B4 for ; Tue, 1 Jan 2019 18:44:00 +0000 (UTC) Date: Tue, 1 Jan 2019 18:44:00 +0000 (UTC) From: "Monani Mihir (JIRA)" To: issues@phoenix.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (PHOENIX-5079) PhoenixIndexMetaData.isIndexRebuild gives wrong results in Partial Index Rebuilding MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/PHOENIX-5079?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D16= 731662#comment-16731662 ]=20 Monani Mihir edited comment on PHOENIX-5079 at 1/1/19 6:43 PM: --------------------------------------------------------------- [~vincentpoon] I mean to write "false" instead of "falls".=C2=A0 I have cor= rected JIRA descriptions.=C2=A0 About the previous comment :- Here is the definition of PhoenixIndexMetaData#IsIndexRebuild:- {code:java} public static boolean isIndexRebuild(Map attributes) { return attributes.get(BaseScannerRegionObserver.REPLAY_WRITES) !=3D nul= l; } {code} For Index Rebuilding , we prepare list of mutations (list of put/delete) in= =C2=A0UARO#rebuildIndices. So when i put logs in rebuilder code path, i fou= nd that in Indexer#postBatchMutateIndispensably we pass BatchMutateContext = as list of [indexUpdates|https://github.com/apache/phoenix/blob/master/phoe= nix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java#L573]. I= f you check isIndexUpdate for miniBatchOp and context.indexUpdates, we get = true for miniBatchOp and false for context.indexUpdates.=C2=A0 {code:java} public void postBatchMutateIndispensably(ObserverContext c, MiniBatchOperationInProgress miniBatchOp, final boolean success) = throws IOException { ... BatchMutateContext context =3D getBatchMutateContext(c); ... this.builder.batchCompleted(miniBatchOp); LOG.info("postBatchMutateIndispensably_miniBatchOp isIndexRebuild :- " + Ph= oenixIndexMetaData.isIndexRebuild(miniBatchOp.getOperation(0).getAttributes= Map())); LOG.info("postBatchMutateIndispensably_context isIndexRebuild :- " + Phoeni= xIndexMetaData.isIndexRebuild(context.indexUpdates.iterator().next().getFir= st().getAttributesMap())); if (success) { // if miniBatchOp was successfully written, write index updates doPost(c,= context); } ... {code} =C2=A0 =C2=A0 was (Author: mihir6692): [~vincentpoon] I mean to write "false" instead of "falls".=C2=A0 I have cor= rected JIRA descriptions.=C2=A0 About the previous comment :- Here is the definition of PhoenixIndexMetaData#IsIndexRebuild:- {code:java} public static boolean isIndexRebuild(Map attributes) { return attributes.get(BaseScannerRegionObserver.REPLAY_WRITES) !=3D nul= l; } {code} For Index Rebuilding , we prepare list of mutations (list of put/delete) in= =C2=A0UARO#rebuildIndices. So when i put logs in rebuilder code path, i fou= nd that in Indexer#postBatchMutateIndispensably we pass BatchMutateContext = as list of [indexUpdates|https://github.com/apache/phoenix/blob/master/phoe= nix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java#L573]. I= f you check isIndexUpdate for miniBatchOp and context.indexUpdates, we get = true for miniBatchOp and false for context.indexUpdates.=C2=A0 public void postBatchMutateIndispensably(ObserverContext c, MiniBatchOperationInProgress miniBatchOp, final boolean success) = throws IOException { ... BatchMutateContext context =3D getBatchMutateContext(c); ... this.builder.batchCompleted(miniBatchOp); LOG.info("postBatchMutateIndispensably_miniBatchOp isIndexRebuild :- " = + PhoenixIndexMetaData.isIndexRebuild(miniBatchOp.getOperation(0).getAttrib= utesMap())); LOG.info("postBatchMutateIndispensably_context isIndexRebuild :- " + Ph= oenixIndexMetaData.isIndexRebuild(context.indexUpdates.iterator().next().ge= tFirst().getAttributesMap())); if (success) { // if miniBatchOp was succ= essfully written, write index updates doPost(c, context); }... =C2=A0 =C2=A0 > PhoenixIndexMetaData.isIndexRebuild gives wrong results in Partial Index = Rebuilding > -------------------------------------------------------------------------= ---------- > > Key: PHOENIX-5079 > URL: https://issues.apache.org/jira/browse/PHOENIX-5079 > Project: Phoenix > Issue Type: Bug > Affects Versions: 4.14.1 > Reporter: Monani Mihir > Priority: Minor > > During Partial Rebuild, If rebuilder get index failure (because of region= move/split etc), it will call PhoenixIndexFailurePolicy.handleFailure . He= re it checks if mutations are part of Index Rebuild or not .=C2=A0 > {code:java} > if (!throwing) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SQLException sqlE= xception =3D > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 new SQLExceptionInfo.Builder(SQLExceptionCode.INDEX_WRITE_FAILUR= E) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .setRootCause(cause).setMessage(caus= e.getLocalizedMessage()).build() > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .buildException(); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 IOException ioExc= eption =3D ServerUtil.wrapInDoNotRetryIOException(null, sqlException, times= tamp); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Mutation m =3D attempted.entrie= s().iterator().next().getValue(); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 boolean isIndexRebuild =3D Phoe= nixIndexMetaData.isIndexRebuild(m.getAttributesMap()); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 // Always throw if rebuilding i= ndex since the rebuilder needs to know if it was successful > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (throwIndexWriteFailure || i= sIndexRebuild) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 throw ioException; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } else { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 LOG= .warn("Swallowing index write failure", ioException); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > {code} > Here isIndexRebuild becomes=C2=A0false=C2=A0even though we have set attri= bute for REPLY_WRITE to=C2=A0 > REPLAY_ONLY_INDEX_WRITES=C2=A0 in UngroupedAggregateRegionObserver.rebuil= dIndices=C2=A0 > {code:java} > ... > put.setAttribute(REPLAY_WRITES, REPLAY_ONLY_INDEX_WRITES); > ...{code} > =C2=A0 -- This message was sent by Atlassian JIRA (v7.6.3#76005)