@@ -671,7 +671,7 @@ func (t *TableCommon) UpdateRecord(ctx context.Context, sctx table.MutateContext
671
671
return err
672
672
}
673
673
}
674
- colSize := make (map [ int64 ] int64 , len (t .Cols ()))
674
+ colSize := make ([]variable. ColSize , len (t .Cols ()))
675
675
for id , col := range t .Cols () {
676
676
size , err := codec .EstimateValueSize (sc .TypeCtx (), newData [id ])
677
677
if err != nil {
@@ -683,9 +683,9 @@ func (t *TableCommon) UpdateRecord(ctx context.Context, sctx table.MutateContext
683
683
continue
684
684
}
685
685
oldLen := size - 1
686
- colSize [col .ID ] = int64 (newLen - oldLen )
686
+ colSize [id ] = variable. ColSize { ColID : col .ID , Size : int64 (newLen - oldLen )}
687
687
}
688
- sessVars .TxnCtx .UpdateDeltaForTable (t .physicalTableID , 0 , 1 , colSize )
688
+ sessVars .TxnCtx .UpdateDeltaForTableFromColSlice (t .physicalTableID , 0 , 1 , colSize )
689
689
return nil
690
690
}
691
691
@@ -1171,15 +1171,15 @@ func (t *TableCommon) AddRecord(sctx table.MutateContext, r []types.Datum, opts
1171
1171
sessVars .TxnCtx .InsertTTLRowsCount += 1
1172
1172
}
1173
1173
1174
- colSize := make (map [ int64 ] int64 , len (r ))
1174
+ colSize := make ([]variable. ColSize , len (t . Cols () ))
1175
1175
for id , col := range t .Cols () {
1176
1176
size , err := codec .EstimateValueSize (sc .TypeCtx (), r [id ])
1177
1177
if err != nil {
1178
1178
continue
1179
1179
}
1180
- colSize [col .ID ] = int64 (size ) - 1
1180
+ colSize [id ] = variable. ColSize { ColID : col .ID , Size : int64 (size - 1 )}
1181
1181
}
1182
- sessVars .TxnCtx .UpdateDeltaForTable (t .physicalTableID , 1 , 1 , colSize )
1182
+ sessVars .TxnCtx .UpdateDeltaForTableFromColSlice (t .physicalTableID , 1 , 1 , colSize )
1183
1183
return recordID , nil
1184
1184
}
1185
1185
@@ -1448,15 +1448,15 @@ func (t *TableCommon) RemoveRecord(ctx table.MutateContext, h kv.Handle, r []typ
1448
1448
if ctx .GetSessionVars ().TxnCtx == nil {
1449
1449
return nil
1450
1450
}
1451
- colSize := make (map [ int64 ] int64 , len (t .Cols ()))
1451
+ colSize := make ([]variable. ColSize , len (t .Cols ()))
1452
1452
for id , col := range t .Cols () {
1453
1453
size , err := codec .EstimateValueSize (sc .TypeCtx (), r [id ])
1454
1454
if err != nil {
1455
1455
continue
1456
1456
}
1457
- colSize [col .ID ] = - int64 (size - 1 )
1457
+ colSize [id ] = variable. ColSize { ColID : col .ID , Size : - int64 (size - 1 )}
1458
1458
}
1459
- ctx .GetSessionVars ().TxnCtx .UpdateDeltaForTable (t .physicalTableID , - 1 , 1 , colSize )
1459
+ ctx .GetSessionVars ().TxnCtx .UpdateDeltaForTableFromColSlice (t .physicalTableID , - 1 , 1 , colSize )
1460
1460
return err
1461
1461
}
1462
1462
0 commit comments