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

Allow CommitLogSegmentReader to optionally skip sync marker CRC checks

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 4.1-alpha1, 4.1
    • Local/Commit Log
    • None
    • Operability
    • Normal
    • All
    • None
    • Hide

      additional tests in CommitLogTest to ensure the new switch behaves correctly with and without compression and encryption on the CommitLog

      Show
      additional tests in CommitLogTest to ensure the new switch behaves correctly with and without compression and encryption on the CommitLog

    Description

      CommitLog sync markers are written in two phases. In the first, zeroes are written for the position of the next sync marker and the sync marker CRC value. In the second, when the next sync marker is written, the actual position and CRC values are written. If the process shuts down in a disorderly fashion, it is entirely possible for a valid next marker position to be written to our memory mapped file but not the final CRC value. Later, when we attempt to replay the segment, we will fail without recovering any of the perfectly valid mutations it contains. (This assumes we’re confining ourselves to the case where there is no compression or encryption.)

      ERROR 2020-11-18T10:55:23,888 [main] org.apache.cassandra.utils.JVMStabilityInspector:102 - Exiting due to error while processing commit log during initialization.
      org.apache.cassandra.db.commitlog.CommitLogReplayer$CommitLogReplayException: Encountered bad header at position 23091775 of commit log …/CommitLog-6-1605699607608.log, with invalid CRC. The end of segment marker should be zero.
              at org.apache.cassandra.db.commitlog.CommitLogReplayer.handleReplayError(CommitLogReplayer.java:731)
              at org.apache.cassandra.db.commitlog.CommitLogReplayer.readSyncMarker(CommitLogReplayer.java:274)
              at org.apache.cassandra.db.commitlog.CommitLogReplayer.recover(CommitLogReplayer.java:436)
              at org.apache.cassandra.db.commitlog.CommitLogReplayer.recover(CommitLogReplayer.java:189)
              at org.apache.cassandra.db.commitlog.CommitLog.recover(CommitLog.java:170
              at org.apache.cassandra.db.commitlog.CommitLog.recover(CommitLog.java:151)
              at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:332)
              at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:656)
              at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:808)
      

      It may be useful to provide an option that would allow us to override the default/strict behavior here and skip the CRC check if a non-zero end position is present, allowing valid mutations to be recovered and startup to proceed.

      Attachments

        Activity

          People

            maedhroz Caleb Rackliffe
            maedhroz Caleb Rackliffe
            Caleb Rackliffe, Marcus Eriksson
            Josh McKenzie
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 40m
                40m