Commit 1917e63
fix(cutover): make finalize.sh empty-row guard cluster-aware
Follow-up to the cluster-aware detection: the LIVE_ROWS/BACKUP_ROWS emptiness guard still
counted on the connected replica only, so the "refuse if live is empty but the backup holds
data" check reflected one node, not the cluster — inconsistent with the clusterAllReplicas
detection in the same script (Baz review). Add a max_rows() helper that takes the max row
count across replicas (clusterAllReplicas grouped by host; fail-loud on a down replica, like
classify) and use it for both counts.
Behavior is unchanged on a single replica (max over one host = that host's count); on
multi-replica it now reflects the most-caught-up replica, so a lagging/empty connected node
can no longer skew the guard. The post-cutover DROP path's Distributed `traces` already
aggregates the cluster and the max-over-hosts still yields its true total. Guard still fails
safe either way. Validated live: max_rows returns the correct counts against the single-node
estate; bash -n clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent e8058eb commit 1917e63
1 file changed
Lines changed: 14 additions & 5 deletions
Lines changed: 14 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
79 | 88 | | |
80 | 89 | | |
81 | 90 | | |
| |||
97 | 106 | | |
98 | 107 | | |
99 | 108 | | |
100 | | - | |
101 | | - | |
| 109 | + | |
| 110 | + | |
102 | 111 | | |
103 | | - | |
| 112 | + | |
104 | 113 | | |
105 | 114 | | |
106 | 115 | | |
| |||
0 commit comments