[ https://issues.apache.org/jira/browse/CASSANDRA-11529?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15231202#comment-15231202 ]
Russell Bradberry commented on CASSANDRA-11529: ----------------------------------------------- This is a critical issue for us as our cluster is in a mixed-version state where we have coordinator-only nodes running an older version to compensate for this issue. The impact on a 50 node (8 cores, 256 vnodes) cluster with a few thousand batch inserts per second sends the average load to above 120. > Checking if an unlogged batch is local is inefficient > ----------------------------------------------------- > > Key: CASSANDRA-11529 > URL: https://issues.apache.org/jira/browse/CASSANDRA-11529 > Project: Cassandra > Issue Type: Bug > Components: Coordination > Reporter: Paulo Motta > > Based on CASSANDRA-11363 report I noticed that on CASSANDRA-9303 we > introduced the following check to avoid printing a {{WARN}} in case an > unlogged batch statement is local: > {noformat} > for (IMutation im : mutations) > { > keySet.add(im.key()); > for (ColumnFamily cf : im.getColumnFamilies()) > ksCfPairs.add(String.format("%s.%s", > cf.metadata().ksName, cf.metadata().cfName)); > + > + if (localMutationsOnly) > + localMutationsOnly &= isMutationLocal(localTokensByKs, > im); > } > > + // CASSANDRA-9303: If we only have local mutations we do not warn > + if (localMutationsOnly) > + return; > + > NoSpamLogger.log(logger, NoSpamLogger.Level.WARN, 1, > TimeUnit.MINUTES, unloggedBatchWarning, > keySet.size(), keySet.size() == 1 ? "" : "s", > ksCfPairs.size() == 1 ? "" : "s", ksCfPairs); > {noformat} > The {{isMutationLocal}} check uses > {{StorageService.instance.getLocalRanges(mutation.getKeyspaceName())}}, which > underneaths uses {{AbstractReplication.getAddressRanges}} to calculate local > ranges. > Recalculating this at every unlogged batch can be pretty inefficient, so we > should at the very least cache it every time the ring changes. -- This message was sent by Atlassian JIRA (v6.3.4#6332)