From c3e443577df6324446c779f3403b8a7d9f73d4ec Mon Sep 17 00:00:00 2001 From: Raphael 'kena' Poss Date: Mon, 31 Oct 2022 15:03:47 +0100 Subject: [PATCH] Revert "server: lift jobAdoptionStopFile declaration out of SQL server" This reverts commit dab29d9d99e0404ec3eaa4954fe904412b0bd1f6. It also fixes #90524. Release note: None --- pkg/server/server.go | 10 ---------- pkg/server/server_sql.go | 12 ++++++++++-- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/pkg/server/server.go b/pkg/server/server.go index 18f45ed8c34b..ef8a0b3ec02d 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -805,15 +805,6 @@ func NewServer(cfg Config, stopper *stop.Stopper) (*Server, error) { internalExecutor, ) - // Configure the path to the file that blocks starting background jobs. - var jobAdoptionStopFile string - for _, spec := range cfg.Stores.Specs { - if !spec.InMemory && spec.Path != "" { - jobAdoptionStopFile = filepath.Join(spec.Path, jobs.PreventAdoptionFile) - break - } - } - // Instantiate the KV prober. kvProber := kvprober.NewProber(kvprober.Opts{ Tracer: cfg.AmbientCtx.Tracer, @@ -879,7 +870,6 @@ func NewServer(cfg Config, stopper *stop.Stopper) (*Server, error) { circularInternalExecutor: internalExecutor, internalExecutorFactory: internalExecutorFactory, circularJobRegistry: jobRegistry, - jobAdoptionStopFile: jobAdoptionStopFile, protectedtsProvider: protectedtsProvider, rangeFeedFactory: rangeFeedFactory, sqlStatusServer: sStatus, diff --git a/pkg/server/server_sql.go b/pkg/server/server_sql.go index ae83f379e413..643e66bd25f3 100644 --- a/pkg/server/server_sql.go +++ b/pkg/server/server_sql.go @@ -325,7 +325,6 @@ type sqlServerArgs struct { // pointer to an empty struct in this configuration, which newSQLServer // fills. circularJobRegistry *jobs.Registry - jobAdoptionStopFile string // The executorConfig uses the provider. protectedtsProvider protectedts.Provider @@ -442,6 +441,15 @@ func newSQLServer(ctx context.Context, cfg sqlServerArgs) (*SQLServer, error) { codec = keys.MakeSQLCodec(override) } } + + var jobAdoptionStopFile string + for _, spec := range cfg.Stores.Specs { + if !spec.InMemory && spec.Path != "" { + jobAdoptionStopFile = filepath.Join(spec.Path, jobs.PreventAdoptionFile) + break + } + } + // Create blob service for inter-node file sharing. blobService, err := blobs.NewBlobService(cfg.Settings.ExternalIODir) if err != nil { @@ -531,7 +539,7 @@ func newSQLServer(ctx context.Context, cfg sqlServerArgs) (*SQLServer, error) { // in sql/jobs/registry.go on planHookMaker. return sql.MakeJobExecContext(opName, user, &sql.MemoryMetrics{}, execCfg) }, - cfg.jobAdoptionStopFile, + jobAdoptionStopFile, td, jobsKnobs, )