You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Joshua McKenzie (JIRA)" <ji...@apache.org> on 2017/09/18 13:28:00 UTC
[jira] [Commented] (CASSANDRA-13877) Potential concurrency issue
with CDC size calculation
[ https://issues.apache.org/jira/browse/CASSANDRA-13877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16170009#comment-16170009 ]
Joshua McKenzie commented on CASSANDRA-13877:
---------------------------------------------
Those volatiles are only written from one thread context each so shouldn't be an issue; single-producer multi-consumer.
bq. In rare cases we'll not be able to calculate CDC data size correctly
Could you clarify a theoretical scenario in which this would take place?
> 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