Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-11529

Checking if an unlogged batch is local is inefficient

Agile BoardAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Severity:
      Critical
    • Impacts:
      Docs

      Description

      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:

                   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);
      

      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.

        Attachments

        Issue Links

          Activity

            People

            • Assignee:
              stefania Stefania Alborghetti Assign to me
              Reporter:
              pauloricardomg Paulo Motta (Deprecated)
              Authors:
              Stefania Alborghetti
              Reviewers:
              Paulo Motta (Deprecated)

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment