mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-03-11 15:34:56 +00:00
{app/vmselect,app/vminsert}: ensure -storageNodes
flag has no empty values (#3291)
This commit is contained in:
parent
be0aaa1e93
commit
7afa67dba0
2 changed files with 24 additions and 0 deletions
|
@ -85,6 +85,9 @@ func main() {
|
|||
if len(*storageNodes) == 0 {
|
||||
logger.Fatalf("missing -storageNode arg")
|
||||
}
|
||||
if hasEmptyValues(*storageNodes) {
|
||||
logger.Fatalf("found empty address of storage node in the -storageNodes flag, please make sure that all -storageNode args are non-empty")
|
||||
}
|
||||
if duplicatedAddr := checkDuplicates(*storageNodes); duplicatedAddr != "" {
|
||||
logger.Fatalf("found equal addresses of storage nodes in the -storageNodes flag: %q", duplicatedAddr)
|
||||
}
|
||||
|
@ -368,3 +371,12 @@ func checkDuplicates(arr []string) string {
|
|||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func hasEmptyValues(arr []string) bool {
|
||||
for _, s := range arr {
|
||||
if s == "" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -88,6 +88,9 @@ func main() {
|
|||
if len(*storageNodes) == 0 {
|
||||
logger.Fatalf("missing -storageNode arg")
|
||||
}
|
||||
if hasEmptyValues(*storageNodes) {
|
||||
logger.Fatalf("found empty address of storage node in the -storageNodes flag, please make sure that all -storageNode args are non-empty")
|
||||
}
|
||||
if duplicatedAddr := checkDuplicates(*storageNodes); duplicatedAddr != "" {
|
||||
logger.Fatalf("found equal addresses of storage nodes in the -storageNodes flag: %q", duplicatedAddr)
|
||||
}
|
||||
|
@ -789,3 +792,12 @@ func checkDuplicates(arr []string) string {
|
|||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func hasEmptyValues(arr []string) bool {
|
||||
for _, s := range arr {
|
||||
if s == "" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue