[ 
https://issues.apache.org/jira/browse/CASSANDRA-16996?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17421078#comment-17421078
 ] 

Caleb Rackliffe commented on CASSANDRA-16996:
---------------------------------------------

Linking my comments from 
[here|https://issues.apache.org/jira/browse/CASSANDRA-16856?focusedCommentId=17420953&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17420953].

To expand on that a bit, I think we need at least 2 and possibly 3 things here, 
if it's clear that the problem identified in CASSANDRA-16856 is legitimate (and 
I think it is) and we want to make schema modifications atomic for 
{{SchemaKeyspace}}:

1.) To protect {{saveSystemKeyspacesSchema()}}, {{truncate()}}, 
{{calculateSchemaDigest()}}, {{convertSchemaToMutations()}}, and 
{{applyChanges()}}, given those are the places we deal with the contents of the 
entire schema keyspace.

2.) JavaDoc for {{SchemaKeyspace}} that explicitly lays out the class's 
synchronization policy and why it is that way. (This might need to mention in 
passing how this interacts w/ {{Schema}}, which also has its own 
synchronization that sort of incompletely overlaps w/ {{SchemaKeyspace}}.)

3.) (perhaps optional, but really nice and maybe not optional) A fuzz test like 
the one I mentioned 
[here|https://issues.apache.org/jira/browse/CASSANDRA-16856?focusedCommentId=17420953&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17420953]
 to simulate the case we're worried about at a reasonable level. In this case, 
it probably means hitting {{convertSchemaToMutations()}}, which is a good proxy 
for {{SchemaPullVerbHandler#doVerb()}}, concurrent to schema changes and/or 
truncations (possibly from {{Schema#transform()}}).

There is another way we might be able to solve this problem, and that's 
delegating more of our schema manipulation to {{Schema}}, where we're already 
synchronizing some of the codepaths that hit {{SchemaKeyspace}}. In that case, 
we could just annotate the latter as being explicitly not thread-safe.

> Prevent broken concurrent schema read/writes
> --------------------------------------------
>
>                 Key: CASSANDRA-16996
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-16996
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Cluster/Schema
>            Reporter: Berenguer Blasi
>            Assignee: Berenguer Blasi
>            Priority: Normal
>             Fix For: 3.11.x, 4.0, 4.x
>
>
> See CASSANDRA-16856 where the concurrent read/write path was left out



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to