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 5AF99200D0F for ; Fri, 15 Sep 2017 01:32:05 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 598C01609CE; Thu, 14 Sep 2017 23:32:05 +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 A10B81609CD for ; Fri, 15 Sep 2017 01:32:04 +0200 (CEST) Received: (qmail 43440 invoked by uid 500); 14 Sep 2017 23:32:03 -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 43429 invoked by uid 99); 14 Sep 2017 23:32:03 -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; Thu, 14 Sep 2017 23:32:03 +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 3D148184D06 for ; Thu, 14 Sep 2017 23:32:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[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 (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id ETB5xutxyqJm for ; Thu, 14 Sep 2017 23:32:02 +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 F26BE5FDBC for ; Thu, 14 Sep 2017 23:32: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 6C1C5E0E74 for ; Thu, 14 Sep 2017 23:32:01 +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 35CF125387 for ; Thu, 14 Sep 2017 23:32:00 +0000 (UTC) Date: Thu, 14 Sep 2017 23:32:00 +0000 (UTC) From: "Simon Zhou (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (CASSANDRA-13877) Potential concurrency issue with CDC size calculation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 14 Sep 2017 23:32:05 -0000 Simon Zhou created CASSANDRA-13877: -------------------------------------- Summary: Potential concurrency issue with CDC size calculation Key: CASSANDRA-13877 URL: https://issues.apache.org/jira/browse/CASSANDRA-13877 Project: Cassandra Issue Type: Bug Reporter: Simon Zhou Assignee: Simon Zhou We're backporting CDC feature and bug fixes to 3.0. There is potential visibility issue with two variables CDCSizeTracker.sizeInProgress and DirectorySizeCalculator.size. They're declared as volatile however there are cases that when assigning new values to them, the new values depend on the current value. For example: https://github.com/apache/cassandra/blob/e9da85723a8dd40872c4bca087a03b655bd2cacb/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManagerCDC.java#L285 https://github.com/apache/cassandra/blob/e9da85723a8dd40872c4bca087a03b655bd2cacb/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManagerCDC.java#L297 In rare cases we'll not be able to calculate CDC data size correctly. We should change these two variables back to AtomicLong, as the simplest fix. Java Concurrency In Practice section 3.1.3 explains well why we shouldn't use volatile in these two cases. I'll provide patch shortly. cc [~JoshuaMcKenzie] [~jay.zhuang] -- 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