Skip to content

Commit

Permalink
[PBM-1356] split requirements and warnings on agent start
Browse files Browse the repository at this point in the history
  • Loading branch information
defbin committed Sep 12, 2024
1 parent 5bb76da commit de1369b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 6 additions & 8 deletions cmd/pbm-agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,16 @@ func (a *Agent) CanStart(ctx context.Context) error {
return ErrDelayedNode
}

ver, err := version.GetMongoVersion(ctx, a.leadConn.MongoClient())
if err != nil {
return errors.Wrap(err, "get mongo version")
}
if err := version.FeatureSupport(ver).PBMSupport(); err != nil {
return nil
}

func (a *Agent) showIncompatibilityWarning(ctx context.Context) {
if err := version.FeatureSupport(a.brief.Version).PBMSupport(); err != nil {
log.FromContext(ctx).
Warning("", "", "", primitive.Timestamp{}, "WARNING: %v", err)
}

if ver.IsShardedTimeseriesSupported() {
if a.brief.Version.IsShardedTimeseriesSupported() {
tss, err := topo.ListShardedTimeseries(ctx, a.leadConn)
if err != nil {
log.FromContext(ctx).
Expand All @@ -131,8 +131,6 @@ func (a *Agent) CanStart(ctx context.Context) error {
strings.Join(tss, ", "))
}
}

return nil
}

// Start starts listening the commands stream.
Expand Down
2 changes: 2 additions & 0 deletions cmd/pbm-agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ func runAgent(mongoURI string, dumpConns int) error {
return errors.Wrap(err, "setup pbm collections")
}

agent.showIncompatibilityWarning(ctx)

if canRunSlicer {
go agent.PITR(ctx)
}
Expand Down

0 comments on commit de1369b

Please sign in to comment.