@@ -16,6 +16,7 @@ import (
1616 "github.com/cockroachdb/cockroach/pkg/roachpb"
1717 "github.com/cockroachdb/cockroach/pkg/security/username"
1818 "github.com/cockroachdb/cockroach/pkg/settings"
19+ "github.com/cockroachdb/cockroach/pkg/sql"
1920 "github.com/cockroachdb/cockroach/pkg/sql/catalog"
2021 "github.com/cockroachdb/cockroach/pkg/sql/catalog/catenumpb"
2122 "github.com/cockroachdb/cockroach/pkg/sql/catalog/colinfo"
@@ -79,7 +80,7 @@ const (
7980type indexConsistencyCheck struct {
8081 indexConsistencyCheckApplicability
8182
82- flowCtx * execinfra. FlowCtx
83+ execCfg * sql. ExecutorConfig
8384 indexID descpb.IndexID
8485 // tableVersion is the descriptor version recorded when the check was planned.
8586 // It is used to detect concurrent schema changes for non-AS OF inspections.
@@ -255,7 +256,7 @@ func (c *indexConsistencyCheck) Start(
255256 }
256257 }
257258
258- if indexConsistencyHashEnabled .Get (& c .flowCtx . Cfg .Settings .SV ) && len (allColNames ) > 0 {
259+ if indexConsistencyHashEnabled .Get (& c .execCfg .Settings .SV ) && len (allColNames ) > 0 {
259260 // The hash precheck uses crdb_internal.datums_to_bytes, which depends on
260261 // keyside.Encode. Skip if any column type isn’t encodable (i.e. TSQUERY, etc.).
261262 if ! allColumnsDatumsToBytesCompatible (c .columns ) {
@@ -298,8 +299,8 @@ func (c *indexConsistencyCheck) Start(
298299 c .lastQueryPlaceholders = queryArgs
299300
300301 // Execute the query with AS OF SYSTEM TIME embedded in the SQL
301- qos := getInspectQoS (& c .flowCtx . Cfg .Settings .SV )
302- it , err := c .flowCtx . Cfg .DB .Executor ().QueryIteratorEx (
302+ qos := getInspectQoS (& c .execCfg .Settings .SV )
303+ it , err := c .execCfg . DistSQLSrv .DB .Executor ().QueryIteratorEx (
303304 ctx , "inspect-index-consistency-check" , nil , /* txn */
304305 sessiondata.InternalExecutorOverride {
305306 User : username .NodeUserName (),
@@ -457,7 +458,7 @@ func (c *indexConsistencyCheck) Rows() uint64 {
457458// eligible for consistency checking. If the index is valid, it stores the
458459// descriptor and index metadata in the indexConsistencyCheck struct.
459460func (c * indexConsistencyCheck ) loadCatalogInfo (ctx context.Context ) error {
460- return c .flowCtx . Cfg .DB .DescsTxn (ctx , func (ctx context.Context , txn descs.Txn ) error {
461+ return c .execCfg . DistSQLSrv .DB .DescsTxn (ctx , func (ctx context.Context , txn descs.Txn ) error {
461462 if ! c .asOf .IsEmpty () {
462463 if err := txn .KV ().SetFixedTimestamp (ctx , c .asOf ); err != nil {
463464 return err
@@ -813,8 +814,8 @@ func (c *indexConsistencyCheck) computeHashAndRowCount(
813814 query := buildIndexHashQuery (c .tableDesc .GetID (), index , columnNames , predicate )
814815 queryWithAsOf := fmt .Sprintf ("SELECT * FROM (%s) AS OF SYSTEM TIME %s" , query , c .asOf .AsOfSystemTime ())
815816
816- qos := getInspectQoS (& c .flowCtx . Cfg .Settings .SV )
817- row , err := c .flowCtx . Cfg .DB .Executor ().QueryRowEx (
817+ qos := getInspectQoS (& c .execCfg .Settings .SV )
818+ row , err := c .execCfg . DistSQLSrv .DB .Executor ().QueryRowEx (
818819 ctx , "inspect-index-consistency-hash" , nil , /* txn */
819820 sessiondata.InternalExecutorOverride {
820821 User : username .NodeUserName (),
0 commit comments