Skip to content

Commit

Permalink
refind package names
Browse files Browse the repository at this point in the history
  • Loading branch information
lichunzhu committed Dec 30, 2021
1 parent 435797d commit 6a912e7
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions br/pkg/backup/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
"google.golang.org/grpc/status"

"github.com/pingcap/tidb/br/pkg/conn"
util2 "github.com/pingcap/tidb/br/pkg/conn/util"
connutil "github.com/pingcap/tidb/br/pkg/conn/util"
berrors "github.com/pingcap/tidb/br/pkg/errors"
"github.com/pingcap/tidb/br/pkg/logutil"
"github.com/pingcap/tidb/br/pkg/metautil"
Expand Down Expand Up @@ -488,7 +488,7 @@ func (bc *Client) BackupRange(
zap.Uint32("concurrency", req.Concurrency))

var allStores []*metapb.Store
allStores, err = conn.GetAllTiKVStoresWithRetry(ctx, bc.mgr.GetPDClient(), util2.SkipTiFlash)
allStores, err = conn.GetAllTiKVStoresWithRetry(ctx, bc.mgr.GetPDClient(), connutil.SkipTiFlash)
if err != nil {
return errors.Trace(err)
}
Expand Down
8 changes: 4 additions & 4 deletions ddl/ddl_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import (
"github.com/pingcap/tidb/sessionctx/variable"
"github.com/pingcap/tidb/table"
"github.com/pingcap/tidb/table/tables"
util2 "github.com/pingcap/tidb/table/tables/util"
tableutil "github.com/pingcap/tidb/table/tables/util"
"github.com/pingcap/tidb/types"
driver "github.com/pingcap/tidb/types/parser_driver"
"github.com/pingcap/tidb/util"
Expand Down Expand Up @@ -1637,7 +1637,7 @@ func buildTableInfo(
if tbInfo.IsCommonHandle {
// Ensure tblInfo's each non-unique secondary-index's len + primary-key's len <= MaxIndexLength for clustered index table.
var pkLen, idxLen int
pkLen, err = indexColumnsLen(tbInfo.Columns, util2.FindPrimaryIndex(tbInfo).Columns)
pkLen, err = indexColumnsLen(tbInfo.Columns, tableutil.FindPrimaryIndex(tbInfo).Columns)
if err != nil {
return
}
Expand Down Expand Up @@ -4282,7 +4282,7 @@ func checkColumnWithIndexConstraint(tbInfo *model.TableInfo, originalCol, newCol
break
}

pkIndex := util2.FindPrimaryIndex(tbInfo)
pkIndex := tableutil.FindPrimaryIndex(tbInfo)
var clusteredPkLen int
if tbInfo.IsCommonHandle {
var err error
Expand Down Expand Up @@ -5464,7 +5464,7 @@ func (d *ddl) CreateIndex(ctx sessionctx.Context, ti ast.Ident, keyType ast.Inde
if !unique && tblInfo.IsCommonHandle {
// Ensure new created non-unique secondary-index's len + primary-key's len <= MaxIndexLength in clustered index table.
var pkLen, idxLen int
pkLen, err = indexColumnsLen(tblInfo.Columns, util2.FindPrimaryIndex(tblInfo).Columns)
pkLen, err = indexColumnsLen(tblInfo.Columns, tableutil.FindPrimaryIndex(tblInfo).Columns)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions planner/core/physical_plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"github.com/pingcap/tidb/sessionctx/stmtctx"
"github.com/pingcap/tidb/statistics"
"github.com/pingcap/tidb/table"
util2 "github.com/pingcap/tidb/table/tables/util"
tablesutil "github.com/pingcap/tidb/table/tables/util"
"github.com/pingcap/tidb/types"
"github.com/pingcap/tidb/util/ranger"
"github.com/pingcap/tidb/util/stringutil"
Expand Down Expand Up @@ -532,7 +532,7 @@ func (ts *PhysicalTableScan) IsPartition() (bool, int64) {
func (ts *PhysicalTableScan) ResolveCorrelatedColumns() ([]*ranger.Range, error) {
access := ts.AccessCondition
if ts.Table.IsCommonHandle {
pkIdx := util2.FindPrimaryIndex(ts.Table)
pkIdx := tablesutil.FindPrimaryIndex(ts.Table)
idxCols, idxColLens := expression.IndexInfo2PrefixCols(ts.Columns, ts.Schema().Columns, pkIdx)
for _, cond := range access {
newCond, err := expression.SubstituteCorCol2Constant(cond)
Expand Down
8 changes: 4 additions & 4 deletions planner/core/planbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import (
"github.com/pingcap/tidb/sessionctx/variable"
"github.com/pingcap/tidb/statistics"
"github.com/pingcap/tidb/table"
util3 "github.com/pingcap/tidb/table/tables/util"
tablesutil "github.com/pingcap/tidb/table/tables/util"
"github.com/pingcap/tidb/table/temptable"
"github.com/pingcap/tidb/types"
driver "github.com/pingcap/tidb/types/parser_driver"
Expand Down Expand Up @@ -1524,7 +1524,7 @@ func tryGetCommonHandleCols(t table.Table, allColSchema *expression.Schema) ([]*
if !tblInfo.IsCommonHandle {
return nil, nil, false
}
pk := util3.FindPrimaryIndex(tblInfo)
pk := tablesutil.FindPrimaryIndex(tblInfo)
commonHandleCols, _ := expression.IndexInfo2Cols(tblInfo.Columns, allColSchema.Columns, pk)
commonHandelColInfos := tables.TryGetCommonPkColumns(t)
return commonHandelColInfos, commonHandleCols, true
Expand Down Expand Up @@ -1738,7 +1738,7 @@ func BuildHandleColsForAnalyze(ctx sessionctx.Context, tblInfo *model.TableInfo,
Index: index,
}}
case tblInfo.IsCommonHandle:
pkIdx := util3.FindPrimaryIndex(tblInfo)
pkIdx := tablesutil.FindPrimaryIndex(tblInfo)
pkColLen := len(pkIdx.Columns)
columns := make([]*expression.Column, pkColLen)
for i := 0; i < pkColLen; i++ {
Expand Down Expand Up @@ -3715,7 +3715,7 @@ func buildHandleColumnInfos(tblInfo *model.TableInfo) []*model.ColumnInfo {
return []*model.ColumnInfo{col}
}
case tblInfo.IsCommonHandle:
pkIdx := util3.FindPrimaryIndex(tblInfo)
pkIdx := tablesutil.FindPrimaryIndex(tblInfo)
pkCols := make([]*model.ColumnInfo, 0, len(pkIdx.Columns))
cols := tblInfo.Columns
for _, idxCol := range pkIdx.Columns {
Expand Down
4 changes: 2 additions & 2 deletions server/http_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import (
"github.com/pingcap/tidb/store/helper"
"github.com/pingcap/tidb/table"
"github.com/pingcap/tidb/table/tables"
util2 "github.com/pingcap/tidb/table/tables/util"
tablesutil "github.com/pingcap/tidb/table/tables/util"
"github.com/pingcap/tidb/tablecodec"
"github.com/pingcap/tidb/types"
"github.com/pingcap/tidb/util"
Expand Down Expand Up @@ -176,7 +176,7 @@ func (t *tikvHandlerTool) getHandle(tb table.PhysicalTable, params map[string]st
handle = kv.IntHandle(intHandle)
} else {
tblInfo := tb.Meta()
pkIdx := util2.FindPrimaryIndex(tblInfo)
pkIdx := tablesutil.FindPrimaryIndex(tblInfo)
if pkIdx == nil || !tblInfo.IsCommonHandle {
return nil, errors.BadRequestf("Clustered common handle not found.")
}
Expand Down
22 changes: 11 additions & 11 deletions table/tables/tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ import (
"github.com/pingcap/tidb/sessionctx/variable"
"github.com/pingcap/tidb/statistics"
"github.com/pingcap/tidb/table"
context2 "github.com/pingcap/tidb/table/tables/context"
util2 "github.com/pingcap/tidb/table/tables/util"
tablecontext "github.com/pingcap/tidb/table/tables/context"
tablesutil "github.com/pingcap/tidb/table/tables/util"
"github.com/pingcap/tidb/tablecodec"
"github.com/pingcap/tidb/types"
"github.com/pingcap/tidb/util"
Expand Down Expand Up @@ -515,15 +515,15 @@ func adjustRowValuesBuf(writeBufs *variable.WriteStmtBufs, rowLen int) {

// ClearAddRecordCtx remove `CommonAddRecordCtx` from session context
func ClearAddRecordCtx(ctx sessionctx.Context) {
ctx.ClearValue(context2.AddRecordCtxKey)
ctx.ClearValue(tablecontext.AddRecordCtxKey)
}

// TryGetCommonPkColumnIds get the IDs of primary key column if the table has common handle.
func TryGetCommonPkColumnIds(tbl *model.TableInfo) []int64 {
if !tbl.IsCommonHandle {
return nil
}
pkIdx := util2.FindPrimaryIndex(tbl)
pkIdx := tablesutil.FindPrimaryIndex(tbl)
pkColIds := make([]int64, 0, len(pkIdx.Columns))
for _, idxCol := range pkIdx.Columns {
pkColIds = append(pkColIds, tbl.Columns[idxCol.Offset].ID)
Expand Down Expand Up @@ -551,7 +551,7 @@ func TryGetCommonPkColumns(tbl table.Table) []*table.Column {
if !tbl.Meta().IsCommonHandle {
return nil
}
pkIdx := util2.FindPrimaryIndex(tbl.Meta())
pkIdx := tablesutil.FindPrimaryIndex(tbl.Meta())
cols := tbl.Cols()
pkCols := make([]*table.Column, 0, len(pkIdx.Columns))
for _, idxCol := range pkIdx.Columns {
Expand Down Expand Up @@ -637,7 +637,7 @@ func (t *TableCommon) AddRecord(sctx sessionctx.Context, r []types.Datum, opts .
recordID = kv.IntHandle(r[tblInfo.GetPkColInfo().Offset].GetInt64())
hasRecordID = true
} else if tblInfo.IsCommonHandle {
pkIdx := util2.FindPrimaryIndex(tblInfo)
pkIdx := tablesutil.FindPrimaryIndex(tblInfo)
pkDts := make([]types.Datum, 0, len(pkIdx.Columns))
for _, idxCol := range pkIdx.Columns {
pkDts = append(pkDts, r[idxCol.Offset])
Expand Down Expand Up @@ -676,7 +676,7 @@ func (t *TableCommon) AddRecord(sctx sessionctx.Context, r []types.Datum, opts .

var colIDs, binlogColIDs []int64
var row, binlogRow []types.Datum
if recordCtx, ok := sctx.Value(context2.AddRecordCtxKey).(*context2.CommonAddRecordCtx); ok {
if recordCtx, ok := sctx.Value(tablecontext.AddRecordCtxKey).(*tablecontext.CommonAddRecordCtx); ok {
colIDs = recordCtx.ColIDs[:0]
row = recordCtx.Row[:0]
} else {
Expand Down Expand Up @@ -888,7 +888,7 @@ func RowWithCols(t table.Table, ctx sessionctx.Context, h kv.Handle, cols []*tab
if err != nil {
return nil, err
}
v, _, err := util2.DecodeRawRowData(ctx, t.Meta(), h, cols, value)
v, _, err := tablesutil.DecodeRawRowData(ctx, t.Meta(), h, cols, value)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -1168,7 +1168,7 @@ func IterRecords(t table.Table, ctx sessionctx.Context, cols []*table.Column,
data[col.Offset] = rowMap[col.ID]
continue
}
data[col.Offset], err = util2.GetColDefaultValue(ctx, col, defaultVals)
data[col.Offset], err = tablesutil.GetColDefaultValue(ctx, col, defaultVals)
if err != nil {
return err
}
Expand Down Expand Up @@ -1325,7 +1325,7 @@ func CanSkip(info *model.TableInfo, col *table.Column, value *types.Datum) bool
return true
}
if col.IsCommonHandleColumn(info) {
pkIdx := util2.FindPrimaryIndex(info)
pkIdx := tablesutil.FindPrimaryIndex(info)
for _, idxCol := range pkIdx.Columns {
if info.Columns[idxCol.Offset].ID != col.ID {
continue
Expand Down Expand Up @@ -1591,7 +1591,7 @@ func TryGetHandleRestoredDataWrapper(t table.Table, row []types.Datum, rowMap ma
return nil
}
rsData := make([]types.Datum, 0, 4)
pkIdx := util2.FindPrimaryIndex(t.Meta())
pkIdx := tablesutil.FindPrimaryIndex(t.Meta())
for _, pkIdxCol := range pkIdx.Columns {
pkCol := t.Meta().Columns[pkIdxCol.Offset]
if !types.NeedRestoredData(&pkCol.FieldType) {
Expand Down

0 comments on commit 6a912e7

Please sign in to comment.