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

Optimize mostRecentTomstone vs maxTimestamp check in CollationController.collectAllData

Agile BoardAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Low
    • Resolution: Fixed
    • 1.2.0 beta 3
    • None
    • None

    Description

      CollationController.collectAllData eliminates a sstable if we've already read a row tombstone more recent that its maxTimestamp. This is however done in 2 passes and can be inefficient (or rather, it's not as efficient as it could). More precisely, say we have 10 sstables s0, ... s9, where s0 is the most recent and s9 the least one (and their maxTimestamp reflect that) and s0 has a row tombstone that is more recent than all of s1-s9 maxTimestamps. Now in collectAllData(), we first iterate over sstables in a "random" order (because DataTracker keeps sstable in a more or less random order). Meaning that we may iterate in the order s9, s8, ... s0. In that case, we will end up reading the row header from all the sstable (hitting disk each time). Then, and only then, the 2nd pass of collectAllData will eliminate s1 to s9.

      However, if we were to iterate sstable in maxTimestamps order (as we do in collectTimeOrdered), we would only need one pass but more importantly we would minimize the number of row header we read to perform that sstable eliminination. In my example, we would only ever read the row tombstone from s0 and eliminate all other sstable directly, simply based on their maxTimestamp.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            slebresne Sylvain Lebresne Assign to me
            slebresne Sylvain Lebresne
            Sylvain Lebresne
            Jonathan Ellis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment