When ClickHouse shardNum shifts: validate both the range and server mapping
An integer-typed shard number does not by itself establish the provenance of distributed results.
Identifiers carry semantics
A distributed identifier's origin and allowed set are more specific than its integer type. Shifting every number can change which server a dashboard group or routing rule denotes. Truthound checks should treat the approved range and actual instance mapping as separate conditions. [1, 2, 3]
The plan-serialization control
The public ClickHouse issue combines distributed-plan and query-plan serialization settings in a two-shard reproduction. shardNum returns 0·1 instead of the expected 1·2. Preserve the configuration combination; the same stored data alone does not explain the shifted numbering. [1]
What the minimum-value check establishes
For illustrative approved numbers 1 and 2, a minimum of 1 satisfies the lower bound and 0 fails. Yet 1 and 2 could be swapped between actual servers while still satisfying the range. Keep the conclusion that a number is allowed separate from the conclusion that its provenance is correct. [1, 3]
Build evidence around the transition
Fix the allowed shard-number range and actual server mapping for each environment. Check both before and after a configuration change. Truthound Core's BetweenValidator can inspect the number column's bounds, followed by a separate comparison of server–number pairs with the approved mapping. It does not repair distributed-plan serialization. A control with changed settings should compare provenance as well as row values. [1, 2, 3]
Application conditions
Collect shard_number and actual server identities from the same distributed run, using the environment’s approved number-to-server mapping as an independent reference.
Alternatives
Collect actual server mappings in a control with plan-serialization settings changed.
Limitations
An allowed number can still be attached to the wrong shard. Truthound does not repair distributed-plan serialization.
Evidence
- Event checked
- Subject checked
- Modified
