Skip to content

Commit 1a3cae1

Browse files
committed
fix sca and free clone
1 parent eaf7956 commit 1a3cae1

File tree

4 files changed

+5
-49
lines changed

4 files changed

+5
-49
lines changed

pkg/common/moerr/error.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"encoding/hex"
2121
"fmt"
2222
"io"
23-
"strings"
2423
"sync/atomic"
2524

2625
moerrpb "github.com/matrixorigin/matrixone/pkg/pb/moerr"
@@ -1021,10 +1020,6 @@ func NewNotLeaseHolder(ctx context.Context, holderId uint64) *Error {
10211020
}
10221021

10231022
func NewNoSuchTable(ctx context.Context, db, tbl string) *Error {
1024-
if strings.Contains(tbl, "index") {
1025-
x := 0
1026-
x++
1027-
}
10281023
return newError(ctx, ErrNoSuchTable, db, tbl)
10291024
}
10301025

pkg/sql/compile/alter.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package compile
1717
import (
1818
"context"
1919
"fmt"
20+
"github.com/matrixorigin/matrixone/pkg/common/reuse"
2021
"github.com/matrixorigin/matrixone/pkg/sql/colexec/table_clone"
2122
"slices"
2223

@@ -579,6 +580,7 @@ func cowUnaffectedIndexes(
579580
releaseClone := func() {
580581
if clone != nil {
581582
clone.Free(c.proc, false, err)
583+
reuse.Free[table_clone.TableClone](clone, nil)
582584
clone = nil
583585
}
584586
}

pkg/sql/compile/compile.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -402,12 +402,7 @@ func (c *Compile) run(s *Scope) error {
402402
case AlterView:
403403
return s.AlterView(c)
404404
case AlterTable:
405-
err := s.AlterTable(c)
406-
if err != nil {
407-
x := 0
408-
x++
409-
}
410-
return err
405+
return s.AlterTable(c)
411406
case RenameTable:
412407
return s.RenameTable(c)
413408
case DropTable:

pkg/sql/plan/build_table_clone.go

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,9 @@ func buildCloneTable(
3535
) (*Plan, error) {
3636

3737
var (
38-
err error
39-
40-
//id int32
41-
38+
err error
4239
srcTblDef *TableDef
43-
44-
srcObj *ObjectRef
45-
46-
//query *Query
40+
srcObj *ObjectRef
4741

4842
createTablePlan *Plan
4943

@@ -103,32 +97,11 @@ func buildCloneTable(
10397

10498
dstTableName = stmt.CreateTable.Table.ObjectName.String()
10599
dstDatabaseName = stmt.CreateTable.Table.SchemaName.String()
106-
//dstTblDef := DeepCopyTableDef(srcTblDef, true)
107-
//dstTblDef.Name = stmt.CreateTable.Table.ObjectName.String()
108-
//dstTblDef.DbName = stmt.CreateTable.Table.SchemaName.String()
109100

110101
if dstDatabaseName == "" {
111102
dstDatabaseName = ctx.DefaultDatabase()
112103
}
113104

114-
//node := &plan.Node{
115-
// ObjRef: srcObj,
116-
// NodeType: plan.Node_TABLE_CLONE,
117-
// TableDef: srcTblDef,
118-
// ScanSnapshot: bindCtx.snapshot,
119-
// //InsertCtx: &plan.InsertCtx{
120-
// // TableDef: dstTblDef,
121-
// //},
122-
// BindingTags: []int32{builder.genNewTag()},
123-
// Stats: &plan.Stats{
124-
// ForceOneCN: true,
125-
// },
126-
//}
127-
128-
//builder.qry.Steps = append(builder.qry.Steps, id)
129-
//builder.qry.Nodes[0].Stats.ForceOneCN = true
130-
//builder.skipStats = true
131-
132105
var (
133106
opAccount uint32
134107
dstAccount uint32
@@ -167,13 +140,6 @@ func buildCloneTable(
167140
return nil, err
168141
}
169142

170-
//if query, err = builder.createQuery(); err != nil {
171-
// return nil, err
172-
//}
173-
174-
//createTablePlan.Plan.(*plan.Plan_Ddl).Ddl.Query = query
175-
//createTablePlan.Plan.(*plan.Plan_Ddl).Ddl.DdlType = plan.DataDefinition_CREATE_TABLE_WITH_CLONE
176-
177143
return &Plan{
178144
Plan: &plan.Plan_Ddl{
179145
Ddl: &plan.DataDefinition{
@@ -191,8 +157,6 @@ func buildCloneTable(
191157
},
192158
},
193159
}, nil
194-
195-
//return createTablePlan, nil
196160
}
197161

198162
func checkPrivilege(

0 commit comments

Comments
 (0)