@@ -44,8 +44,6 @@ type setZoneConfigNode struct {
44
44
yamlConfig tree.TypedExpr
45
45
options map [tree.Name ]zone.OptionValue
46
46
setDefault bool
47
-
48
- run setZoneConfigRun
49
47
}
50
48
51
49
func (p * planner ) getUpdatedZoneConfigYamlConfig (
@@ -230,11 +228,6 @@ func checkPrivilegeForSetZoneConfig(ctx context.Context, p *planner, zs tree.Zon
230
228
[]privilege.Kind {privilege .ZONECONFIG , privilege .CREATE }, string (tableDesc .DescriptorType ()), tableDesc .GetName ())
231
229
}
232
230
233
- // setZoneConfigRun contains the run-time state of setZoneConfigNode during local execution.
234
- type setZoneConfigRun struct {
235
- numAffected int
236
- }
237
-
238
231
// ReadingOwnWrites implements the planNodeReadingOwnWrites interface.
239
232
// This is because CONFIGURE ZONE performs multiple KV operations on descriptors
240
233
// and expects to see its own writes.
@@ -747,7 +740,7 @@ func (n *setZoneConfigNode) startExec(params runParams) error {
747
740
zoneToWrite := partialZone
748
741
// TODO(ajwerner): This is extremely fragile because we accept a nil table
749
742
// all the way down here.
750
- n . run . numAffected , err = writeZoneConfig (
743
+ err = writeZoneConfig (
751
744
params .ctx ,
752
745
params .p .InternalSQLTxn (),
753
746
targetID ,
@@ -796,8 +789,6 @@ func (n *setZoneConfigNode) Next(runParams) (bool, error) { return false, nil }
796
789
func (n * setZoneConfigNode ) Values () tree.Datums { return nil }
797
790
func (* setZoneConfigNode ) Close (context.Context ) {}
798
791
799
- func (n * setZoneConfigNode ) FastPathResults () (int , bool ) { return n .run .numAffected , true }
800
-
801
792
type nodeGetter func (context.Context , * serverpb.NodesRequest ) (* serverpb.NodesResponse , error )
802
793
type regionsGetter func (context.Context ) (* serverpb.RegionsResponse , error )
803
794
@@ -1058,41 +1049,38 @@ func writeZoneConfig(
1058
1049
execCfg * ExecutorConfig ,
1059
1050
hasNewSubzones bool ,
1060
1051
kvTrace bool ,
1061
- ) ( numAffected int , err error ) {
1052
+ ) error {
1062
1053
update , err := prepareZoneConfigWrites (ctx , execCfg , targetID , table , zone , expectedExistingRawBytes , hasNewSubzones )
1063
1054
if err != nil {
1064
- return 0 , err
1055
+ return err
1065
1056
}
1066
1057
return writeZoneConfigUpdate (ctx , txn , kvTrace , update )
1067
1058
}
1068
1059
1069
1060
func writeZoneConfigUpdate (
1070
1061
ctx context.Context , txn descs.Txn , kvTrace bool , update * zoneConfigUpdate ,
1071
- ) ( numAffected int , err error ) {
1062
+ ) error {
1072
1063
b := txn .KV ().NewBatch ()
1073
1064
if update .zoneConfig == nil {
1074
- err = txn .Descriptors ().DeleteZoneConfigInBatch (ctx , kvTrace , b , update .id )
1065
+ err := txn .Descriptors ().DeleteZoneConfigInBatch (ctx , kvTrace , b , update .id )
1066
+ if err != nil {
1067
+ return err
1068
+ }
1075
1069
} else {
1076
- numAffected = 1
1077
- err = txn .Descriptors ().WriteZoneConfigToBatch (ctx , kvTrace , b , update .id , update .zoneConfig )
1078
- }
1079
- if err != nil {
1080
- return 0 , err
1070
+ err := txn .Descriptors ().WriteZoneConfigToBatch (ctx , kvTrace , b , update .id , update .zoneConfig )
1071
+ if err != nil {
1072
+ return err
1073
+ }
1081
1074
}
1082
1075
1083
1076
if err := txn .KV ().Run (ctx , b ); err != nil {
1084
- return 0 , err
1077
+ return err
1085
1078
}
1086
1079
r := b .Results [0 ]
1087
1080
if r .Err != nil {
1088
1081
panic ("run succeeded even through the result has an error" )
1089
1082
}
1090
- // We don't really care how many keys are affected since this function always
1091
- // write one single zone config.
1092
- if len (r .Keys ) > 0 {
1093
- numAffected = 1
1094
- }
1095
- return numAffected , err
1083
+ return nil
1096
1084
}
1097
1085
1098
1086
// RemoveIndexZoneConfigs removes the zone configurations for some
@@ -1139,7 +1127,7 @@ func RemoveIndexZoneConfigs(
1139
1127
1140
1128
if zcRewriteNecessary {
1141
1129
// Ignore CCL required error to allow schema change to progress.
1142
- _ , err = writeZoneConfig (
1130
+ err = writeZoneConfig (
1143
1131
ctx , txn , tableDesc .GetID (), tableDesc , zone ,
1144
1132
zoneWithRaw .GetRawBytesInStorage (), execCfg ,
1145
1133
false /* hasNewSubzones */ , kvTrace ,
0 commit comments