Skip to content

AxonOps — AI-Native Control Plane for Open Source Data Platforms

sstableverify

Validates SSTable integrity by checking data structure and checksums without modifying files.


Terminal window
sstableverify [options] <keyspace> <table>

sstableverify performs comprehensive integrity checks on SSTable files to detect corruption before it causes operational problems. Unlike sstablescrub, this tool is read-only and does not modify any data, making it safe for diagnostic purposes.

The tool validates:

  • Data file checksums - Verifies CRC32 checksums match stored values
  • Index consistency - Ensures index entries point to valid data locations
  • Row structure - Validates row format and column data
  • Bloom filter integrity - Checks filter file consistency

Cassandra Must Be Stopped

Cassandra must be completely stopped before running sstableverify. Running this tool while Cassandra is active may produce inconsistent results or cause issues with active SSTables.


sstableverify Integrity Check Processsstableverify Integrity Check ProcessRead SSTable componentsVerification ChecksVerify Data.db checksumChecksum valid?yesnoValidate Index.db entriesIndex valid?yesnoCheck row structureRows valid?yesnoVerify Bloom filterFilter valid?yesnoAll checks passedFilter corruption detectedRow corruption detectedIndex corruption detectedData corruption detectedReport results
LevelComponents CheckedUse Case
BasicChecksums onlyQuick health check
Extended (-e)Checksums + row readsDeep validation
Token Check (-t)Token range validationRing consistency

ArgumentDescription
keyspaceName of the keyspace containing the table
tableName of the table to verify

OptionDescription
-f, --forceRequired. Force verification to proceed (safety flag)
-e, --extended-verifyExtended verification - read and validate every row
-t, --token_range <left,right>Only verify SSTables containing tokens in range (comma-separated, can be specified multiple times)
-q, --quickQuick verification (less thorough)
-c, --check_versionCheck SSTable version compatibility
-r, --mutate_repair_statusMutate repair status metadata
-v, --verboseVerbose output showing progress
-h, --helpDisplay help information
--debugEnable debug logging

Force Flag Required

The -f or --force flag is required to run verification (CASSANDRA-17017). This is a safety measure to prevent accidental execution.

Extended mode performs a complete read of every row in the SSTable:

Extended vs Basic VerificationExtended vs Basic VerificationBasic VerificationExtended Verification (-e)Check file checksumsValidate index structureVerify bloom filterAll basic checksRead every partitionDeserialize all rowsValidate cell valuesFast but may misssome corruption typesThorough but slowerCatches all corruption

Terminal window
# Stop Cassandra first
sudo systemctl stop cassandra
# Verify a specific table (--force is required)
sstableverify -f my_keyspace my_table
# Start Cassandra
sudo systemctl start cassandra
Terminal window
# Full row-by-row verification
sstableverify -f -e my_keyspace my_table
Terminal window
# See progress during verification
sstableverify -f -v my_keyspace my_table
Terminal window
# Only verify SSTables containing specific tokens (comma-separated range)
sstableverify -f -t -9223372036854775808,0 my_keyspace my_table
# Multiple token ranges can be specified
sstableverify -f -t -9223372036854775808,0 -t 0,9223372036854775807 my_keyspace my_table
verify_keyspace.sh
#!/bin/bash
KEYSPACE="$1"
DATA_DIR="/var/lib/cassandra/data"
# Get all tables in keyspace
for table_dir in ${DATA_DIR}/${KEYSPACE}/*/; do
table_name=$(basename "$table_dir" | cut -d'-' -f1)
echo "Verifying ${KEYSPACE}.${table_name}..."
sstableverify "$KEYSPACE" "$table_name"
if [ $? -ne 0 ]; then
echo "ERROR: Corruption found in ${KEYSPACE}.${table_name}"
fi
done

Verifying BigTableReader(path='/var/lib/cassandra/data/my_keyspace/my_table-abc123/nb-1-big-Data.db')
Deserializing sstable metadata for /var/lib/cassandra/data/my_keyspace/my_table-abc123/nb-1-big-Data.db
Checking computed hash of BigTableReader...
Verifying BigTableReader(path='/var/lib/cassandra/data/my_keyspace/my_table-abc123/nb-2-big-Data.db')
...

No errors printed indicates all SSTables passed verification.

Verifying BigTableReader(path='/var/lib/cassandra/data/my_keyspace/my_table-abc123/nb-1-big-Data.db')
Error verifying /var/lib/cassandra/data/my_keyspace/my_table-abc123/nb-1-big-Data.db:
Corrupted: Cannot read sstable at position 12345
CodeMeaning
0All SSTables verified successfully
1Corruption detected in one or more SSTables
2Tool error (permissions, missing files, etc.)

#!/bin/bash
# weekly_verify.sh - Run weekly via cron
KEYSPACES="system system_auth my_keyspace"
LOG_FILE="/var/log/cassandra/verify_$(date +%Y%m%d).log"
echo "Starting SSTable verification: $(date)" >> $LOG_FILE
for ks in $KEYSPACES; do
for table_dir in /var/lib/cassandra/data/$ks/*/; do
table=$(basename "$table_dir" | cut -d'-' -f1)
echo "Verifying $ks.$table" >> $LOG_FILE
sstableverify -f "$ks" "$table" >> $LOG_FILE 2>&1
done
done
echo "Verification complete: $(date)" >> $LOG_FILE
Terminal window
# After disk errors, power loss, or memory issues
# Verify all tables before starting Cassandra
sudo systemctl stop cassandra
# Verify critical tables first (--force required)
sstableverify -f -e system_auth roles
sstableverify -f -e my_keyspace critical_table
# If issues found, scrub before starting
# sstablescrub my_keyspace corrupted_table
sudo systemctl start cassandra
Terminal window
# Verify before upgrades or migrations
sstableverify -f my_keyspace my_table
# If clean, proceed with operation
if [ $? -eq 0 ]; then
echo "SSTables healthy, proceeding..."
else
echo "Corruption detected, run sstablescrub first"
fi
Terminal window
# When seeing read errors in logs
# Error: "CorruptSSTableException" or "Cannot read SSTable"
# 1. Stop Cassandra
sudo systemctl stop cassandra
# 2. Verify the suspect table (--force required)
sstableverify -f -e -v my_keyspace problematic_table 2>&1 | tee verify.log
# 3. Identify corrupted SSTables from output
grep -i "error\|corrupt" verify.log
# 4. Scrub to fix
sstablescrub my_keyspace problematic_table

