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 0F621200D3A for ; Wed, 15 Nov 2017 11:11:08 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 0D898160BF6; Wed, 15 Nov 2017 10:11:08 +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 5431A160BEA for ; Wed, 15 Nov 2017 11:11:07 +0100 (CET) Received: (qmail 81494 invoked by uid 500); 15 Nov 2017 10:11: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 81474 invoked by uid 99); 15 Nov 2017 10:11:06 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Nov 2017 10:11:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id EF67AC03D1 for ; Wed, 15 Nov 2017 10:11:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-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-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id x_SzcwLP5sMZ for ; Wed, 15 Nov 2017 10:11:04 +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 D66B05F576 for ; Wed, 15 Nov 2017 10:11:03 +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 83ECCE259A for ; Wed, 15 Nov 2017 10:11: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 F004824116 for ; Wed, 15 Nov 2017 10:11:00 +0000 (UTC) Date: Wed, 15 Nov 2017 10:11:00 +0000 (UTC) From: "Kurt Greaves (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CASSANDRA-13992) Don't send new_metadata_id for conditional updates MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 15 Nov 2017 10:11:08 -0000 [ https://issues.apache.org/jira/browse/CASSANDRA-13992?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16253220#comment-16253220 ] Kurt Greaves commented on CASSANDRA-13992: ------------------------------------------ > then I have to change the last test to if (METADATA_CHANGED || new_metadata_id == special_value) In Alex's last version, yes, but if the metadata ID from the prepare and the exec are the same (because they are generated with the same value) this is not the case. You wouldn't have to worry about METADATA_CHANGED being set because a LWT will always have the same ID as the initial preparation. > Don't send new_metadata_id for conditional updates > -------------------------------------------------- > > Key: CASSANDRA-13992 > URL: https://issues.apache.org/jira/browse/CASSANDRA-13992 > Project: Cassandra > Issue Type: Bug > Reporter: Olivier Michallat > Assignee: Kurt Greaves > Priority: Minor > > This is a follow-up to CASSANDRA-10786. > Given the table > {code} > CREATE TABLE foo (k int PRIMARY KEY) > {code} > And the prepared statement > {code} > INSERT INTO foo (k) VALUES (?) IF NOT EXISTS > {code} > The result set metadata changes depending on the outcome of the update: > * if the row didn't exist, there is only a single column \[applied] = true > * if it did, the result contains \[applied] = false, plus the current value of column k. > The way this was handled so far is that the PREPARED response contains no result set metadata, and therefore all EXECUTE messages have SKIP_METADATA = false, and the responses always include the full (and correct) metadata. > CASSANDRA-10786 still sends the PREPARED response with no metadata, *but the response to EXECUTE now contains a {{new_metadata_id}}*. The driver thinks it is because of a schema change, and updates its local copy of the prepared statement's result metadata. > The next EXECUTE is sent with SKIP_METADATA = true, but the server appears to ignore that, and still sends the metadata in the response. So each response includes the correct metadata, the driver uses it, and there is no visible issue for client code. > The only drawback is that the driver updates its local copy of the metadata unnecessarily, every time. We can work around that by only updating if we had metadata before, at the cost of an extra volatile read. But I think the best thing to do would be to never send a {{new_metadata_id}} in for a conditional update. -- 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