diff --git a/CHANGELOG.md b/CHANGELOG.md index e63da16c..e2e01406 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Resuming an already unpaused queue is now fully an no-op, and won't touch the row's `updated_at` like it (unintentionally) did before. [PR #870](https://github.com/riverqueue/river/pull/870). - Suppress an error log line from the producer that may occur on normal shutdown when operating in poll-only mode. [PR #896](https://github.com/riverqueue/river/pull/896). - Added missing help documentation for CLI command `river migrate-list`. [PR #903](https://github.com/riverqueue/river/pull/903). +- Correct handling an explicit schema in the reindexer maintenance service. [PR #916](https://github.com/riverqueue/river/pull/916). ## [0.22.0] - 2025-05-10 diff --git a/internal/maintenance/reindexer.go b/internal/maintenance/reindexer.go index 1de4b0cf..9f868f8b 100644 --- a/internal/maintenance/reindexer.go +++ b/internal/maintenance/reindexer.go @@ -164,7 +164,7 @@ func (s *Reindexer) reindexOne(ctx context.Context, indexName string) error { var maybeSchema string if s.Config.Schema != "" { - maybeSchema = "." + s.Config.Schema + maybeSchema = s.Config.Schema + "." } _, err := s.exec.Exec(ctx, "REINDEX INDEX CONCURRENTLY "+maybeSchema+indexName) diff --git a/internal/maintenance/reindexer_test.go b/internal/maintenance/reindexer_test.go index f71f6cb5..2519c351 100644 --- a/internal/maintenance/reindexer_test.go +++ b/internal/maintenance/reindexer_test.go @@ -78,6 +78,16 @@ func TestReindexer(t *testing.T) { startstoptest.Stress(ctx, t, svc) }) + t.Run("ReindexesOne", func(t *testing.T) { + t.Parallel() + + svc, _ := setup(t) + + for _, indexName := range svc.Config.IndexNames { + require.NoError(t, svc.reindexOne(ctx, indexName)) + } + }) + t.Run("ReindexesEachIndex", func(t *testing.T) { t.Parallel()