From 6e9732fd5b74b5c517b2a5e378c4d58e7b9e7d87 Mon Sep 17 00:00:00 2001 From: Stuart Douglas Date: Thu, 12 Sep 2024 07:58:12 +1000 Subject: [PATCH] fix: consider the schema active even with no runners (#2650) --- backend/controller/dal/internal/sql/queries.sql | 5 ++--- backend/controller/dal/internal/sql/queries.sql.go | 3 +-- backend/runner/runner.go | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/backend/controller/dal/internal/sql/queries.sql b/backend/controller/dal/internal/sql/queries.sql index 52b581e2ba..f7da6b4c88 100644 --- a/backend/controller/dal/internal/sql/queries.sql +++ b/backend/controller/dal/internal/sql/queries.sql @@ -123,10 +123,9 @@ ORDER BY r.key; SELECT sqlc.embed(d), m.name AS module_name, m.language, COUNT(r.id) AS replicas FROM deployments d JOIN modules m ON d.module_id = m.id - JOIN runners r ON d.id = r.deployment_id + LEFT JOIN runners r ON d.id = r.deployment_id WHERE min_replicas > 0 AND r.state = 'assigned' -GROUP BY d.id, m.name, m.language -HAVING COUNT(r.id) > 0; +GROUP BY d.id, m.name, m.language; -- name: GetDeploymentsWithMinReplicas :many SELECT sqlc.embed(d), m.name AS module_name, m.language diff --git a/backend/controller/dal/internal/sql/queries.sql.go b/backend/controller/dal/internal/sql/queries.sql.go index b8e1fb1ee2..d13bbcfc63 100644 --- a/backend/controller/dal/internal/sql/queries.sql.go +++ b/backend/controller/dal/internal/sql/queries.sql.go @@ -557,10 +557,9 @@ const getActiveDeployments = `-- name: GetActiveDeployments :many SELECT d.id, d.created_at, d.module_id, d.key, d.schema, d.labels, d.min_replicas, m.name AS module_name, m.language, COUNT(r.id) AS replicas FROM deployments d JOIN modules m ON d.module_id = m.id - JOIN runners r ON d.id = r.deployment_id + LEFT JOIN runners r ON d.id = r.deployment_id WHERE min_replicas > 0 AND r.state = 'assigned' GROUP BY d.id, m.name, m.language -HAVING COUNT(r.id) > 0 ` type GetActiveDeploymentsRow struct { diff --git a/backend/runner/runner.go b/backend/runner/runner.go index 3835a8b453..925fe9db31 100644 --- a/backend/runner/runner.go +++ b/backend/runner/runner.go @@ -392,7 +392,7 @@ func (s *Service) registrationLoop(ctx context.Context, send func(request *ftlv1 s.state.Store(state) } - logger.Infof("Registering with Controller as %s for deployment %s", state, s.config.Deployment) + logger.Debugf("Registering with Controller as %s for deployment %s", state, s.config.Deployment) err := send(&ftlv1.RegisterRunnerRequest{ Key: s.key.String(), Endpoint: s.config.Advertise.String(),