Skip to content

Commit 400eb81

Browse files
Remove remaining references to internal_stack (fixed) (#3649)
- **Reapply "Remove remaining references to internal_stack (#3633)" (#3645)** - **fix it** TODO: Fire the original the reviewer of #3633 Signed-off-by: Martin Florian <martin.florian@digitalasset.com>
1 parent d06a245 commit 400eb81

File tree

4 files changed

+41
-57
lines changed

4 files changed

+41
-57
lines changed

build-tools/cncluster

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,23 +1735,16 @@ subcommand_whitelist[backup_nodes]='Backup one or more CN nodes in the cluster'
17351735
function subcmd_backup_nodes() {
17361736
_cluster_must_exist
17371737

1738-
if [ "$#" -lt 2 ]; then
1739-
echo "Usage: $0 <migration_id> <internal_stack> [node...]"
1738+
if [ "$#" -lt 1 ]; then
1739+
echo "Usage: $0 <migration_id> [node...]"
17401740
exit 1
17411741
fi
17421742

17431743
if [[ ! "$1" =~ ^[0-9]+$ ]]; then
17441744
echo "Usage: $0 <migration_id> [node...]"
17451745
_error "<migration_id> must be a positive integer"
17461746
fi
1747-
1748-
if [[ "$2" != "true" && "$2" != "false" ]]; then
1749-
echo "Usage: $0 <internal_stack> [node...]"
1750-
_error "<internal_stack> must be either \"true\" or \"false\""
1751-
fi
1752-
17531747
migration_id=$1
1754-
internal_stack=$2
17551748

17561749
if [ $# -eq 2 ]; then
17571750
nodes="sv-1 sv-2 sv-3 sv-da-1 validator1 splitwell"
@@ -1764,11 +1757,11 @@ function subcmd_backup_nodes() {
17641757
case "$node" in
17651758
sv-1|sv-2|sv-3|sv-4|sv-da-1)
17661759
_info "Backing up sv node $node"
1767-
SPLICE_SV=$node SPLICE_MIGRATION_ID=$migration_id "$SPLICE_ROOT"/cluster/scripts/node-backup.sh sv "$node" "$migration_id" "$internal_stack"
1760+
SPLICE_SV=$node SPLICE_MIGRATION_ID=$migration_id "$SPLICE_ROOT"/cluster/scripts/node-backup.sh sv "$node" "$migration_id"
17681761
;;
17691762
validator1|splitwell)
17701763
_info "Backing up validator node $node"
1771-
SPLICE_SV=$node SPLICE_MIGRATION_ID=$migration_id "$SPLICE_ROOT"/cluster/scripts/node-backup.sh validator "$node" "$migration_id" "$internal_stack"
1764+
SPLICE_SV=$node SPLICE_MIGRATION_ID=$migration_id "$SPLICE_ROOT"/cluster/scripts/node-backup.sh validator "$node" "$migration_id"
17721765
;;
17731766
*)
17741767
_error "Unknown node $node"
@@ -1805,16 +1798,15 @@ function subcmd_restore_node() {
18051798

18061799
node="${1-}"
18071800
migration_id="${2-}"
1808-
internal_stack="${3-}"
1809-
backup_run_id="${4-}"
1801+
backup_run_id="${3-}"
18101802

18111803
if [ -z "$node" ] || [ -z "$migration_id" ]; then
1812-
_error "Usage: $SCRIPTNAME restore_node <namespace_name> <migration_id> <internal_stack> [<backup_run_id>]"
1804+
_error "Usage: $SCRIPTNAME restore_node <namespace_name> <migration_id> [<backup_run_id>]"
18131805
fi
18141806

18151807
if [ -z "$backup_run_id" ]; then
18161808
_info "No backup run_id given, looking for the latest full backup"
1817-
backup_run_id=$(SPLICE_SV=$node SPLICE_MIGRATION_ID=$migration_id "$SPLICE_ROOT"/cluster/scripts/find-recent-backup.sh "$node" "$migration_id" "$internal_stack")
1809+
backup_run_id=$(SPLICE_SV=$node SPLICE_MIGRATION_ID=$migration_id "$SPLICE_ROOT"/cluster/scripts/find-recent-backup.sh "$node" "$migration_id")
18181810
if [[ -z "$backup_run_id" || "$backup_run_id" == "null" ]]; then
18191811
_error "No recent backup found for $node"
18201812
fi
@@ -1831,11 +1823,11 @@ function subcmd_restore_node() {
18311823
_info "Silencing SV report creation alerts for $sv_name for 1 hour"
18321824
subcmd_silence_grafana_alerts "1 hour" "alertname=Report Creation Time Lag" "report_publisher=$sv_name"
18331825
_info "Restoring sv node $node"
1834-
SPLICE_SV=$node SPLICE_MIGRATION_ID=$migration_id "$SPLICE_ROOT"/cluster/scripts/node-restore.sh $force "$node" "$migration_id" "$backup_run_id" "$internal_stack" cometbft sequencer participant mediator cn-apps
1826+
SPLICE_SV=$node SPLICE_MIGRATION_ID=$migration_id "$SPLICE_ROOT"/cluster/scripts/node-restore.sh $force "$node" "$migration_id" "$backup_run_id" cometbft sequencer participant mediator cn-apps
18351827
;;
18361828
validator1|splitwell)
18371829
_info "Restoring validator node $node"
1838-
SPLICE_SV=$node SPLICE_MIGRATION_ID=$migration_id "$SPLICE_ROOT"/cluster/scripts/node-restore.sh $force "$node" "$migration_id" "$backup_run_id" "$internal_stack" participant validator
1830+
SPLICE_SV=$node SPLICE_MIGRATION_ID=$migration_id "$SPLICE_ROOT"/cluster/scripts/node-restore.sh $force "$node" "$migration_id" "$backup_run_id" participant validator
18391831
;;
18401832
*)
18411833
_error "Unknown node $node"

cluster/scripts/find-recent-backup.sh

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ source "${TOOLS_LIB}/libcli.source"
1111
source "${SPLICE_ROOT}/cluster/scripts/utils.source"
1212

1313
function usage() {
14-
_info "Usage: $0 <namespace> <migration_id> <internal (true|false)>"
14+
_info "Usage: $0 <namespace> <migration_id>"
1515
}
1616

1717
function is_full_backup_kube() {
@@ -64,16 +64,15 @@ function latest_full_backup_run_id_gcloud() {
6464
local migration_id=$2
6565
local is_sv=$3
6666
local expected_components=$4
67-
local internal=$5
6867
local num_components
6968
num_components=$(echo "$expected_components" | wc -w)
7069
local stack
7170

7271
declare -A run_ids_dict
7372

7473
for component in $expected_components; do
75-
stack=$(get_stack_for_namespace_component "$namespace" "$component" "$internal")
76-
instance="$(create_component_instance "$component" "$migration_id" "$namespace" "$internal")"
74+
stack=$(get_stack_for_namespace_component "$namespace" "$component")
75+
instance="$(create_component_instance "$component" "$migration_id" "$namespace")"
7776
local full_component_instance="$namespace-$instance-pg"
7877

7978
local cloudsql_id
@@ -110,27 +109,26 @@ function latest_full_backup_run_id_gcloud() {
110109
}
111110

112111
function main() {
113-
if [ "$#" -lt 3 ]; then
112+
if [ "$#" -lt 2 ]; then
114113
usage
115114
exit 1
116115
fi
117116

118117
local namespace=$1
119118
local migration_id=$2
120-
local internal=$3
121119

122120
case "$namespace" in
123121
sv-1|sv-2|sv-3|sv-4|sv-da-1)
124122
is_sv=true
125123
full_instance="$namespace-cn-apps-pg"
126124
expected_components="cn-apps sequencer participant mediator"
127-
stack=$(get_stack_for_namespace_component "$namespace" "cn-apps" "$internal")
125+
stack=$(get_stack_for_namespace_component "$namespace" "cn-apps")
128126
;;
129127
*)
130128
is_sv=false
131129
full_instance="$namespace-validator-pg"
132130
expected_components="validator participant"
133-
stack=$(get_stack_for_namespace_component "$namespace" "participant" "$internal")
131+
stack=$(get_stack_for_namespace_component "$namespace" "participant")
134132
;;
135133
esac
136134

@@ -140,7 +138,7 @@ function main() {
140138
backup_run_id=$(latest_full_backup_run_id_kube "$namespace" "$migration_id" "$is_sv" "$expected_components")
141139
echo "$backup_run_id"
142140
elif [ "$type" == "canton:cloud:postgres" ]; then
143-
backup_run_id=$(latest_full_backup_run_id_gcloud "$namespace" "$migration_id" "$is_sv" "$expected_components" "$internal")
141+
backup_run_id=$(latest_full_backup_run_id_gcloud "$namespace" "$migration_id" "$is_sv" "$expected_components")
144142
echo "$backup_run_id"
145143
elif [ -z "$type" ]; then
146144
_error "No postgres instance $full_instance found in stack ${stack}. Is the cluster deployed with split DB instances?"

cluster/scripts/node-backup.sh

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -208,17 +208,16 @@ function backup_component() {
208208
local component=$2
209209
local requested_component=$3
210210
local migration_id=$4
211-
local internal=$5
212211

213212
local stack
214-
stack=$(get_stack_for_namespace_component "$namespace" "$component" "$internal")
213+
stack=$(get_stack_for_namespace_component "$namespace" "$component")
215214

216215
if [ "$component" == "$requested_component" ] || [ -z "$requested_component" ]; then
217216
if [ "$component" == "cometbft-$migration_id" ]; then
218217
backup_pvc "cometBFT" "$namespace" "global-domain-$migration_id-cometbft-cometbft-data" "$migration_id"
219218
else
220219
local db_name
221-
db_name=$(create_component_instance "$component" "$migration_id" "$namespace" "$internal")
220+
db_name=$(create_component_instance "$component" "$migration_id" "$namespace")
222221
SPLICE_SV=$namespace SPLICE_MIGRATION_ID=$migration_id backup_postgres "$component" "$namespace" "$db_name-pg" "$migration_id" "$stack"
223222
fi
224223
else
@@ -231,16 +230,15 @@ function wait_for_backup() {
231230
local component=$2
232231
local requested_component=$3
233232
local migration_id=$4
234-
local internal=$5
235233

236234
local stack
237-
stack=$(get_stack_for_namespace_component "$namespace" "$component" "$internal")
235+
stack=$(get_stack_for_namespace_component "$namespace" "$component")
238236

239237
if [ "$component" == "$requested_component" ] || [ -z "$requested_component" ]; then
240238
if [ "$component" == "cometbft-$migration_id" ]; then
241239
wait_for_pvc_backup "cometBFT" "$namespace" "global-domain-$migration_id-cometbft-cometbft-data"
242240
else
243-
instance=$(create_component_instance "$component" "$migration_id" "$namespace" "$internal")
241+
instance=$(create_component_instance "$component" "$migration_id" "$namespace")
244242
wait_for_postgres_backup "$component" "$namespace" "$instance-pg" "$migration_id" "$stack"
245243
fi
246244
else
@@ -249,45 +247,44 @@ function wait_for_backup() {
249247
}
250248

251249
function usage() {
252-
echo "Usage: $0 <sv|validator> <namespace> <migration id> <internal (true|false)> [<component_name>]"
250+
echo "Usage: $0 <sv|validator> <namespace> <migration id> [<component_name>]"
253251
}
254252

255253
function main() {
256-
if [ "$#" -lt 4 ]; then
254+
if [ "$#" -lt 3 ]; then
257255
usage
258256
exit 1
259257
fi
260258

261259
local namespace=$2
262260
local migration_id=$3
263-
local internal=$4 # "true" for internal stack, "false" for external stack
264-
local requested_component="${5:-}"
261+
local requested_component="${4:-}"
265262

266263
# TODO(#9361): support multiple domains / non-default-ID'd ones
267264
if [ "$1" == "validator" ]; then
268265
_info "Backing up validator $namespace"
269-
backup_component "$namespace" "validator" "$requested_component" "$migration_id" "$internal"
270-
wait_for_backup "$namespace" "validator" "$requested_component" "$migration_id" "$internal"
266+
backup_component "$namespace" "validator" "$requested_component" "$migration_id"
267+
wait_for_backup "$namespace" "validator" "$requested_component" "$migration_id"
271268
# CN apps must be strictly before participant, so we sync on apps before starting the participant backup
272-
backup_component "$namespace" "participant" "$requested_component" "$migration_id" "$internal"
273-
wait_for_backup "$namespace" "participant" "$requested_component" "$migration_id" "$internal"
269+
backup_component "$namespace" "participant" "$requested_component" "$migration_id"
270+
wait_for_backup "$namespace" "participant" "$requested_component" "$migration_id"
274271
elif [ "$1" == "sv" ]; then
275272
_info "Backing up SV node $namespace"
276273

277-
backup_component "$namespace" "cn-apps" "$requested_component" "$migration_id" "$internal"
278-
backup_component "$namespace" "mediator" "$requested_component" "$migration_id" "$internal"
279-
backup_component "$namespace" "sequencer" "$requested_component" "$migration_id" "$internal"
280-
backup_component "$namespace" "cometbft-$migration_id" "$requested_component" "$migration_id" "$internal"
274+
backup_component "$namespace" "cn-apps" "$requested_component" "$migration_id"
275+
backup_component "$namespace" "mediator" "$requested_component" "$migration_id"
276+
backup_component "$namespace" "sequencer" "$requested_component" "$migration_id"
277+
backup_component "$namespace" "cometbft-$migration_id" "$requested_component" "$migration_id"
281278

282-
wait_for_backup "$namespace" "cn-apps" "$requested_component" "$migration_id" "$internal"
279+
wait_for_backup "$namespace" "cn-apps" "$requested_component" "$migration_id"
283280

284281
# CN apps must be strictly before participant, so we sync on apps before starting the participant backup
285-
backup_component "$namespace" "participant" "$requested_component" "$migration_id" "$internal"
282+
backup_component "$namespace" "participant" "$requested_component" "$migration_id"
286283

287-
wait_for_backup "$namespace" "participant" "$requested_component" "$migration_id" "$internal"
288-
wait_for_backup "$namespace" "mediator" "$requested_component" "$migration_id" "$internal"
289-
wait_for_backup "$namespace" "sequencer" "$requested_component" "$migration_id" "$internal"
290-
wait_for_backup "$namespace" "cometbft-$migration_id" "$requested_component" "$migration_id" "$internal"
284+
wait_for_backup "$namespace" "participant" "$requested_component" "$migration_id"
285+
wait_for_backup "$namespace" "mediator" "$requested_component" "$migration_id"
286+
wait_for_backup "$namespace" "sequencer" "$requested_component" "$migration_id"
287+
wait_for_backup "$namespace" "cometbft-$migration_id" "$requested_component" "$migration_id"
291288
else
292289
usage
293290
exit 1

cluster/scripts/utils.source

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,14 @@ function get_cloudsql_id() {
2727
function get_stack_for_namespace_component() {
2828
local namespace=$1
2929
local component=$2
30-
local internal=$3
3130

3231
local stack=""
3332
if [[ "${namespace}" =~ sv.* ]]; then
34-
if [[ "${component}" == "participant" && "${internal}" != "true" ]]; then
33+
if [[ "${component}" == "participant" ]]; then
3534
stack="sv-canton"
36-
elif [[ "${component}" == "sequencer" && "${internal}" != "true" ]]; then
35+
elif [[ "${component}" == "sequencer" ]]; then
3736
stack="sv-canton"
38-
elif [[ "${component}" == "mediator" && "${internal}" != "true" ]]; then
37+
elif [[ "${component}" == "mediator" ]]; then
3938
stack="sv-canton"
4039
else
4140
stack="canton-network"
@@ -51,11 +50,9 @@ create_component_instance() {
5150
local component="$1"
5251
local migration_id="$2"
5352
local namespace="$3"
54-
local internal="$4"
5553

5654
if [[ ("$component" == "sequencer" || "$component" == "mediator" || "$component" == "participant")
57-
&& ("$namespace" != "splitwell" && "$namespace" != "validator1" && "$namespace" != "sv")
58-
&& ("$internal" != "true") ]]; then
55+
&& ("$namespace" != "splitwell" && "$namespace" != "validator1" && "$namespace" != "sv"); then
5956
component_instance="${component}-${migration_id}"
6057
else
6158
component_instance="${component}"

0 commit comments

Comments
 (0)