[
https://issues.apache.org/jira/browse/CASSANDRA-14139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16320204#comment-16320204
]
Paulo Motta commented on CASSANDRA-14139:
-----------------------------------------
Thanks for the review! See follow-up below:
bq. for the supportsEarlyOpen method we can instead store the boolean in
startup like we do with fanout and shouldDefragment
good catch, fixed!
bq. in trunk, for getRepaired, getUnrepaired and getPendingRepairManagers we
don't need the readlock - we return the list directly (and when refreshing we
clear the same list) - to make this safe we would need to copy the list and
return the copy, but those methods are only used in tests so I doubt we need it
(maybe add a comment though)
even though this is only used in test, for consistency I opted for copying the
list and returning a copying, so it is safe in case anybody uses it outside
testing.
Updated patch with fixes above, CI looks good. Please let me know what do you
think.
> Acquire read lock before accessing CompactionStrategyManager fields
> -------------------------------------------------------------------
>
> Key: CASSANDRA-14139
> URL: https://issues.apache.org/jira/browse/CASSANDRA-14139
> Project: Cassandra
> Issue Type: Bug
> Reporter: Paulo Motta
> Assignee: Paulo Motta
> Attachments: 3.11-14139-dtest.png, 3.11-14139-testall.png,
> trunk-14139-dtest.png, trunk-14139-testall.png
>
>
> There are a few methods in {{CompactionStrategyManager}} accessing the
> repaired/unrepaired compaction strategy lists without using the read lock,
> what could cause issues like the one below:
> {noformat}
> ERROR [CompactionExecutor:1] 2017-12-22 12:17:12,320 CassandraDaemon.java:141
> - Exception in thread Thread[CompactionExecutor:1,5,main]
> java.lang.IndexOutOfBoundsException: Index: 0, Size: 1
> at java.util.ArrayList.rangeCheck(ArrayList.java:657)
> at java.util.ArrayList.get(ArrayList.java:433)
> at
> org.apache.cassandra.db.compaction.CompactionStrategyManager.supportsEarlyOpen(CompactionStrategyManager.java:1262)
> at
> org.apache.cassandra.db.ColumnFamilyStore.supportsEarlyOpen(ColumnFamilyStore.java:558)
> at
> org.apache.cassandra.io.sstable.SSTableRewriter.construct(SSTableRewriter.java:119)
> at
> org.apache.cassandra.db.compaction.writers.CompactionAwareWriter.<init>(CompactionAwareWriter.java:91)
> at
> org.apache.cassandra.db.compaction.writers.DefaultCompactionWriter.<init>(DefaultCompactionWriter.java:57)
> at
> org.apache.cassandra.db.compaction.CompactionTask.getCompactionAwareWriter(CompactionTask.java:293)
> at
> org.apache.cassandra.db.compaction.CompactionTask.runMayThrow(CompactionTask.java:200)
> at org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:28)
> at
> org.apache.cassandra.db.compaction.CompactionTask.executeInternal(CompactionTask.java:90)
> at
> org.apache.cassandra.db.compaction.AbstractCompactionTask.execute(AbstractCompactionTask.java:101)
> at
> org.apache.cassandra.db.compaction.CompactionManager$BackgroundCompactionCandidate.run(CompactionManager.java:310)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at
> org.apache.cassandra.concurrent.NamedThreadFactory.lambda$threadLocalDeallocator$0(NamedThreadFactory.java:81)
> at java.lang.Thread.run(Thread.java:748)
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]