[ https://issues.apache.org/jira/browse/CASSANDRA-18927?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17787509#comment-17787509 ]
Michael Semb Wever commented on CASSANDRA-18927: ------------------------------------------------ The invalidate method is already using getAndSet in both 5.0 and trunk, like {code} public void invalidate() { View previousView = view.getAndSet(new View(context, Collections.emptyList())); for (SSTableIndex index : previousView) { index.markObsolete(); } } {code} https://github.com/apache/cassandra/blob/cassandra-5.0/src/java/org/apache/cassandra/index/sai/view/IndexViewManager.java#L136-L148 > Fix potential race condition in IndexViewManager during invalidation > -------------------------------------------------------------------- > > Key: CASSANDRA-18927 > URL: https://issues.apache.org/jira/browse/CASSANDRA-18927 > Project: Cassandra > Issue Type: Bug > Components: Feature/SAI > Reporter: Mike Adamson > Assignee: Mike Adamson > Priority: Normal > Fix For: 5.0-beta > > > There is a potential race condition in the {{IndexViewManager.invalidate}} > method: > {code:java} > public void invalidate() > { > View currentView = view.get(); > for (SSTableIndex index : currentView) > { > index.markObsolete(); > } > view.set(new View(context, Collections.emptyList())); > } {code} > We should {{getAndSet}} the view before marking the indexes as obsolete. This > would avoid indexes potentially being made obsolete when being accessed. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org