Schedule icon
Query icon
Switch icon
Log icon
SlackIncomingWebhook icon

Audit ScyllaDB Materialized View Build Status and Desynchronization

Audit ScyllaDB materialized view build status with Kestra. Detect view synchronization failures and dispatch automated Slack incident alerts.

Categories
DataInfrastructure

ScyllaDB Materialized Views allow developers to query base table data using alternative partition keys without maintaining dual-write pipelines in application code. When base tables receive writes, ScyllaDB asynchronously generates and streams view updates in the background. During cluster node additions, heavy compaction loads, or network blips, view generation can stall or enter a FAILED state in ScyllaDB's internal system.view_build_status metadata. When a view build fails or falls behind, queries routed to the materialized view silently return incomplete or stale results, violating application data consistency.

This blueprint implements an automated Day 2 Operations sentinel that queries ScyllaDB on a recurring schedule. It reads the cluster-wide system.view_build_status table via native CQL, evaluates whether all materialized views have achieved SUCCESS state, identifies lagging or unsuccessful builds, and automatically dispatches Slack incident alerts with operational guidance to database administrators before stale data affects end-user workloads.

How it works

  1. periodic_view_audit (io.kestra.plugin.core.trigger.Schedule) triggers the audit pass every 6 hours (shipped disabled for safe initial onboarding).
  2. probe_view_build_status (io.kestra.plugin.scylladb.Query) executes a CQL query against the internal system.view_build_status table with fetchType: FETCH, retrieving the build state for every materialized view across the cluster.
  3. evaluate_view_status (io.kestra.plugin.core.flow.Switch) applies a Pebble condition to verify whether any materialized view has a status other than SUCCESS.
  4. When within acceptable operational limits (HEALTHY), log_views_healthy records that all views report SUCCESS along with total view counts.
  5. When a degraded or incomplete view build is detected (VIEW_BUILD_DEGRADED), alert_view_degraded dispatches an urgent alert to Slack using io.kestra.plugin.slack.notifications.SlackIncomingWebhook, and log_remediation_guidance logs actionable recovery steps.
  6. log_audit_completion writes a final audit recap for execution tracking and compliance lineage.
  7. The flow-level errors block alerts Slack immediately if CQL authentication or node connectivity fails.

What you get

  • Proactive visibility into ScyllaDB materialized view build failures before stale queries impact production applications.
  • Automated cluster-wide inspection across all keyspaces and materialized views in a single pass.
  • Instant Slack incident notifications alerting DBAs to run view rebuild procedures.
  • Diagnostic logging with direct nodetool remediation commands (nodetool rebuild_view).
  • Flow-level error alerting safeguarding audit pipeline reliability.

Who it's for

  • Database Administrators (DBAs) and Site Reliability Engineers managing ScyllaDB or Apache Cassandra clusters.
  • Platform Engineers maintaining distributed NoSQL databases with materialized view schemas.
  • Backend Architects relying on materialized views for low-latency secondary index lookups.

Why orchestrate this with Kestra

Monitoring ScyllaDB internal system tables with standalone cron scripts requires managing CQL driver binaries, credential rotation, connection pool lifecycle, and alerting webhooks in brittle custom infrastructure. Kestra provides a declarative workflow engine with native ScyllaDB CQL support, centralized secret management, conditional branching, execution history, and native Slack integrations without maintaining separate monitoring daemons.

Prerequisites

  • A running ScyllaDB cluster (v5.x or compatible Apache Cassandra v4.x deployment).
  • Database credentials with read access to the system keyspace.
  • A Slack Incoming Webhook URL configured in Kestra secrets.

Local Docker Container Setup

To run ScyllaDB locally for development and testing without host port conflicts:

docker run -d --name scylla-dev -p 9042:9042 scylladb/scylla:5.2 \
  --smp 1 --memory 1G --overprovisioned 1

If Kestra is running inside a Docker network, connect the ScyllaDB container to Kestra's network:

docker network ls
docker network connect YOUR_KESTRA_NETWORK scylla-dev

Secrets

  • SCYLLADB_USERNAME: Username for ScyllaDB cluster authentication (leave blank if authentication is disabled in dev).
  • SCYLLADB_PASSWORD: Password for ScyllaDB cluster authentication.
  • SLACK_WEBHOOK: Incoming Webhook URL for Slack alerting.

Note for Kestra Open-Source (OSS): Secrets are configured as base64-encoded environment variables formatted as SECRET_<NAME> (e.g. SECRET_SCYLLADB_PASSWORD).

Inputs

Name Type Default Allowed Values Description
contact_points STRING "localhost:9042" Comma-separated host:port ScyllaDB node contact points
local_datacenter STRING "datacenter1" String identifier Local datacenter for load balancing
remediation_mode SELECT "ALERT_ONLY" "ALERT_ONLY", "LOG_GUIDANCE" Action mode on view build degradation

Outputs

  • {{ outputs.probe_view_build_status.rows }}: List of rows from system.view_build_status containing keyspace_name, view_name, and status.
  • {{ outputs.probe_view_build_status.size }}: Total number of materialized view records audited.

Quick start

  1. Configure SCYLLADB_USERNAME, SCYLLADB_PASSWORD, and SLACK_WEBHOOK in your Kestra namespace secrets.
  2. Import this blueprint into your Kestra instance.
  3. Run a manual execution with contact_points pointing to your cluster to verify connectivity and view status retrieval.
  4. Enable the periodic_view_audit schedule trigger to run automated recurring audits.

How to extend

  • Add automated view rebuild trigger by invoking io.kestra.plugin.scripts.shell.Commands to execute nodetool rebuild_view over SSH or JMX upon build failure.
  • Integrate with PagerDuty or Opsgenie in the VIEW_BUILD_DEGRADED branch for critical consumer-facing views.
  • Chain a downstream subflow using io.kestra.plugin.core.flow.Subflow to pause upstream batch loading jobs until materialized views finish synchronization.

Pitfalls

  • Local Datacenter Name: ScyllaDB Java driver requires an exact match for connection.localDatacenter (e.g., datacenter1 or us-east-1). Providing an invalid datacenter name will cause initial connection failure.
  • Empty Result When No Views Exist: If the cluster has no materialized views defined, system.view_build_status returns zero rows. The Pebble condition safely defaults to HEALTHY.
  • Port Availability: Ensure CQL native protocol port 9042 is open and accessible between the Kestra worker and ScyllaDB nodes.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.