tidb: github.com/pingcap/tidb/table/tables Index | Files

package tables

import "github.com/pingcap/tidb/table/tables"


Package Files

gen_expr.go index.go partition.go tables.go

func AllocHandle Uses

func AllocHandle(ctx sessionctx.Context, t table.Table) (kv.Handle, error)

AllocHandle allocate a new handle. A statement could reserve some ID in the statement context, try those ones first.

func CalcShard Uses

func CalcShard(shardRowIDBits uint64, startTS uint64, typeBitsLength uint64, reserveSignBit bool) int64

CalcShard calculates the shard prefix by hashing the startTS. Make sure OverflowShardBits is false before calling it.

func CanSkip Uses

func CanSkip(info *model.TableInfo, col *table.Column, value types.Datum) bool

CanSkip is for these cases, we can skip the columns in encoded row: 1. the column is included in primary key; 2. the column's default value is null, and the value equals to that; 3. the column is virtual generated.

func CheckHandleExists Uses

func CheckHandleExists(ctx context.Context, sctx sessionctx.Context, t table.Table, recordID kv.Handle, data []types.Datum) error

CheckHandleExists check whether recordID key exists. if not exists, return nil, otherwise return kv.ErrKeyExists error.

func DecodeHandleInUniqueIndexValue Uses

func DecodeHandleInUniqueIndexValue(data []byte) (int64, error)

DecodeHandleInUniqueIndexValue decodes handle in data.

func DecodeRawRowData Uses

func DecodeRawRowData(ctx sessionctx.Context, meta *model.TableInfo, h kv.Handle, cols []*table.Column,
    value []byte) ([]types.Datum, map[int64]types.Datum, error)

DecodeRawRowData decodes raw row data into a datum slice and a (columnID:columnValue) map.

func EncodeHandleInUniqueIndexValue Uses

func EncodeHandleInUniqueIndexValue(h int64) []byte

EncodeHandleInUniqueIndexValue encodes handle in data.

func FindIndexByColName Uses

func FindIndexByColName(t table.Table, name string) table.Index

FindIndexByColName returns a public table index containing only one column named `name`.

func FindPartitionByName Uses

func FindPartitionByName(meta *model.TableInfo, parName string) (int64, error)

FindPartitionByName finds partition in table meta by name.

func GetColDefaultValue Uses

func GetColDefaultValue(ctx sessionctx.Context, col *table.Column, defaultVals []types.Datum) (
    colVal types.Datum, err error)

GetColDefaultValue gets a column default value. The defaultVals is used to avoid calculating the default value multiple times.

func GetWritableIndexByName Uses

func GetWritableIndexByName(idxName string, t table.Table) table.Index

GetWritableIndexByName gets the index meta from the table by the index name.

func MockTableFromMeta Uses

func MockTableFromMeta(tblInfo *model.TableInfo) table.Table

MockTableFromMeta only serves for test.

func NewIndex Uses

func NewIndex(physicalID int64, tblInfo *model.TableInfo, indexInfo *model.IndexInfo) table.Index

NewIndex builds a new Index object.

func NewPartitionTableithGivenSets Uses

func NewPartitionTableithGivenSets(tbl table.PartitionedTable, partitions map[int64]struct{}) table.PartitionedTable

NewPartitionTableithGivenSets creates a new partition table from a partition table.

func OverflowShardBits Uses

func OverflowShardBits(recordID int64, shardRowIDBits uint64, typeBitsLength uint64, reservedSignBit bool) bool

OverflowShardBits checks whether the recordID overflow `1<<(typeBitsLength-shardRowIDBits-1) -1`.

func TableFromMeta Uses

func TableFromMeta(allocs autoid.Allocators, tblInfo *model.TableInfo) (table.Table, error)

TableFromMeta creates a Table instance from model.TableInfo.

func TruncateIndexValuesIfNeeded Uses

func TruncateIndexValuesIfNeeded(tblInfo *model.TableInfo, idxInfo *model.IndexInfo, indexedValues []types.Datum) []types.Datum

TruncateIndexValuesIfNeeded truncates the index values created using only the leading part of column values.

type ForRangeColumnsPruning Uses

