Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 00207200CF3 for ; Tue, 29 Aug 2017 13:38:07 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id F2D43166400; Tue, 29 Aug 2017 11:38:07 +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 4E7CF1663DE for ; Tue, 29 Aug 2017 13:38:07 +0200 (CEST) Received: (qmail 66809 invoked by uid 500); 29 Aug 2017 11:38:06 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 66509 invoked by uid 99); 29 Aug 2017 11:38:06 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 Aug 2017 11:38:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 953DCC2A14 for ; Tue, 29 Aug 2017 11:38:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id RN0S0ZueBINZ for ; Tue, 29 Aug 2017 11:38:04 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 3F3C061268 for ; Tue, 29 Aug 2017 11:38:04 +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 AFC4BE0EEF for ; Tue, 29 Aug 2017 11:38:02 +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 5D71F24177 for ; Tue, 29 Aug 2017 11:38:01 +0000 (UTC) Date: Tue, 29 Aug 2017 11:38:01 +0000 (UTC) From: "Aleksey Yeschenko (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CASSANDRA-13747) Fix AssertionError in short read protection MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 29 Aug 2017 11:38:08 -0000 [ https://issues.apache.org/jira/browse/CASSANDRA-13747?page=3Dcom.atl= assian.jira.plugin.system.issuetabpanels:all-tabpanel ] Aleksey Yeschenko updated CASSANDRA-13747: ------------------------------------------ Resolution: Fixed Fix Version/s: (was: 3.11.x) (was: 3.0.x) 3.11.1 3.0.15 Status: Resolved (was: Patch Available) > Fix AssertionError in short read protection > ------------------------------------------- > > Key: CASSANDRA-13747 > URL: https://issues.apache.org/jira/browse/CASSANDRA-1374= 7 > Project: Cassandra > Issue Type: Bug > Components: Coordination > Reporter: Aleksey Yeschenko > Assignee: Aleksey Yeschenko > Fix For: 3.0.15, 3.11.1 > > > {{ShortReadRowProtection.moreContents()}} expects that by the time we get= to that method, the global post-reconciliation counter was already applied= to the current partition. However, sometimes it won=E2=80=99t get applied,= and the global counter continues counting with {{rowInCurrentPartition}} v= alue not reset from previous partition, which in the most obvious case woul= d trigger the assertion we are observing - {{assert !postReconciliationCoun= ter.isDoneForPartition();}}. In other cases it=E2=80=99s possible because o= f this lack of reset to query a node for too few extra rows, causing unnece= ssary SRP data requests. > Why is the counter not always applied to the current partition? > The merged {{PartitionIterator}} returned from {{DataResolver.resolve()}}= has two transformations applied to it, in the following order: > {{Filter}} - to purge non-live data from partitions, and to discard empty= partitions altogether (except for Thrift) > {{Counter}}, to count and stop iteration > Problem is, {{Filter}} =E2=80=99s {{applyToPartition()}} code that discar= ds empty partitions ({{closeIfEmpty()}} method) would sometimes consume the= iterator, triggering short read protection *before* {{Counter}} =E2=80=99s= {{applyToPartition()}} gets called and resets its {{rowInCurrentPartition}= } sub-counter. > We should not be consuming iterators until all transformations are applie= d to them. For transformations it means that they cannot consume iterators = unless they are the last transformation on the stack. > The linked branch fixes the problem by splitting {{Filter}} into two tran= sformations. The original - {{Filter}} - that does filtering within partiti= ons - and a separate {{EmptyPartitionsDiscarder}}, that discards empty part= itions from {{PartitionIterators}}. Thus {{DataResolve.resolve()}}, when co= nstructing its {{PartitionIterator}}, now does merge first, then applies {{= Filter}}, then {{Counter}}, and only then, as its last (third) transformati= on - the {{EmptyPartitionsDiscarder}}. Being the last one applied, it=E2=80= =99s legal for it to consume the iterator, and triggering {{moreContents()}= } is now no longer a problem. > Fixes: [3.0|https://github.com/iamaleksey/cassandra/commits/13747-3.0], [= 3.11|https://github.com/iamaleksey/cassandra/commits/13747-3.11], [4.0|http= s://github.com/iamaleksey/cassandra/commits/13747-4.0]. dtest [here|https:/= /github.com/iamaleksey/cassandra-dtest/commits/13747]. -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org For additional commands, e-mail: commits-help@cassandra.apache.org