Skip to content

Commit

Permalink
Merge branch 'master' into fixBRGlueDDL
Browse files Browse the repository at this point in the history
  • Loading branch information
lichunzhu authored Feb 26, 2021
2 parents 9e256e7 + 8357f80 commit 1c907e5
Show file tree
Hide file tree
Showing 29 changed files with 191 additions and 341 deletions.
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
jobs:
build:
docker:
- image: golang:1.15
- image: golang:1.16
working_directory: /go/src/github.com/pingcap/tidb
steps:
- checkout
Expand Down
8 changes: 0 additions & 8 deletions config/config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -417,14 +417,6 @@ store-liveness-timeout = "5s"
# If the size(in byte) of a transaction is large than `ttl-refreshed-txn-size`, it update the lock TTL during the 2PC.
ttl-refreshed-txn-size = 33554432

[tikv-client.async-commit]
# The maximum allowed keys in an async commit transaction. Transactions with more keys than the limit
# will be committed with normal 2PC way.
keys-limit = 256
# The maximum length total of keys in bytes. Transactions will be committed with the normal 2PC way
# if the limit is exceeded.
total-key-size-limit = 4096

[tikv-client.copr-cache]
# Whether to enable the copr cache. The copr cache saves the result from TiKV Coprocessor in the memory and
# reuses the result when corresponding data in TiKV is unchanged, on a region basis.
Expand Down
2 changes: 1 addition & 1 deletion ddl/db_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1487,7 +1487,7 @@ func (s *testIntegrationSuite6) TestAddColumnTooMany(c *C) {
func (s *testIntegrationSuite8) TestCreateTooManyIndexes(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("use test")
count := int(atomic.LoadUint32(&ddl.TableIndexCountLimit) - 1)
count := config.GetGlobalConfig().IndexLimit - 1
sql := "create table t_index_too_many ("
for i := 0; i < 100; i++ {
if i != 0 {
Expand Down
2 changes: 1 addition & 1 deletion ddl/db_partition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2855,7 +2855,7 @@ func testPartitionAddIndex(tk *testkit.TestKit, c *C, key string) {
idxName1 := "idx1"

f := func(end int, isPK bool) string {
dml := fmt.Sprintf("insert into partition_add_idx values")
dml := "insert into partition_add_idx values"
for i := 0; i < end; i++ {
dVal := 1988 + rand.Intn(30)
if isPK {
Expand Down
2 changes: 1 addition & 1 deletion ddl/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3328,7 +3328,7 @@ func (s *testDBSuite1) TestRenameMultiTables(c *C) {
tk.MustExec("use test")
tk.MustExec("create table t1(id int)")
tk.MustExec("create table t2(id int)")
sql := fmt.Sprintf("rename table t1 to t3, t2 to t4")
sql := "rename table t1 to t3, t2 to t4"
_, err := tk.Exec(sql)
c.Assert(err, IsNil)

Expand Down
2 changes: 0 additions & 2 deletions ddl/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ const (
)

var (
// TableIndexCountLimit is limit of the number of indexes in a table.
TableIndexCountLimit = uint32(64)
// EnableSplitTableRegion is a flag to decide whether to split a new region for
// a newly created table. It takes effect only if the Storage supports split
// region.
Expand Down
2 changes: 1 addition & 1 deletion ddl/ddl_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -3484,7 +3484,7 @@ func needReorgToChange(origin *types.FieldType, to *types.FieldType) (needOreg b
return true, fmt.Sprintf("decimal %d is less than origin %d", to.Decimal, origin.Decimal)
}
if mysql.HasUnsignedFlag(origin.Flag) != mysql.HasUnsignedFlag(to.Flag) {
return true, fmt.Sprintf("can't change unsigned integer to signed or vice versa")
return true, "can't change unsigned integer to signed or vice versa"
}
return false, ""
}
Expand Down
6 changes: 2 additions & 4 deletions ddl/ddl_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -794,10 +794,8 @@ func (w *worker) waitSchemaChanged(ctx context.Context, d *ddlCtx, waitTime time
}
d.schemaSyncer.NotifyCleanExpiredPaths()
// Wait until timeout.
select {
case <-ctx.Done():
return
}
<-ctx.Done()
return
}
logutil.Logger(w.logCtx).Info("[ddl] wait latest schema version changed",
zap.Int64("ver", latestSchemaVersion),
Expand Down
2 changes: 0 additions & 2 deletions ddl/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ var (
errTooLongKey = dbterror.ClassDDL.NewStd(mysql.ErrTooLongKey)
errKeyColumnDoesNotExits = dbterror.ClassDDL.NewStd(mysql.ErrKeyColumnDoesNotExits)
errUnknownTypeLength = dbterror.ClassDDL.NewStd(mysql.ErrUnknownTypeLength)
errUnknownFractionLength = dbterror.ClassDDL.NewStd(mysql.ErrUnknownFractionLength)
errInvalidDDLJobVersion = dbterror.ClassDDL.NewStd(mysql.ErrInvalidDDLJobVersion)
errInvalidUseOfNull = dbterror.ClassDDL.NewStd(mysql.ErrInvalidUseOfNull)
errTooManyFields = dbterror.ClassDDL.NewStd(mysql.ErrTooManyFields)
Expand Down Expand Up @@ -98,7 +97,6 @@ var (
errUnsupportedRebuildPartition = dbterror.ClassDDL.NewStdErr(mysql.ErrUnsupportedDDLOperation, parser_mysql.Message(fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation].Raw, "rebuild partition"), nil))
errUnsupportedRemovePartition = dbterror.ClassDDL.NewStdErr(mysql.ErrUnsupportedDDLOperation, parser_mysql.Message(fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation].Raw, "remove partitioning"), nil))
errUnsupportedRepairPartition = dbterror.ClassDDL.NewStdErr(mysql.ErrUnsupportedDDLOperation, parser_mysql.Message(fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation].Raw, "repair partition"), nil))
errUnsupportedExchangePartition = dbterror.ClassDDL.NewStdErr(mysql.ErrUnsupportedDDLOperation, parser_mysql.Message(fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation].Raw, "exchange partition"), nil))
// ErrGeneratedColumnFunctionIsNotAllowed returns for unsupported functions for generated columns.
ErrGeneratedColumnFunctionIsNotAllowed = dbterror.ClassDDL.NewStd(mysql.ErrGeneratedColumnFunctionIsNotAllowed)
// ErrGeneratedColumnRowValueIsNotAllowed returns for generated columns referring to row values.
Expand Down
39 changes: 1 addition & 38 deletions ddl/partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,23 +582,6 @@ func checkAndOverridePartitionID(newTableInfo, oldTableInfo *model.TableInfo) er
return nil
}

func stringSliceEqual(a, b []string) bool {
if len(a) != len(b) {
return false
}
if len(a) == 0 {
return true
}
// Accelerate the compare by eliminate index bound check.
b = b[:len(a)]
for i, v := range a {
if v != b[i] {
return false
}
}
return true
}

// checkPartitionFuncValid checks partition function validly.
func checkPartitionFuncValid(ctx sessionctx.Context, tblInfo *model.TableInfo, expr ast.ExprNode) error {
if expr == nil {
Expand Down Expand Up @@ -809,16 +792,6 @@ func getRangeValue(ctx sessionctx.Context, str string, unsignedBigint bool) (int
return 0, false, ErrNotAllowedTypeInPartition.GenWithStackByArgs(str)
}

// validRangePartitionType checks the type supported by the range partitioning key.
func validRangePartitionType(col *model.ColumnInfo) bool {
switch col.FieldType.EvalType() {
case types.ETInt:
return true
default:
return false
}
}

// checkDropTablePartition checks if the partition exists and does not allow deleting the last existing partition in the table.
func checkDropTablePartition(meta *model.TableInfo, partLowerNames []string) error {
pi := meta.Partition
Expand Down Expand Up @@ -1467,9 +1440,7 @@ func buildCheckSQLForListColumnsPartition(pi *model.PartitionInfo, index int, sc
func getInValues(pi *model.PartitionInfo, index int) []string {
inValues := make([]string, 0, len(pi.Definitions[index].InValues))
for _, inValue := range pi.Definitions[index].InValues {
for _, one := range inValue {
inValues = append(inValues, one)
}
inValues = append(inValues, inValue...)
}
return inValues
}
Expand All @@ -1488,13 +1459,6 @@ func checkNoHashPartitions(ctx sessionctx.Context, partitionNum uint64) error {
return nil
}

func checkNoRangePartitions(partitionNum int) error {
if partitionNum == 0 {
return ast.ErrPartitionsMustBeDefined.GenWithStackByArgs("RANGE")
}
return nil
}

func getPartitionIDs(table *model.TableInfo) []int64 {
if table.GetPartitionInfo() == nil {
return []int64{}
Expand Down Expand Up @@ -1762,7 +1726,6 @@ type partitionExprChecker struct {
processors []partitionExprProcessor
ctx sessionctx.Context
tbInfo *model.TableInfo
expr ast.ExprNode
err error

columns []*model.ColumnInfo
Expand Down
8 changes: 0 additions & 8 deletions ddl/reorg.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,6 @@ type nullableKey struct {
key kv.Key
}

// toString is used in log to avoid nil dereference panic.
func toString(handle kv.Handle) string {
if handle == nil {
return "<nil>"
}
return handle.String()
}

// newContext gets a context. It is only used for adding column in reorganization state.
func newContext(store kv.Storage) sessionctx.Context {
c := mock.NewContext()
Expand Down
Loading

0 comments on commit 1c907e5

Please sign in to comment.