starrocks/starrocks-debug-skills/tablet

Claude Code and agent skill by starrocks/starrocks-debug-skills

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Use when investigating tablet-level structural problems: data skew (one tablet 10× larger than peers), too many tablet versions blocking writes (too many versions error), error-state replicas, over-sharding causing high FE metadata overhead, or disk balance retry loops. Covers SHOW TABLET analysis, be_tablets SQL queries, bucket key optimization, and tablet health thresholds (VersionCount, DataSize variance, num_rowset).

Install

npx vskill@latest install starrocks/starrocks-debug-skills/tablet

SKILL.md

Tablet Governance

Investigation guide for tablet health, balance, data skew, bucket optimization, and version-count / compaction-lag issues.

Five root causes account for the vast majority of cases:

  • Cause A — data skew from low-cardinality bucket key
  • Cause B — too many versions (compaction lag)
  • Cause C — error state replicas (VERSION_ERROR, SCHEMA_ERROR)
  • Cause D — too many tablets (over-sharding from fine partitions or excess buckets)
  • Cause E — disk balance retry loop (metadata state inconsistency)

Metric Taxonomy — Read This First

Before using any metrics, understand the two-layer observability structure:

SQL-based observability

`SHOW TABLET FROM <table>` — per-tablet summary for a table:

FieldMeaning
TabletIdTablet identifier
ReplicaIdReplica identifier on a specific BE
BackendIdBE hosting this replica
SchemaHashSchema version hash (mismatch indicates SCHEMA_ERROR)
VersionLatest visible version
VersionCountNumber of versions (rowsets) tracked by the system
LstFailedVersionLast version that failed to load — non-zero indicates replica problem
LstSuccessVersionLast version successfully applied
DataSizeStorage size of this replica in bytes
RowCountRow count estimate
StateReplica state: NORMAL, CLONE, SCHEMA_CHANGE, ALTER

`SHOW TABLET <tablet_id>` — single tablet detail:

FieldMeaning
DbName / TableName / PartitionNameContext for this tablet
StateTablet state
VersionCountVersion count across replicas (from detailcmd)
CompactionStatus URLLink to BE compaction state JSON — shows last_base_compaction_time, cumulative_layer_point

`information_schema.be_tablets` — per-replica metrics from BE (most detailed):

FieldMeaning
be_idBE hosting this replica
tablet_idTablet identifier
num_versionTotal version count (all edits ever)
num_rowsetActive rowsets in current version — key compaction health indicator
num_segmentSegment files (num_rowset × segments per rowset)
data_sizeRaw data size in bytes
num_rowRow count
stateReplica state
medium_typeHDD or SSD
How to retrieve metrics

Option 1 — SQL (primary method)

sql
-- Per-table tablet distribution and health
SHOW TABLET FROM <table_name>;
-- Single tablet detail + detailcmd for replica-level VersionCount
SHOW TABLET <tablet_id>;
-- Run the detailcmd from output:
SHOW PROC '/dbs/<db_id>/<table_id>/<partition_id>';
-- Tablet replica distribution across BEs
ADMIN SHOW REPLICA DISTRIBUTION FROM <table_name>;
-- Deep tablet state per BE (most detailed)
SELECT be_id, tablet_id, num_rowset, num_version, num_segment,
ROUND(data_size / 1024 / 1024, 1) AS data_size_mb,
num_row, state
FROM information_schema.be_tablets
WHERE table_id = <table_id>
ORDER BY num_rowset DESC LIMIT 20;
-- Cluster-wide unhealthy tablets
SHOW PROC "/statistic";
SHOW PROC "/statistic/<db_id>";
-- Find tablets with high rowset count (compaction lag indicator)
SELECT be_id, tablet_id, num_rowset, num_segment,
ROUND(data_size / 1024 / 1024, 1) AS data_size_mb
FROM information_schema.be_tablets
WHERE num_rowset > 100
ORDER BY num_rowset DESC LIMIT 20;
-- Find data skew: tablets with extreme size variance
SELECT be_id, tablet_id,
ROUND(data_size / 1024 / 1024, 1) AS data_size_mb,
num_row
FROM information_schema.be_tablets
WHERE table_id = <table_id>
ORDER BY data_size DESC LIMIT 20;
-- Count tablets per BE (distribution balance check)
SELECT be_id, COUNT(*) AS tablet_count,
SUM(data_size) / 1024 / 1024 / 1024 AS total_gb
FROM information_schema.be_tablets
GROUP BY be_id
ORDER BY tablet_count DESC;

