diff --git a/pkg/vm/engine/disttae/txn_table.go b/pkg/vm/engine/disttae/txn_table.go index f59ed931eba25..ab3945812d770 100644 --- a/pkg/vm/engine/disttae/txn_table.go +++ b/pkg/vm/engine/disttae/txn_table.go @@ -217,12 +217,6 @@ func (tbl *txnTable) Size(ctx context.Context, columnName string) (uint64, error } }) - // Different rows may belong to same batch. So we have - // to record the batch which we have already handled to avoid - // repetitive computation - handled := make(map[*batch.Batch]struct{}) - // Calculate the in mem size - // TODO: It might includ some deleted row size iter := part.NewRowsIter(ts, nil, false) defer func() { _ = iter.Close() }() for iter.Next() { @@ -230,21 +224,14 @@ func (tbl *txnTable) Size(ctx context.Context, columnName string) (uint64, error if _, ok := deletes[entry.RowID]; ok { continue } - if _, ok := handled[entry.Batch]; ok { - continue - } + for i, s := range entry.Batch.Attrs { if _, ok := neededCols[s]; ok { - szInPart += uint64(entry.Batch.Vecs[i].Size()) + szInPart += uint64(entry.Batch.Vecs[i].Size() / entry.Batch.Vecs[i].Length()) } } - handled[entry.Batch] = struct{}{} } - //s := e.Stats(ctx, pb.StatsInfoKey{ - // DatabaseID: tbl.db.databaseId, - // TableID: tbl.tableId, - //}, true) s, _ := tbl.Stats(ctx, true) if s == nil { return szInPart, nil diff --git a/test/distributed/cases/mo_cloud/mo_cloud.result b/test/distributed/cases/mo_cloud/mo_cloud.result index 0e7a796b57940..17a327f1b88ca 100644 --- a/test/distributed/cases/mo_cloud/mo_cloud.result +++ b/test/distributed/cases/mo_cloud/mo_cloud.result @@ -697,7 +697,7 @@ triggers 0 0 accountadmin engines 0 0 accountadmin routines 0 0 accountadmin parameters 0 0 accountadmin -keywords 747 45171 accountadmin +keywords 747 44820 accountadmin schema_privileges 0 0 accountadmin table_privileges 0 0 accountadmin column_privileges 0 0 accountadmin