@@ -62,6 +62,7 @@ import (
6262 "github.com/cockroachdb/cockroach/pkg/sql/sem/tree"
6363 "github.com/cockroachdb/cockroach/pkg/sql/sessiondata"
6464 "github.com/cockroachdb/cockroach/pkg/sql/sessiondatapb"
65+ "github.com/cockroachdb/cockroach/pkg/sql/sessionmutator"
6566 "github.com/cockroachdb/cockroach/pkg/sql/sessionphase"
6667 "github.com/cockroachdb/cockroach/pkg/sql/sqlerrors"
6768 "github.com/cockroachdb/cockroach/pkg/sql/sqlstats"
@@ -901,12 +902,12 @@ func (s *Server) SetupConn(
901902 sds := sessiondata .NewStack (sd )
902903 // Set the SessionData from args.SessionDefaults. This also validates the
903904 // respective values.
904- sdMutIterator := makeSessionDataMutatorIterator (sds , args .SessionDefaults , s .cfg .Settings )
905- sdMutIterator .onDefaultIntSizeChange = onDefaultIntSizeChange
906- if err := sdMutIterator .applyOnEachMutatorError (func (m sessionDataMutator ) error {
905+ sdMutIterator := sessionmutator . MakeSessionDataMutatorIterator (sds , args .SessionDefaults , s .cfg .Settings )
906+ sdMutIterator .OnDefaultIntSizeChange = onDefaultIntSizeChange
907+ if err := sdMutIterator .ApplyOnEachMutatorError (func (m sessionmutator. SessionDataMutator ) error {
907908 for varName , v := range varGen {
908909 if v .Set != nil {
909- hasDefault , defVal := getSessionVarDefaultString (varName , v , m .sessionDataMutatorBase )
910+ hasDefault , defVal := getSessionVarDefaultString (varName , v , m .SessionDataMutatorBase )
910911 if hasDefault {
911912 if err := v .Set (ctx , m , defVal ); err != nil {
912913 return err
@@ -1032,7 +1033,7 @@ func (h ConnectionHandler) GetParamStatus(ctx context.Context, varName string) s
10321033 log .Dev .Fatalf (ctx , "programming error: status param %q must be defined session var" , varName )
10331034 return ""
10341035 }
1035- hasDefault , defVal := getSessionVarDefaultString (name , v , h .ex .dataMutatorIterator .sessionDataMutatorBase )
1036+ hasDefault , defVal := getSessionVarDefaultString (name , v , h .ex .dataMutatorIterator .SessionDataMutatorBase )
10361037 if ! hasDefault {
10371038 log .Dev .Fatalf (ctx , "programming error: status param %q must have a default value" , varName )
10381039 return ""
@@ -1119,7 +1120,7 @@ func populateMinimalSessionData(sd *sessiondata.SessionData) {
11191120func (s * Server ) newConnExecutor (
11201121 ctx context.Context ,
11211122 executorType executorType ,
1122- sdMutIterator * sessionDataMutatorIterator ,
1123+ sdMutIterator * sessionmutator. SessionDataMutatorIterator ,
11231124 stmtBuf * StmtBuf ,
11241125 clientComm ClientComm ,
11251126 memMetrics MemoryMetrics ,
@@ -1168,7 +1169,7 @@ func (s *Server) newConnExecutor(
11681169 mon : sessionRootMon ,
11691170 sessionMon : sessionMon ,
11701171 sessionPreparedMon : sessionPreparedMon ,
1171- sessionDataStack : sdMutIterator .sds ,
1172+ sessionDataStack : sdMutIterator .Sds ,
11721173 dataMutatorIterator : sdMutIterator ,
11731174 state : txnState {
11741175 mon : txnMon ,
@@ -1213,7 +1214,7 @@ func (s *Server) newConnExecutor(
12131214
12141215 // The transaction_read_only variable is special; its updates need to be
12151216 // hooked-up to the executor.
1216- ex .dataMutatorIterator .setCurTxnReadOnly = func (readOnly bool ) error {
1217+ ex .dataMutatorIterator .SetCurTxnReadOnly = func (readOnly bool ) error {
12171218 mode := tree .ReadWrite
12181219 if readOnly {
12191220 mode = tree .ReadOnly
@@ -1222,7 +1223,7 @@ func (s *Server) newConnExecutor(
12221223 }
12231224 // kv_transaction_buffered_writes_enabled is special since it won't affect
12241225 // the current explicit txn, so we want to let the user know.
1225- ex .dataMutatorIterator .setBufferedWritesEnabled = func (enabled bool ) {
1226+ ex .dataMutatorIterator .SetBufferedWritesEnabled = func (enabled bool ) {
12261227 if ex .state .mu .txn .BufferedWritesEnabled () == enabled {
12271228 return
12281229 }
@@ -1234,11 +1235,11 @@ func (s *Server) newConnExecutor(
12341235 ex .planner .BufferClientNotice (ctx , pgnotice .Newf ("%s buffered writes will apply after the current txn commits" , action ))
12351236 }
12361237 }
1237- ex .dataMutatorIterator .onTempSchemaCreation = func () {
1238+ ex .dataMutatorIterator .OnTempSchemaCreation = func () {
12381239 ex .hasCreatedTemporarySchema = true
12391240 }
12401241
1241- ex .dataMutatorIterator .upgradedIsolationLevel = func (
1242+ ex .dataMutatorIterator .UpgradedIsolationLevel = func (
12421243 ctx context.Context , upgradedFrom tree.IsolationLevel , requiresNotice bool ,
12431244 ) {
12441245 telemetry .Inc (sqltelemetry .IsolationLevelUpgradedCounter (ctx , upgradedFrom ))
@@ -1270,7 +1271,7 @@ func (s *Server) newConnExecutor(
12701271 s .localSqlStats .GetCounters (),
12711272 s .cfg .SQLStatsTestingKnobs ,
12721273 )
1273- ex .dataMutatorIterator .onApplicationNameChange = func (newName string ) {
1274+ ex .dataMutatorIterator .OnApplicationNameChange = func (newName string ) {
12741275 ex .applicationName .Store (newName )
12751276 ex .applicationStats = ex .server .localSqlStats .GetApplicationStats (newName )
12761277 if strings .HasPrefix (newName , catconstants .InternalAppNamePrefix ) {
@@ -1285,7 +1286,7 @@ func (s *Server) newConnExecutor(
12851286 ex .extraTxnState .prepStmtsNamespace .portals = make (map [string ]PreparedPortal )
12861287 ex .extraTxnState .prepStmtsNamespace .portalsSnapshot = make (map [string ]PreparedPortal )
12871288 ex .extraTxnState .prepStmtsNamespaceMemAcc = ex .sessionMon .MakeBoundAccount ()
1288- dsdp := catsessiondata .NewDescriptorSessionDataStackProvider (sdMutIterator .sds )
1289+ dsdp := catsessiondata .NewDescriptorSessionDataStackProvider (sdMutIterator .Sds )
12891290 ex .extraTxnState .descCollection = s .cfg .CollectionFactory .NewCollection (
12901291 ctx , descs .WithDescriptorSessionDataProvider (dsdp ), descs .WithMonitor (ex .sessionMon ),
12911292 )
@@ -1758,7 +1759,7 @@ type connExecutor struct {
17581759 // dataMutatorIterator is nil for session-bound internal executors; we
17591760 // shouldn't issue statements that manipulate session state to an internal
17601761 // executor.
1761- dataMutatorIterator * sessionDataMutatorIterator
1762+ dataMutatorIterator * sessionmutator. SessionDataMutatorIterator
17621763
17631764 // applicationStats records per-application SQL usage statistics. It is
17641765 // maintained to represent statistics for the application currently identified
@@ -3674,7 +3675,7 @@ func (ex *connExecutor) txnIsolationLevelToKV(
36743675 hasLicense := base .CCLDistributionAndEnterpriseEnabled (ex .server .cfg .Settings )
36753676 level , upgraded , upgradedDueToLicense := level .UpgradeToEnabledLevel (
36763677 allowReadCommitted , allowRepeatableRead , hasLicense )
3677- if f := ex .dataMutatorIterator .upgradedIsolationLevel ; upgraded && f != nil {
3678+ if f := ex .dataMutatorIterator .UpgradedIsolationLevel ; upgraded && f != nil {
36783679 f (ctx , originalLevel , upgradedDueToLicense )
36793680 }
36803681
0 commit comments