@@ -138,6 +138,7 @@ func (op *httpsGetUpNodesOp) execute(execContext *opEngineExecContext) error {
138
138
func (op * httpsGetUpNodesOp ) processResult (execContext * opEngineExecContext ) error {
139
139
var allErrs error
140
140
upHosts := mapset .NewSet [string ]()
141
+ computeHosts := mapset .NewSet [string ]()
141
142
upScInfo := make (map [string ]string )
142
143
exceptionHosts := []string {}
143
144
downHosts := []string {}
@@ -148,8 +149,9 @@ func (op *httpsGetUpNodesOp) processResult(execContext *opEngineExecContext) err
148
149
op .logResponse (host , result )
149
150
if ! result .isPassing () {
150
151
allErrs = errors .Join (allErrs , result .err )
151
- if result .isUnauthorizedRequest () || result .isInternalError () {
152
- // Authentication error and any unexpected internal server error
152
+ if result .isUnauthorizedRequest () || result .isInternalError () || result .hasPreconditionFailed () {
153
+ // Authentication error and any unexpected internal server error, plus compute nodes or nodes
154
+ // that haven't joined the cluster yet
153
155
exceptionHosts = append (exceptionHosts , host )
154
156
continue
155
157
}
@@ -167,16 +169,15 @@ func (op *httpsGetUpNodesOp) processResult(execContext *opEngineExecContext) err
167
169
continue
168
170
}
169
171
170
- if op .cmdType == StopDBCmd || op .cmdType == StopSubclusterCmd {
171
- err = op .validateHosts (nodesStates )
172
- if err != nil {
173
- allErrs = errors .Join (allErrs , err )
174
- break
175
- }
172
+ // For certain commands, check hosts in input against those reported from endpoint
173
+ err = op .validateHosts (nodesStates )
174
+ if err != nil {
175
+ allErrs = errors .Join (allErrs , err )
176
+ break
176
177
}
177
178
178
179
// Collect all the up hosts
179
- err = op .collectUpHosts (nodesStates , host , upHosts , upScInfo , sandboxInfo , upScNodes , scNodes )
180
+ err = op .collectUpHosts (nodesStates , host , upHosts , computeHosts , upScInfo , sandboxInfo , upScNodes , scNodes )
180
181
if err != nil {
181
182
allErrs = errors .Join (allErrs , err )
182
183
return allErrs
@@ -190,6 +191,7 @@ func (op *httpsGetUpNodesOp) processResult(execContext *opEngineExecContext) err
190
191
break
191
192
}
192
193
}
194
+ execContext .computeHosts = computeHosts .ToSlice ()
193
195
execContext .nodesInfo = upScNodes .ToSlice ()
194
196
execContext .scNodesInfo = scNodes .ToSlice ()
195
197
execContext .upHostsToSandboxes = sandboxInfo
@@ -275,6 +277,10 @@ func (op *httpsGetUpNodesOp) processHostLists(upHosts mapset.Set[string], upScIn
275
277
276
278
// validateHosts can validate if hosts in user input matches the ones in GET /nodes response
277
279
func (op * httpsGetUpNodesOp ) validateHosts (nodesStates nodesStateInfo ) error {
280
+ // only needed for the following commands
281
+ if ! (op .cmdType == StopDBCmd || op .cmdType == StopSubclusterCmd ) {
282
+ return nil
283
+ }
278
284
var dbHosts []string
279
285
dbUnexpected := false
280
286
unexpectedDBName := ""
@@ -310,7 +316,7 @@ func (op *httpsGetUpNodesOp) checkUpHostEligible(node *nodeStateInfo) bool {
310
316
return true
311
317
}
312
318
313
- func (op * httpsGetUpNodesOp ) collectUpHosts (nodesStates nodesStateInfo , host string , upHosts mapset.Set [string ],
319
+ func (op * httpsGetUpNodesOp ) collectUpHosts (nodesStates nodesStateInfo , host string , upHosts , computeHosts mapset.Set [string ],
314
320
upScInfo , sandboxInfo map [string ]string , upScNodes , scNodes mapset.Set [NodeInfo ]) (err error ) {
315
321
foundSC := false
316
322
for _ , node := range nodesStates .NodeList {
@@ -333,6 +339,10 @@ func (op *httpsGetUpNodesOp) collectUpHosts(nodesStates nodesStateInfo, host str
333
339
}
334
340
}
335
341
342
+ if node .State == util .NodeComputeState {
343
+ computeHosts .Add (node .Address )
344
+ }
345
+
336
346
if op .scName == node .Subcluster {
337
347
op .sandbox = node .Sandbox
338
348
if node .IsPrimary {
0 commit comments