Script icon
If icon
SlackIncomingWebhook icon
Log icon
Labels icon
Schedule icon

Cassandra Tombstone Density Auditor

Audits Apache Cassandra keyspaces for tables with high tombstone accumulation risks, alerting database administrators on Slack before read timeouts occur.

Categories
DataInfrastructure

This blueprint acts as an automated reliability guardian for Apache Cassandra clusters. Scheduled weekly, it queries system schema metadata across target keyspaces, analyzes garbage collection grace periods (gc_grace_seconds), audits compaction strategies, and warns database administrators via Slack before tombstone accumulation triggers query failures or TombstoneOverwhelmingException crashes.

How it works

  1. Weekly Scheduled Trigger: The weekly_cassandra_audit trigger (io.kestra.plugin.core.trigger.Schedule) initiates the audit every Sunday at 05:00 UTC.
  2. CQL Schema Metadata Inspection: The audit_tombstone_density task (io.kestra.plugin.scripts.python.Script) connects to Cassandra nodes using the official Python driver, queries system_schema.tables, and extracts GC and compaction configurations.
  3. Threshold Gate: The check_tombstone_risk flowable task (io.kestra.plugin.core.flow.If) branches based on whether any tables flag improper GC grace or delete density risks.
  4. Slack Alert Dispatch: When risk conditions are identified, notify_slack_dba (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) delivers an incident warning with affected table names and maintenance instructions.
  5. Healthy Confirmation: When all tables are compliant, log_tables_healthy records confirmed status.
  6. Manifest Export: The export_audit_manifest task tags the execution with searchable status labels.

Architecture diagram

flowchart TD
    A[Schedule: Sunday 05:00 UTC] --> B[audit_tombstone_density: Cassandra CQL Driver]
    B --> C{Tombstone Risk Detected?}
    C -- Yes --> D[notify_slack_dba: Slack Webhook]
    C -- No --> E[log_tables_healthy: Log]
    D --> F[export_audit_manifest: Execution Labels]
    E --> F

Use cases

  • TombstoneOverwhelmingException Prevention: Catch high delete velocity patterns before query coordinators refuse requests exceeding the 100,000 tombstone safety ceiling.
  • Compaction Strategy Tuning: Identify write-heavy tables with frequent row deletions requiring TimeWindowCompactionStrategy (TWCS) or LeveledCompactionStrategy (LCS).
  • Single-Node Deletion Hygiene: Verify that tables with gc_grace_seconds = 0 are not running in multi-node clusters where zombie data resurfacing could occur.

Inputs

Name Type Default Description
cassandra_contact_points STRING cassandra-node1.internal Comma-separated Cassandra node IP addresses or hostnames.
cassandra_port INT 9042 Native CQL protocol communication port.
keyspace_name STRING production_data Target Cassandra keyspace to inspect for tombstone density.
max_tombstones_per_query_warning INT 1000 Tombstone warning limit per table read operation before dispatching an alert.
slack_channel STRING #cassandra-alerts Slack channel destination for database health notifications.

Expected outputs

  • {{ outputs.audit_tombstone_density.vars.total_tables_audited }}: Number of tables analyzed within keyspace.
  • {{ outputs.audit_tombstone_density.vars.flagged_tables_count }}: Count of tables flagged for tombstone risks.
  • {{ outputs.audit_tombstone_density.vars.has_tombstone_risk }}: Boolean flag indicating cluster health degradation.
  • {{ outputs.audit_tombstone_density.vars.flagged_table_names }}: List of flagged table identifiers.
  • {{ outputs.audit_tombstone_density.outputFiles['cassandra_tombstone_report.json'] }}: Full JSON schema analysis report.

Prerequisites

  • Cassandra cluster user credentials with read permissions on system_schema tables.
  • Incoming Webhook URL configured for your database administrator Slack channel.

Secrets

  • CASSANDRA_USER: Cassandra database authentication username.
  • CASSANDRA_PASSWORD: Cassandra database authentication password.
  • SLACK_WEBHOOK_URL: Slack Incoming Webhook endpoint URL.

Quick start

  1. Configure CASSANDRA_USER, CASSANDRA_PASSWORD, and SLACK_WEBHOOK_URL in your Kestra namespace secrets.
  2. Import this flow YAML into your Kestra workspace.
  3. Specify your Cassandra contact points in cassandra_contact_points and target keyspace in keyspace_name.
  4. Click Execute in the UI to perform an immediate tombstone density assessment.

Common pitfalls and troubleshooting

  • Zombie Data Resurfacing: Setting gc_grace_seconds to 0 on multi-node clusters can cause deleted records to resurface if a node was offline during the delete operation.
  • Nodetool Garbagecollect Timing: Running heavy garbage collection during peak business hours can saturate disk I/O; schedule manual compactions during maintenance windows.

How to extend

  • Add automated execution of nodetool garbagecollect across cluster nodes via SSH or remote orchestration tasks.
  • Collect JMX table metrics (TombstoneScannedHistogram) to observe live read operation tombstone percentiles.
  • Integrate with Prometheus Alertmanager for automated cluster degradation escalation.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.