Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executor: add ALTER TABLE COMPACT support #34741

Merged
merged 21 commits into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
161c685
executor: add ALTER TABLE [name] COMPACT TIFLASH REPLICA support
breezewish May 17, 2022
0e28459
Use a remote client-go
breezewish May 17, 2022
d11260d
Merge upstream
breezewish May 18, 2022
8851093
Remove the replace directive
breezewish May 18, 2022
2f20001
Add unit tests
breezewish May 18, 2022
6775b4f
Merge branch 'master' into wenxuan/alter-compact-table
breezewish May 18, 2022
f282ef3
Merge branch 'wenxuan/alter-compact-table' of github.com:breezewish/t…
breezewish May 18, 2022
a8410f1
Let the compaction of other partitions continue when one partition me…
breezewish May 18, 2022
9ac1a2d
Fix lint
breezewish May 18, 2022
7fc1e3c
tableId -> tableID
breezewish May 18, 2022
ddcdb91
make parser again
breezewish May 18, 2022
f645036
Merge branch 'master' into wenxuan/alter-compact-table
breezewish May 18, 2022
9eb2a75
Remove concurrency control
breezewish May 18, 2022
1df411e
Merge branch 'wenxuan/alter-compact-table' of github.com:breezewish/t…
breezewish May 18, 2022
9a0cac5
Merge branch 'master' into wenxuan/alter-compact-table
breezewish May 18, 2022
8d548c1
Merge branch 'master' into wenxuan/alter-compact-table
ti-chi-bot May 18, 2022
1f4ed1c
Merge branch 'master' into wenxuan/alter-compact-table
ti-chi-bot May 18, 2022
33eedaf
Merge branch 'master' into wenxuan/alter-compact-table
ti-chi-bot May 18, 2022
9e315a0
Merge branch 'master' into wenxuan/alter-compact-table
ti-chi-bot May 18, 2022
da65868
upgrade client-go again
breezewish May 18, 2022
e94b2d2
Merge branch 'master' into wenxuan/alter-compact-table
breezewish May 18, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions executor/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ import (
"github.com/pingcap/tidb/util/sqlexec"
"github.com/pingcap/tidb/util/timeutil"
"github.com/pingcap/tipb/go-tipb"
"github.com/tikv/client-go/v2/tikv"
"go.uber.org/zap"
)

Expand Down Expand Up @@ -312,6 +313,8 @@ func (b *executorBuilder) build(p plannercore.Plan) Executor {
return b.buildCTE(v)
case *plannercore.PhysicalCTETable:
return b.buildCTETableReader(v)
case *plannercore.CompactTable:
return b.buildCompactTable(v)
default:
if mp, ok := p.(MockPhysicalPlan); ok {
return mp.GetExecutor()
Expand Down Expand Up @@ -5006,3 +5009,23 @@ func (b *executorBuilder) getCacheTable(tblInfo *model.TableInfo, startTS uint64
}
return nil
}

func (b *executorBuilder) buildCompactTable(v *plannercore.CompactTable) Executor {
if v.ReplicaKind != ast.CompactReplicaKindTiFlash {
b.err = errors.Errorf("compact %v replica is not supported", strings.ToLower(string(v.ReplicaKind)))
return nil
}

store := b.ctx.GetStore()
tikvStore, ok := store.(tikv.Storage)
if !ok {
b.err = errors.New("compact tiflash replica can only run with tikv compatible storage")
return nil
}

return &CompactTableTiFlashExec{
baseExecutor: newBaseExecutor(b.ctx, v.Schema(), v.ID()),
tableInfo: v.TableInfo,
tikvStore: tikvStore,
}
}
Loading