diff --git a/README.md b/README.md index 3f7637a..9b36a71 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,6 @@ ydbops restart --storage \ ``` ## How to create a new version -### In Github 1. Define new semver version number (e.g. 1.1.0) 2. Update CHANGELOG.md with proper information about new version. Add the following to the beginning of the file, before previous entries: ``` diff --git a/pkg/rolling/options.go b/pkg/rolling/options.go index 4d1f226..fc4afe0 100644 --- a/pkg/rolling/options.go +++ b/pkg/rolling/options.go @@ -184,7 +184,10 @@ after that would be considered a regular cluster failure`) fmt.Sprintf("How often to query CMS while waiting for new permissions %v", DefaultCMSQueryIntervalSeconds)) fs.StringVar(&startedUnparsedFlag, "started", "", - fmt.Sprintf("Apply filter by node started time. Format: [<>%%Y-%%m-%%dT%%H:%%M:%%SZ], e.g. >2024-03-13T17:20:06Z")) + fmt.Sprintf(`Apply filter by node started time. +Format: "<>%%Y-%%m-%%dT%%H:%%M:%%SZ", quotes are necessary, otherwise shell treats '<' or '>' as stream redirection. +For example, --started ">2024-03-13T17:20:06Z" means all nodes started LATER than 2024 March 13, 17:20:06 UTC. +If you reverse the sign (--started ">2024-03-13T17:20:06Z"), you will select nodes with LARGER uptimes.`)) fs.StringVar(&versionUnparsedFlag, "version", "", `Apply filter by node version. diff --git a/pkg/rolling/restarters/primitives.go b/pkg/rolling/restarters/primitives.go index 3e74650..f4bffff 100644 --- a/pkg/rolling/restarters/primitives.go +++ b/pkg/rolling/restarters/primitives.go @@ -82,6 +82,14 @@ func SatisfiesStartingTime(node *Ydb_Maintenance.Node, startedTime *options.Star nodeStartTime := node.GetStartTime().AsTime() + if nodeStartTime.IsZero() { + zap.S().Warnf( + "Node %s did not have startTime specified by CMS (possibly an old YDB version). Avoid using --started filter on current YDB cluster", + node.Host, + ) + return false + } + if startedTime.Direction == '<' { return startedTime.Timestamp.After(nodeStartTime) } @@ -139,6 +147,14 @@ func ExcludeByCommonFields(nodes []*Ydb_Maintenance.Node, spec FilterNodeParams) } if spec.Version != nil { + if node.Version == "" { + zap.S().Warnf( + "Node %s did not have version field specified by CMS (possibly an old YDB version). Avoid using --version filter on current YDB cluster", + node.Host, + ) + continue + } + satisfiesVersion, err := spec.Version.Satisfies(node.Version) if err != nil { unknownVersions[node.Version] = append(unknownVersions[node.Version], node.Host)