Skip to content

Commit

Permalink
sql: use CachedReader for uses with sqlinstance and the sql builtin
Browse files Browse the repository at this point in the history
The CachedReader won't block, which in multi-region clusters is good. It will
mean that in some cases, it'll state that a sessions is alive when it most
certainly is not. Currently, nobody needs synchronous semantics.

This is a major part of fixing the TestColdStartLatency as sometimes
distsql planning would block. That's not acceptable -- the idea that
query physical planning can need to wait for a cross-region RPC is
unacceptable.

Release note: None
  • Loading branch information
ajwerner committed Mar 14, 2023
1 parent 4f8a911 commit f4c6eba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/server/server_sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ func newSQLServer(ctx context.Context, cfg sqlServerArgs) (*SQLServer, error) {
cfg.clock, cfg.rangeFeedFactory,
)
cfg.sqlInstanceReader = instancestorage.NewReader(
cfg.sqlInstanceStorage, cfg.sqlLivenessProvider.BlockingReader(),
cfg.sqlInstanceStorage, cfg.sqlLivenessProvider.CachedReader(),
cfg.stopper,
)

Expand Down Expand Up @@ -789,7 +789,7 @@ func newSQLServer(ctx context.Context, cfg sqlServerArgs) (*SQLServer, error) {
RowMetrics: &rowMetrics,
InternalRowMetrics: &internalRowMetrics,

SQLLivenessReader: cfg.sqlLivenessProvider.BlockingReader(),
SQLLivenessReader: cfg.sqlLivenessProvider.CachedReader(),
JobRegistry: jobRegistry,
Gossip: cfg.gossip,
PodNodeDialer: cfg.podNodeDialer,
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/planner.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (evalCtx *extendedEvalContext) copyFromExecCfg(execCfg *ExecutorConfig) {
evalCtx.Settings = execCfg.Settings
evalCtx.Codec = execCfg.Codec
evalCtx.Tracer = execCfg.AmbientCtx.Tracer
evalCtx.SQLLivenessReader = execCfg.SQLLiveness.BlockingReader()
evalCtx.SQLLivenessReader = execCfg.SQLLiveness.CachedReader()
evalCtx.CompactEngineSpan = execCfg.CompactEngineSpanFunc
evalCtx.SetCompactionConcurrency = execCfg.CompactionConcurrencyFunc
evalCtx.TestingKnobs = execCfg.EvalContextTestingKnobs
Expand Down

0 comments on commit f4c6eba

Please sign in to comment.