Skip to content

Commit

Permalink
Revert "Disabled tests for CI testing"
Browse files Browse the repository at this point in the history
This reverts commit 17c28f3.
  • Loading branch information
mjonss committed Dec 25, 2022
1 parent 17c28f3 commit 65c84d9
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 9 deletions.
1 change: 0 additions & 1 deletion ddl/column.go
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,6 @@ func doReorgWorkForModifyColumn(w *worker, d *ddlCtx, t *meta.Meta, job *model.J
// enable: curl -X PUT -d "pause" "http://127.0.0.1:10080/fail/github.com/pingcap/tidb/ddl/mockDelayInModifyColumnTypeWithData".
// disable: curl -X DELETE "http://127.0.0.1:10080/fail/github.com/pingcap/tidb/ddl/mockDelayInModifyColumnTypeWithData"
failpoint.Inject("mockDelayInModifyColumnTypeWithData", func() {})
// TODO: add session begin/commit handling including cleaning up tidb_ddl_reorg
err = w.runReorgJob(rh, reorgInfo, tbl.Meta(), d.lease, func() (addIndexErr error) {
defer util.Recover(metrics.LabelDDL, "onModifyColumn",
func() {
Expand Down
1 change: 0 additions & 1 deletion ddl/partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -1764,7 +1764,6 @@ func (w *worker) onDropTablePartition(d *ddlCtx, t *meta.Meta, job *model.Job) (
// and then run the reorg next time.
return ver, errors.Trace(err)
}
// TODO: Use an own session!
err = w.runReorgJob(rh, reorgInfo, tbl.Meta(), d.lease, func() (dropIndexErr error) {
defer tidbutil.Recover(metrics.LabelDDL, "onDropTablePartition",
func() {
Expand Down
37 changes: 33 additions & 4 deletions ddl/reorg.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,10 @@ func (w *worker) runReorgJob(rh *reorgHandler, reorgInfo *reorgInfo, tblInfo *mo
}

updateBackfillProgress(w, reorgInfo, tblInfo, 0)
// TODO: Move the remove reorg handle into the worker
// Also never start a transaction for the session (rh?)
if err1 := rh.RemoveDDLReorgHandle(job, reorgInfo.elements); err1 != nil {

// Do this is a separate transaction, since mysql.tidb_ddl_reorg may have been updated
// by the inner function and could result in commit conflicts.
if err1 := reorgInfo.deleteReorgMeta(w.sessPool); err1 != nil {
logutil.BgLogger().Warn("[ddl] run reorg job done, removeDDLReorgHandle failed", zap.Error(err1))
return errors.Trace(err1)
}
Expand Down Expand Up @@ -644,7 +645,6 @@ func getReorgInfo(ctx *JobContext, d *ddlCtx, rh *reorgHandler, job *model.Job,
failpoint.Inject("errorUpdateReorgHandle", func() (*reorgInfo, error) {
return &info, errors.New("occur an error when update reorg handle")
})
// TODO: Wrap these two into a single transaction?
err = rh.RemoveDDLReorgHandle(job, elements)
if err != nil {
return &info, errors.Trace(err)
Expand Down Expand Up @@ -755,6 +755,35 @@ func getReorgInfoFromPartitions(ctx *JobContext, d *ddlCtx, rh *reorgHandler, jo
return &info, nil
}

func (r *reorgInfo) deleteReorgMeta(pool *sessionPool) error {
if len(r.elements) == 0 {
return nil
}
se, err := pool.get()
if err != nil {
return errors.Trace(err)
}
defer pool.put(se)

sess := newSession(se)
err = sess.begin()
if err != nil {
return errors.Trace(err)
}
txn, err := sess.txn()
if err != nil {
sess.rollback()
return errors.Trace(err)
}
rh := newReorgHandler(meta.NewMeta(txn), sess, variable.EnableConcurrentDDL.Load())
err = rh.RemoveDDLReorgHandle(r.Job, r.elements)
err1 := sess.commit()
if err == nil {
err = err1
}
return errors.Trace(err)
}

func (r *reorgInfo) UpdateReorgMeta(startKey kv.Key, pool *sessionPool) (err error) {
if startKey == nil && r.EndKey == nil {
return nil
Expand Down
3 changes: 0 additions & 3 deletions executor/oomtest/oom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ func TestMain(m *testing.M) {
}

func TestMemTracker4UpdateExec(t *testing.T) {
t.Skip("TODO: remove CI hacking")
store := testkit.CreateMockStore(t)

tk := testkit.NewTestKit(t, store)
Expand All @@ -64,7 +63,6 @@ func TestMemTracker4UpdateExec(t *testing.T) {
}

func TestMemTracker4InsertAndReplaceExec(t *testing.T) {
t.Skip("TODO: remove CI hacking")
store := testkit.CreateMockStore(t)

tk := testkit.NewTestKit(t, store)
Expand Down Expand Up @@ -135,7 +133,6 @@ func TestMemTracker4InsertAndReplaceExec(t *testing.T) {
}

func TestMemTracker4DeleteExec(t *testing.T) {
t.Skip("TODO: remove CI hacking")
store := testkit.CreateMockStore(t)

tk := testkit.NewTestKit(t, store)
Expand Down

0 comments on commit 65c84d9

Please sign in to comment.