Option 2 — curl BE HTTP port (compaction and rowset state)

bash
# Compaction status for a specific tablet
curl "http://<be_ip>:8040/api/compaction/show?tablet_id=<tablet_id>"
# All compaction metrics on a BE
curl -s "http://<be_ip>:8040/metrics" | grep -E "compaction_score|num_rowset"

Option 3 — BE HTTP tablet detail

bash
# Full tablet metadata from BE
curl "http://<be_ip>:8040/api/meta/header?tablet_id=<tablet_id>"

Default HTTP ports: BE = 8040, FE = 8030.


Key rules for interpretation:

  1. VersionCount > 500 continuously (from SHOW TABLET) indicates compaction cannot keep up with write rate — this is a compaction problem (see skill 12-compaction), not a tablet governance problem.
  2. DataSize variance > 10x across tablets of the same table strongly indicates data skew from a low-cardinality or hot-value bucket key.
  3. num_rowset in be_tablets equals VersionCount for non-PK tables; both come from _rs_metas.size(). For PK tables, num_rowset = active rowsets in latest version (usually smaller).
  4. LstFailedVersion > 0 and LstFailedVersion != LstSuccessVersion on a replica means that replica has a version gap — it needs repair clone.
  5. Total tablet count per cluster should be monitored: > 500,000 tablets creates FE metadata overhead and BE file descriptor pressure.

Tablet Health Reference

MetricHealthyWarningAct Immediately
VersionCount (SHOW TABLET)< 5050–500> 500 sustained (compaction lag)
DataSize variance across tablets (same table)< 2x2–10x> 10x (data skew)
num_rowset (be_tablets)< 2020–100> 100 (rowset pile-up)
num_row std deviation across tabletssmallstd_dev > 10% of meansingle tablet holds > 50% of total rows
Tablet count per BEbalanced20% variance> 2x between BEs (scan skew)
Total tablet count in cluster< 100,000100,000–500,000> 500,000 (FE heap and FD pressure)
LstFailedVersion on replica0 or equals LstSuccessVersionAny non-zero gapGap growing and CloningTabletNum not rising

Phase 1 — Assess Tablet Health

Step 1.1 — Cluster-wide quick scan
sql
-- Check for unhealthy tablets across all databases
SHOW PROC "/statistic";
  • UnhealthyTabletNum = 0 everywhere → proceed to performance-focused steps
  • UnhealthyTabletNum > 0 → note which DB IDs are affected, go to Step 1.2
Step 1.2 — BE-level tablet scan
sql
-- Find tablets with high rowset count (compaction lag signal)
SELECT be_id, COUNT(*) AS tablet_count,
MAX(num_rowset) AS max_rowsets,
SUM(CASE WHEN num_rowset > 100 THEN 1 ELSE 0 END) AS tablets_over_100_rowsets,
SUM(CASE WHEN num_rowset > 500 THEN 1 ELSE 0 END) AS tablets_over_500_rowsets
FROM information_schema.be_tablets
GROUP BY be_id
ORDER BY max_rowsets DESC;
-- Check for severely skewed tablets across all tables
SELECT table_id, be_id,
MAX(data_size) / 1024 / 1024 AS max_tablet_mb,
MIN(data_size) / 1024 / 1024 AS min_tablet_mb,
MAX(data_size) / NULLIF(MIN(data_size), 0) AS size_ratio
FROM information_schema.be_tablets
GROUP BY table_id, be_id
HAVING size_ratio > 10
ORDER BY size_ratio DESC LIMIT 10;
Step 1.3 — Identify issue type
Signal from Step 1.2Points toward
max_rowsets > 100 on multiple BEsCause B — compaction lag
size_ratio > 10 in data skew queryCause A — bucket key skew
UnhealthyTabletNum > 0, ErrorStateTabletNum > 0Cause C — error state replicas
Total tablet count > 500,000Cause D — over-sharding
history_tablets shows balance tasks cyclingCause E — disk balance retry loop

Phase 2 — Identify Problem Tablets

Step 2.1 — Drill into suspect table
sql
-- Tablet distribution for the table
SHOW TABLET FROM <table_name>;
-- Replica distribution across BEs
ADMIN SHOW REPLICA DISTRIBUTION FROM <table_name>;
-- Detailed per-replica metrics
SELECT be_id, tablet_id, num_rowset, num_version,
ROUND(data_size / 1024 / 1024, 1) AS data_size_mb,
num_row, state
FROM information_schema.be_tablets
WHERE table_id = <table_id>
ORDER BY data_size DESC LIMIT 30;
Step 2.2 — Confirm root cause
Cause A — Data skew