type ForRangeColumnsPruning struct {
    LessThan []expression.Expression
    MaxValue bool

ForRangeColumnsPruning is used for range partition pruning.

type ForRangePruning Uses

type ForRangePruning struct {
    LessThan []int64
    MaxValue bool
    Unsigned bool

ForRangePruning is used for range partition pruning.

type PartitionExpr Uses

type PartitionExpr struct {
    // UpperBounds: (x < y1); (x < y2); (x < y3), used by locatePartition.
    UpperBounds []expression.Expression
    // OrigExpr is the partition expression ast used in point get.
    OrigExpr ast.ExprNode
    // Expr is the hash partition expression.
    Expr expression.Expression
    // Used in the range pruning process.
    // Used in the range column pruning process.

PartitionExpr is the partition definition expressions.

type TableCommon Uses

type TableCommon struct {
    Columns         []*table.Column
    PublicColumns   []*table.Column
    VisibleColumns  []*table.Column
    HiddenColumns   []*table.Column
    WritableColumns []*table.Column
    // contains filtered or unexported fields

TableCommon is shared by both Table and partition.

func (*TableCommon) AddRecord Uses

func (t *TableCommon) AddRecord(ctx sessionctx.Context, r []types.Datum, opts ...table.AddRecordOption) (recordID kv.Handle, err error)

AddRecord implements table.Table AddRecord interface.

func (*TableCommon) Allocators Uses

func (t *TableCommon) Allocators(ctx sessionctx.Context) autoid.Allocators

Allocators implements table.Table Allocators interface.

func (*TableCommon) Cols Uses

func (t *TableCommon) Cols() []*table.Column

Cols implements table.Table Cols interface.

func (*TableCommon) DeletableCols Uses

func (t *TableCommon) DeletableCols() []*table.Column

DeletableCols implements table DeletableCols interface.

func (*TableCommon) DeletableIndices Uses

func (t *TableCommon) DeletableIndices() []table.Index

DeletableIndices implements table.Table DeletableIndices interface.

func (*TableCommon) FirstKey Uses

func (t *TableCommon) FirstKey() kv.Key

FirstKey implements table.Table interface.

func (*TableCommon) GetPhysicalID Uses

func (t *TableCommon) GetPhysicalID() int64

GetPhysicalID implements table.Table GetPhysicalID interface.

func (*TableCommon) GetSequenceCommon Uses

func (t *TableCommon) GetSequenceCommon() *sequenceCommon

GetSequenceCommon is used in test to get sequenceCommon.

func (*TableCommon) GetSequenceID Uses

func (t *TableCommon) GetSequenceID() int64

GetSequenceID implements util.SequenceTable GetSequenceID interface.

func (*TableCommon) GetSequenceNextVal Uses

func (t *TableCommon) GetSequenceNextVal(ctx interface{}, dbName, seqName string) (nextVal int64, err error)

GetSequenceNextVal implements util.SequenceTable GetSequenceNextVal interface. Caching the sequence value in table, we can easily be notified with the cache empty, and write the binlogInfo in table level rather than in allocator.

func (*TableCommon) HiddenCols Uses

func (t *TableCommon) HiddenCols() []*table.Column

HiddenCols implements table.Table HiddenCols interface.

func (*TableCommon) IndexPrefix Uses

func (t *TableCommon) IndexPrefix() kv.Key

IndexPrefix implements table.Table interface.

func (*TableCommon) Indices Uses

func (t *TableCommon) Indices() []table.Index

Indices implements table.Table Indices interface.

func (*TableCommon) IterRecords Uses

func (t *TableCommon) IterRecords(ctx sessionctx.Context, startKey kv.Key, cols []*table.Column,
    fn table.RecordIterFunc) error

IterRecords implements table.Table IterRecords interface.

func (*TableCommon) Meta Uses

func (t *TableCommon) Meta() *model.TableInfo

Meta implements table.Table Meta interface.

func (*TableCommon) RebaseAutoID Uses

func (t *TableCommon) RebaseAutoID(ctx sessionctx.Context, newBase int64, isSetStep bool, tp autoid.AllocatorType) error

RebaseAutoID implements table.Table RebaseAutoID interface. Both auto-increment and auto-random can use this function to do rebase on explicit newBase value (without shadow bits).

func (*TableCommon) RecordKey Uses

func (t *TableCommon) RecordKey(h kv.Handle) kv.Key

RecordKey implements table.Table interface.

func (*TableCommon) RecordPrefix Uses

func (t *TableCommon) RecordPrefix() kv.Key

RecordPrefix implements table.Table interface.

func (*TableCommon) RemoveRecord Uses

func (t *TableCommon) RemoveRecord(ctx sessionctx.Context, h kv.Handle, r []types.Datum) error

RemoveRecord implements table.Table RemoveRecord interface.

func (*TableCommon) Row Uses

func (t *TableCommon) Row(ctx sessionctx.Context, h kv.Handle) ([]types.Datum, error)

Row implements table.Table Row interface.

func (*TableCommon) RowWithCols Uses

func (t *TableCommon) RowWithCols(ctx sessionctx.Context, h kv.Handle, cols []*table.Column) ([]types.Datum, error)

RowWithCols implements table.Table RowWithCols interface.

func (*TableCommon) Seek Uses

func (t *TableCommon) Seek(ctx sessionctx.Context, h kv.Handle) (kv.Handle, bool, error)

Seek implements table.Table Seek interface.

func (*TableCommon) SetSequenceVal Uses

func (t *TableCommon) SetSequenceVal(ctx interface{}, newVal int64, dbName, seqName string) (int64, bool, error)

SetSequenceVal implements util.SequenceTable SetSequenceVal interface. The returned bool indicates the newVal is already under the base.

func (*TableCommon) Type Uses

func (t *TableCommon) Type() table.Type

Type implements table.Table Type interface.

func (*TableCommon) UpdateRecord Uses

func (t *TableCommon) UpdateRecord(ctx sessionctx.Context, h kv.Handle, oldData, newData []types.Datum, touched []bool) error

UpdateRecord implements table.Table UpdateRecord interface. `touched` means which columns are really modified, used for secondary indices. Length of `oldData` and `newData` equals to length of `t.WritableCols()`.

func (*TableCommon) VisibleCols Uses

func (t *TableCommon) VisibleCols() []*table.Column

VisibleCols implements table.Table VisibleCols interface.

func (*TableCommon) WritableCols Uses

func (t *TableCommon) WritableCols() []*table.Column

WritableCols implements table WritableCols interface.

func (*TableCommon) WritableIndices Uses

func (t *TableCommon) WritableIndices() []table.Index

WritableIndices implements table.Table WritableIndices interface.

Package tables imports 41 packages (graph) and is imported by 216 packages. Updated 2020-05-28. Refresh now. Tools for package owners.