Skip to content

Commit

Permalink
ddl: add some debug log for unstable test TestTruncatePartitionAndDro…
Browse files Browse the repository at this point in the history
…pTable (#28014)
  • Loading branch information
tiancaiamao authored Sep 14, 2021
1 parent 406ffe7 commit efec5c3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion ddl/db_partition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ import (
"github.com/pingcap/tidb/util/admin"
"github.com/pingcap/tidb/util/collate"
"github.com/pingcap/tidb/util/israce"
"github.com/pingcap/tidb/util/logutil"
"github.com/pingcap/tidb/util/mock"
"github.com/pingcap/tidb/util/testkit"
"go.uber.org/zap"
)

func (s *testIntegrationSuite3) TestCreateTableWithPartition(c *C) {
Expand Down Expand Up @@ -2231,10 +2233,12 @@ func (s *testIntegrationSuite4) TestTruncatePartitionAndDropTable(c *C) {
c.Assert(err, IsNil)
// Only one partition id test is taken here.
oldPID := oldTblInfo.Meta().Partition.Definitions[0].ID
startTime := time.Now()
tk.MustExec("truncate table t3;")
partitionPrefix := tablecodec.EncodeTablePrefix(oldPID)
logutil.BgLogger().Info("truncate partition table", zap.Stringer("key", partitionPrefix))
hasOldPartitionData := checkPartitionDelRangeDone(c, s.testIntegrationSuite, partitionPrefix)
c.Assert(hasOldPartitionData, IsFalse)
c.Assert(hasOldPartitionData, IsFalse, Commentf("take time %v", time.Since(startTime)))

// Test drop table partition.
tk.MustExec("drop table if exists t4;")
Expand Down
7 changes: 6 additions & 1 deletion ddl/delete_range.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,12 @@ func (dr *delRange) doTask(ctx sessionctx.Context, r util.DelRangeTask) error {
logutil.BgLogger().Error("[ddl] delRange emulator complete task failed", zap.Error(err))
return errors.Trace(err)
}
logutil.BgLogger().Info("[ddl] delRange emulator complete task", zap.Int64("jobID", r.JobID), zap.Int64("elementID", r.ElementID))
startKey, endKey := r.Range()
logutil.BgLogger().Info("[ddl] delRange emulator complete task",
zap.Int64("jobID", r.JobID),
zap.Int64("elementID", r.ElementID),
zap.Stringer("startKey", startKey),
zap.Stringer("endKey", endKey))
break
}
if err := util.UpdateDeleteRange(ctx, r, newStartKey, oldStartKey); err != nil {
Expand Down

0 comments on commit efec5c3

Please sign in to comment.