ToolPurposeModifies DataWhen to Use
sstableverifyCheck integrityNoDiagnostics, health checks
sstablescrubFix corruptionYesAfter verify finds issues
nodetool verifyOnline verificationNoWhile Cassandra running
nodetool scrubOnline scrubYesMinor corruption, online
Choosing Between Verification ToolsChoosing Between Verification ToolsSuspected corruption?Run nodetool verifyIssues found?yesnoRun nodetool scrubScrub succeeds?yesnoDoneStop CassandraSystem healthyyesCassandra running?noRun sstableverify -eIssues found?yesnoRun sstablescrubRun sstableverify againStill corrupted?yesnoConsider removing SSTablePlan repair from replicasFixedSystem healthy

Data SizeBasic ModeExtended Mode
1 GB~10 seconds~1 minute
10 GB~1 minute~10 minutes
100 GB~10 minutes~1-2 hours
1 TB~1-2 hours~10-20 hours
  • CPU: Moderate (checksum calculations)
  • Memory: Low (streams data)
  • Disk I/O: High (reads all SSTable data)
Terminal window
# Verify tables in parallel (if I/O allows)
sstableverify -f keyspace table1 &
sstableverify -f keyspace table2 &
sstableverify -f keyspace table3 &
wait
# Or limit to specific token ranges (comma-separated)
sstableverify -f -t -9223372036854775808,0 keyspace table &
sstableverify -f -t 0,9223372036854775807 keyspace table &
wait

Terminal window
# Run as cassandra user
sudo -u cassandra sstableverify my_keyspace my_table
# Or fix ownership
sudo chown -R cassandra:cassandra /var/lib/cassandra/data/
Terminal window
# Increase heap for verification
export JVM_OPTS="-Xmx4G"
sstableverify my_keyspace my_table
Terminal window
# List SSTables first
sstableutil my_keyspace my_table
# Verify directory structure
ls -la /var/lib/cassandra/data/my_keyspace/my_table-*/
# Check for in-progress compactions
ls /var/lib/cassandra/data/my_keyspace/my_table-*/*.log

Verification may report issues that are not actual corruption:

  • In-progress compaction logs - Temporary files during compaction
  • Transaction logs - Pending operations
Terminal window
# Clean up transaction logs before verification
# (Only if Cassandra is stopped and was cleanly drained)
find /var/lib/cassandra/data/ -name "*.log" -type f

sstableverify Guidelines

  1. Run regularly - Schedule weekly or monthly verification
  2. Use extended mode - For thorough checks after incidents
  3. Verify before upgrades - Ensure clean state before major changes
  4. Keep Cassandra stopped - Required for accurate results
  5. Check all critical tables - System tables and important application tables
  6. Review logs first - Check for corruption indicators before verification
  7. Plan for time - Extended verification can take hours on large datasets

Limitations

  • Does not fix corruption (use sstablescrub for that)
  • Requires Cassandra to be stopped
  • Extended mode is slow on large datasets
  • Cannot verify SSTables being actively written

CommandRelationship
sstablescrubFix corruption found by verify
nodetool verifyOnline verification (less thorough)
nodetool scrubOnline scrub
sstablemetadataView SSTable properties
sstableutilList SSTable files