Skip to content

Commit

Permalink
Revert "server: lift jobAdoptionStopFile declaration out of SQL server"
Browse files Browse the repository at this point in the history
This reverts commit dab29d9.

It also fixes #90524.

Release note: None
  • Loading branch information
knz committed Oct 31, 2022
1 parent c3b62c8 commit c3e4435
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
10 changes: 0 additions & 10 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
12 changes: 10 additions & 2 deletions pkg/server/server_sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
)
Expand Down

0 comments on commit c3e4435

Please sign in to comment.