cockroachdb / cockroachdb/cockroach

kvserver/reports: constraint report ignores VoterConstraints

Open
#171,018 1 comment 0 reactions 0 assignees View on GitHub
A-kv branch-master C-bug O-support
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

**Describe the problem**

The constraint conformance report visitor only [checks](https://github.com/cockroachdb/cockroach/blob/5089daed468db4c822643ff008cba170ba7beed5/pkg/kv/kvserver/reports/constraint_stats_report.go#L473-L475) `zone.Constraints == nil` to decide whether a subzone's config applies. For RBR partition subzones that define `VoterConstraints` but inherit `Constraints` from the parent config (i.e. `Constraints` is nil), the visitor skips the subzone and walks up to the parent.

This causes the `system.replication_constraint_stats` table report voter constraint violations attributed to the parent zone, instead of correctly observing conformance in the partition subzone.

**To Reproduce**

1. Create a multi-region database with a primary region and a secondary region.
2. Create an RBR table — this produces partition subzones with `VoterConstraints` set but `Constraints` inherited (nil) from the database zone.
3. Query `system.replication_constraint_stats`.
4. Observe that voter constraint entries are attributed to the database zone (`zone_id` = database ID, `subzone_id` = 0) instead of the table's partition subzones.

Repro: #170384

**Expected behavior**

Voter constraint entries in `system.replication_constraint_stats` should be attributed to the partition subzone that defines the `VoterConstraints`, not the parent database zone.

Epic: none

Jira issue: CRDB-64281

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.