Confirm all match:

  • DataSize varies > 10x between tablets of the same table
  • num_row also varies proportionally (not a compaction artifact)
  • Distribution key has low cardinality or a dominant hot value

→ Go to Phase 3, Cause A

Cause B — Too many versions

Confirm all match:

  • num_rowset > 100 in be_tablets for multiple tablets
  • VersionCount > 500 from SHOW TABLET <tablet_id>
  • Compaction score rising (check skill 12-compaction for compaction-specific diagnosis)

→ Go to Phase 3, Cause B

Cause C — Error state replicas

Confirm all match:

  • ErrorStateTabletNum > 0 in SHOW PROC "/statistic"
  • SHOW TABLET FROM <table> shows LstFailedVersion > 0 and differs from LstSuccessVersion
  • Replica State is not NORMAL

→ Go to Phase 3, Cause C

Cause D — Too many tablets

Confirm all match:

  • Total tablet count > 500,000 or tablet count per BE > 50,000
  • Many small partitions (< 100MB each) or excess bucket count relative to data size
  • BE log shows FD warnings or ulimit -n approaching limit

→ Go to Phase 3, Cause D

Cause E — Disk balance retry loop

Confirm all match:

  • SHOW PROC "/cluster_balance/history_tablets" shows same tablet repeatedly failing
  • ErrMsg references metadata state or _shutdown_tablets
  • BE IO elevated on specific disk without progress

→ Go to Phase 3, Cause E


Phase 3 — Take Action by Cause

Cause A — Data skew (low-cardinality bucket key)

Step A-1: Confirm skew pattern

sql
-- Check approximate value distribution in the bucket key column
SELECT <bucket_key_col>, COUNT(*) AS cnt
FROM <table_name>
GROUP BY <bucket_key_col>
ORDER BY cnt DESC LIMIT 20;
-- If top value holds >> 1/bucket_count of total rows → bucket key has hot values

Step A-2: Identify correct bucket key

The bucket key must have high cardinality and uniform distribution. Good candidates:

  • User ID, order ID, device ID (UUID-like)
  • Composite keys that spread data evenly

Avoid: status, region, date, boolean columns.

Step A-3: Recreate table with better bucket key

sql
-- Create new table with better bucket key
CREATE TABLE <table_name>_new
DISTRIBUTED BY HASH(<high_cardinality_col>) BUCKETS <n>
AS SELECT * FROM <table_name>;
-- Swap
ALTER TABLE <table_name> RENAME <table_name>_old;
ALTER TABLE <table_name>_new RENAME <table_name>;

Step A-4: Use StarRocksBuckets CLI for analysis

The standalone StarRocksBuckets utility can analyze existing distributions and generate ALTER TABLE DDL for optimal bucket count and key. Run against the affected table before deciding on the new schema.


Cause B — Too many versions (compaction lag)

Step B-1: Identify affected tablets

sql
SELECT be_id, tablet_id, num_rowset,
ROUND(data_size / 1024 / 1024, 1) AS data_size_mb
FROM information_schema.be_tablets
WHERE num_rowset > 100
ORDER BY num_rowset DESC LIMIT 20;

Step B-2: Confirm compaction type and take action

This is a compaction problem. Use skill 12-compaction for the full diagnosis.

Quick remediation:

bash
# Manual compaction trigger (cumulative)
curl -XPOST "http://<be_ip>:8040/api/compact?compaction_type=cumulative&tablet_id=<tablet_id>"
# Manual compaction trigger (base — for delete explosion)
curl -XPOST "http://<be_ip>:8040/api/compact?compaction_type=base&tablet_id=<tablet_id>"
sql
-- Increase compaction throughput (v3.2+)
UPDATE information_schema.be_configs SET value = 8
WHERE name = 'max_compaction_concurrency';
UPDATE information_schema.be_configs SET value = 2
WHERE name = 'cumulative_compaction_check_interval_seconds';

Step B-3: Reduce import frequency if needed

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
78
Repository forks
14
7-day trend score
0

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/starrocks/starrocks-debug-skills/tablet/badge)](https://verified-skill.com/skills/starrocks/starrocks-debug-skills/tablet)

Something wrong with this skill or its page? Tell us.