tidb

package module
v0.0.0-...-2cce608 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2017 License: Apache-2.0 Imports: 37 Imported by: 0

README

Build Status Go Report Card Project Status CircleCI Status

What is TiDB?

TiDB (The pronunciation is: /'taɪdiːbi:/ tai-D-B, etymology: titanium) is a distributed SQL database. Inspired by the design of Google F1 and Google Spanner, TiDB supports the best features of both traditional RDBMS and NoSQL.

  • Horizontal scalability Grow TiDB as your business grows. You can increase the capacity simply by adding more machines.

  • Asynchronous schema changes Evolve TiDB schemas as your requirement evolves. You can add new columns and indices without stopping or affecting the on-going operations.

  • Consistent distributed transactions Think of TiDB as a single-machine RDBMS. You can start a transaction that crosses multiple machines without worrying about consistency. TiDB makes your application code simple and robust.

  • Compatible with MySQL protocol Use TiDB as MySQL. You can replace MySQL with TiDB to power your application without changing a single line of code in most cases.

  • Written in Go Enjoy TiDB as much as we love Go. We believe Go code is both easy and enjoyable to work with. Go makes us improve TiDB fast and makes it easy to dive into the codebase.

  • NewSQL over TiKV Turn TiKV into NewSQL database.

  • Multiple storage engine support Power TiDB with your most favorite engines. TiDB supports many popular storage engines in single-machine mode. You can choose from GolevelDB, LevelDB, RocksDB, LMDB, BoltDB and even more to come.

For more details, read our blog How we build TiDB

Roadmap

Read the Roadmap.

Quick start

Read the Quick Start.

Documentation

Architecture

architecture

Contributing

Contributions are welcomed and greatly appreciated. See CONTRIBUTING.md for details on submitting patches and the contribution workflow.

Follow us

Twitter

@PingCAP

Mailing list

tidb-user@googlegroups.com

Google Group

License

TiDB is under the Apache 2.0 license. See the LICENSE file for details.

Acknowledgments

Documentation

Index

Constants

View Source
const (
	// CreateUserTable is the SQL statement creates User table in system db.
	CreateUserTable = `` /* 804-byte string literal not displayed */

	// CreateDBPrivTable is the SQL statement creates DB scope privilege table in system db.
	CreateDBPrivTable = `` /* 628-byte string literal not displayed */

	// CreateTablePrivTable is the SQL statement creates table scope privilege table in system db.
	CreateTablePrivTable = `` /* 379-byte string literal not displayed */

	// CreateColumnPrivTable is the SQL statement creates column scope privilege table in system db.
	CreateColumnPrivTable = `` /* 299-byte string literal not displayed */

	// CreateGloablVariablesTable is the SQL statement creates global variable table in system db.
	// TODO: MySQL puts GLOBAL_VARIABLES table in INFORMATION_SCHEMA db.
	// INFORMATION_SCHEMA is a virtual db in TiDB. So we put this table in system db.
	// Maybe we will put it back to INFORMATION_SCHEMA.
	CreateGloablVariablesTable = `` /* 147-byte string literal not displayed */

	// CreateTiDBTable is the SQL statement creates a table in system db.
	// This table is a key-value struct contains some information used by TiDB.
	// Currently we only put bootstrapped in it which indicates if the system is already bootstrapped.
	CreateTiDBTable = `` /* 160-byte string literal not displayed */

	// CreateHelpTopic is the SQL statement creates help_topic table in system db.
	// See: https://dev.mysql.com/doc/refman/5.5/en/system-database.html#system-database-help-tables
	CreateHelpTopic = `` /* 392-byte string literal not displayed */

	// CreateStatsMetaTable stores the meta of table statistics.
	CreateStatsMetaTable = `` /* 270-byte string literal not displayed */

	// CreateStatsColsTable stores the statistics of table columns.
	CreateStatsColsTable = `` /* 435-byte string literal not displayed */

	// CreateStatsBucketsTable stores the histogram info for every table columns.
	CreateStatsBucketsTable = `` /* 322-byte string literal not displayed */

)
View Source
const (
	EngineGoLevelDBMemory = "memory://"
)

Engine prefix name

Variables

This section is empty.

Functions

func BootstrapSession

func BootstrapSession(store kv.Storage) (*domain.Domain, error)

BootstrapSession runs the first time when the TiDB server start.

func Compile

func Compile(ctx context.Context, rawStmt ast.StmtNode) (ast.Statement, error)

Compile is safe for concurrent use by multiple goroutines.

func GetRows

func GetRows(rs ast.RecordSet) ([][]types.Datum, error)

GetRows gets all the rows from a RecordSet.

func IsQuery

func IsQuery(sql string) bool

IsQuery checks if a sql statement is a query statement.

func NewStore

func NewStore(path string) (kv.Storage, error)

NewStore creates a kv Storage with path.

The path must be a URL format 'engine://path?params' like the one for tidb.Open() but with the dbname cut off. Examples:

goleveldb://relative/path
boltdb:///absolute/path

The engine should be registered before creating storage.

func Parse

func Parse(ctx context.Context, src string) ([]ast.StmtNode, error)

Parse parses a query string to raw ast.StmtNode.

func RegisterLocalStore

func RegisterLocalStore(name string, driver engine.Driver) error

RegisterLocalStore registers a local kv storage with unique name and its associated engine Driver.

func RegisterStore

func RegisterStore(name string, driver kv.Driver) error

RegisterStore registers a kv storage with unique name and its associated Driver.

func SetCommitRetryLimit

func SetCommitRetryLimit(limit int)

SetCommitRetryLimit setups the maximum number of retries when trying to recover from retryable errors. Retryable errors are generally refer to temporary errors that are expected to be reinstated by retry, including network interruption, transaction conflicts, and so on.

func SetSchemaLease

func SetSchemaLease(lease time.Duration)

SetSchemaLease changes the default schema lease time for DDL. This function is very dangerous, don't use it if you really know what you do. SetSchemaLease only affects not local storage after bootstrapped.

Types

type Session

type Session interface {
	context.Context
	Status() uint16                              // Flag of current status, such as autocommit.
	LastInsertID() uint64                        // Last inserted auto_increment id.
	AffectedRows() uint64                        // Affected rows by latest executed stmt.
	Execute(sql string) ([]ast.RecordSet, error) // Execute a sql statement.
	String() string                              // For debug
	CommitTxn() error
	RollbackTxn() error
	// For execute prepare statement in binary protocol.
	PrepareStmt(sql string) (stmtID uint32, paramCount int, fields []*ast.ResultField, err error)
	// Execute a prepared statement.
	ExecutePreparedStmt(stmtID uint32, param ...interface{}) (ast.RecordSet, error)
	DropPreparedStmt(stmtID uint32) error
	SetClientCapability(uint32) // Set client capability flags.
	SetConnectionID(uint64)
	SetSessionManager(util.SessionManager)
	Close() error
	Auth(user string, auth []byte, salt []byte) bool
	// Cancel the execution of current transaction.
	Cancel()
	ShowProcess() util.ProcessInfo
}

Session context

func CreateSession

func CreateSession(store kv.Storage) (Session, error)

CreateSession creates a new session environment.

Directories

Path Synopsis
_vendor
src/github.com/beorn7/perks/quantile
Package quantile computes approximate quantiles over an unbounded data stream within low memory and CPU bounds.
Package quantile computes approximate quantiles over an unbounded data stream within low memory and CPU bounds.
src/github.com/boltdb/bolt
Package bolt implements a low-level key/value store in pure Go.
Package bolt implements a low-level key/value store in pure Go.
src/github.com/coreos/etcd/auth/authpb
Package authpb is a generated protocol buffer package.
Package authpb is a generated protocol buffer package.
src/github.com/coreos/etcd/clientv3
Package clientv3 implements the official Go etcd client for v3.
Package clientv3 implements the official Go etcd client for v3.
src/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes
Package rpctypes has types and values shared by the etcd server and client for v3 RPC interaction.
Package rpctypes has types and values shared by the etcd server and client for v3 RPC interaction.
src/github.com/coreos/etcd/etcdserver/etcdserverpb
Package etcdserverpb is a generated protocol buffer package.
Package etcdserverpb is a generated protocol buffer package.
src/github.com/coreos/etcd/mvcc/mvccpb
Package mvccpb is a generated protocol buffer package.
Package mvccpb is a generated protocol buffer package.
src/github.com/coreos/etcd/pkg/monotime
Package monotime provides a fast monotonic clock source.
Package monotime provides a fast monotonic clock source.
src/github.com/cznic/golex/lex
Package lex is a Unicode-friendly run time library for golex[0] generated lexical analyzers[1].
Package lex is a Unicode-friendly run time library for golex[0] generated lexical analyzers[1].
src/github.com/cznic/mathutil
Package mathutil provides utilities supplementing the standard 'math' and 'math/rand' packages.
Package mathutil provides utilities supplementing the standard 'math' and 'math/rand' packages.
src/github.com/cznic/parser/yacc
Package parser implements a parser for yacc source files.
Package parser implements a parser for yacc source files.
src/github.com/cznic/sortutil
Package sortutil provides utilities supplementing the standard 'sort' package.
Package sortutil provides utilities supplementing the standard 'sort' package.
src/github.com/cznic/strutil
Package strutil collects utils supplemental to the standard strings package.
Package strutil collects utils supplemental to the standard strings package.
src/github.com/cznic/y
Package y converts .y (yacc[2]) source files to data suitable for a parser generator.
Package y converts .y (yacc[2]) source files to data suitable for a parser generator.
src/github.com/go-sql-driver/mysql
Go MySQL Driver - A MySQL-Driver for Go's database/sql package The driver should be used via the database/sql package: import "database/sql" import _ "github.com/go-sql-driver/mysql" db, err := sql.Open("mysql", "user:password@/dbname") See https://github.com/go-sql-driver/mysql#usage for details
Go MySQL Driver - A MySQL-Driver for Go's database/sql package The driver should be used via the database/sql package: import "database/sql" import _ "github.com/go-sql-driver/mysql" db, err := sql.Open("mysql", "user:password@/dbname") See https://github.com/go-sql-driver/mysql#usage for details
src/github.com/golang/protobuf/jsonpb
Package jsonpb provides marshaling and unmarshaling between protocol buffers and JSON.
Package jsonpb provides marshaling and unmarshaling between protocol buffers and JSON.
src/github.com/golang/protobuf/proto
Package proto converts data structures to and from the wire format of protocol buffers.
Package proto converts data structures to and from the wire format of protocol buffers.
src/github.com/golang/snappy
Package snappy implements the snappy block-based compression format.
Package snappy implements the snappy block-based compression format.
src/github.com/gorilla/context
Package context stores values shared during a request lifetime.
Package context stores values shared during a request lifetime.
src/github.com/gorilla/mux
Package mux implements a request router and dispatcher.
Package mux implements a request router and dispatcher.
src/github.com/grpc-ecosystem/grpc-gateway/runtime
Package runtime contains runtime helper functions used by servers which protoc-gen-grpc-gateway generates.
Package runtime contains runtime helper functions used by servers which protoc-gen-grpc-gateway generates.
src/github.com/grpc-ecosystem/grpc-gateway/runtime/internal
Package internal is a generated protocol buffer package.
Package internal is a generated protocol buffer package.
src/github.com/grpc-ecosystem/grpc-gateway/utilities
Package utilities provides members for internal use in grpc-gateway.
Package utilities provides members for internal use in grpc-gateway.
src/github.com/juju/errors
[godoc-link-here] The juju/errors provides an easy way to annotate errors without losing the orginal error context.
[godoc-link-here] The juju/errors provides an easy way to annotate errors without losing the orginal error context.
src/github.com/matttproud/golang_protobuf_extensions/pbutil
Package pbutil provides record length-delimited Protocol Buffer streaming.
Package pbutil provides record length-delimited Protocol Buffer streaming.
src/github.com/ngaut/log
high level log wrapper, so it can output different log based on level
high level log wrapper, so it can output different log based on level
src/github.com/ngaut/pools
Package pools provides functionality to manage and reuse resources like connections.
Package pools provides functionality to manage and reuse resources like connections.
src/github.com/petar/GoLLRB/llrb
A Left-Leaning Red-Black (LLRB) implementation of 2-3 balanced binary search trees, based on the following work: http://www.cs.princeton.edu/~rs/talks/LLRB/08Penn.pdf http://www.cs.princeton.edu/~rs/talks/LLRB/LLRB.pdf http://www.cs.princeton.edu/~rs/talks/LLRB/Java/RedBlackBST.java 2-3 trees (and the run-time equivalent 2-3-4 trees) are the de facto standard BST algoritms found in implementations of Python, Java, and other libraries.
A Left-Leaning Red-Black (LLRB) implementation of 2-3 balanced binary search trees, based on the following work: http://www.cs.princeton.edu/~rs/talks/LLRB/08Penn.pdf http://www.cs.princeton.edu/~rs/talks/LLRB/LLRB.pdf http://www.cs.princeton.edu/~rs/talks/LLRB/Java/RedBlackBST.java 2-3 trees (and the run-time equivalent 2-3-4 trees) are the de facto standard BST algoritms found in implementations of Python, Java, and other libraries.
src/github.com/pingcap/check
Package check is a rich testing extension for Go's testing package.
Package check is a rich testing extension for Go's testing package.
src/github.com/pingcap/goleveldb/leveldb
Package leveldb provides implementation of LevelDB key/value database.
Package leveldb provides implementation of LevelDB key/value database.
src/github.com/pingcap/goleveldb/leveldb/cache
Package cache provides interface and implementation of a cache algorithms.
Package cache provides interface and implementation of a cache algorithms.
src/github.com/pingcap/goleveldb/leveldb/comparer
Package comparer provides interface and implementation for ordering sets of data.
Package comparer provides interface and implementation for ordering sets of data.
src/github.com/pingcap/goleveldb/leveldb/errors
Package errors provides common error types used throughout leveldb.
Package errors provides common error types used throughout leveldb.
src/github.com/pingcap/goleveldb/leveldb/filter
Package filter provides interface and implementation of probabilistic data structure.
Package filter provides interface and implementation of probabilistic data structure.
src/github.com/pingcap/goleveldb/leveldb/iterator
Package iterator provides interface and implementation to traverse over contents of a database.
Package iterator provides interface and implementation to traverse over contents of a database.
src/github.com/pingcap/goleveldb/leveldb/journal
Package journal reads and writes sequences of journals.
Package journal reads and writes sequences of journals.
src/github.com/pingcap/goleveldb/leveldb/memdb
Package memdb provides in-memory key/value database implementation.
Package memdb provides in-memory key/value database implementation.
src/github.com/pingcap/goleveldb/leveldb/opt
Package opt provides sets of options used by LevelDB.
Package opt provides sets of options used by LevelDB.
src/github.com/pingcap/goleveldb/leveldb/storage
Package storage provides storage abstraction for LevelDB.
Package storage provides storage abstraction for LevelDB.
src/github.com/pingcap/goleveldb/leveldb/table
Package table allows read and write sorted key/value.
Package table allows read and write sorted key/value.
src/github.com/pingcap/goleveldb/leveldb/util
Package util provides utilities used throughout leveldb.
Package util provides utilities used throughout leveldb.
src/github.com/pingcap/kvproto/pkg/coprocessor
Package coprocessor is a generated protocol buffer package.
Package coprocessor is a generated protocol buffer package.
src/github.com/pingcap/kvproto/pkg/eraftpb
Package eraftpb is a generated protocol buffer package.
Package eraftpb is a generated protocol buffer package.
src/github.com/pingcap/kvproto/pkg/errorpb
Package errorpb is a generated protocol buffer package.
Package errorpb is a generated protocol buffer package.
src/github.com/pingcap/kvproto/pkg/kvrpcpb
Package kvrpcpb is a generated protocol buffer package.
Package kvrpcpb is a generated protocol buffer package.
src/github.com/pingcap/kvproto/pkg/metapb
Package metapb is a generated protocol buffer package.
Package metapb is a generated protocol buffer package.
src/github.com/pingcap/kvproto/pkg/msgpb
Package msgpb is a generated protocol buffer package.
Package msgpb is a generated protocol buffer package.
src/github.com/pingcap/kvproto/pkg/pdpb
Package pdpb is a generated protocol buffer package.
Package pdpb is a generated protocol buffer package.
src/github.com/pingcap/kvproto/pkg/raft_cmdpb
Package raft_cmdpb is a generated protocol buffer package.
Package raft_cmdpb is a generated protocol buffer package.
src/github.com/pingcap/kvproto/pkg/raft_serverpb
Package raft_serverpb is a generated protocol buffer package.
Package raft_serverpb is a generated protocol buffer package.
src/github.com/pingcap/tipb/go-binlog
Package binlog is a generated protocol buffer package.
Package binlog is a generated protocol buffer package.
src/github.com/pingcap/tipb/go-tipb
Package tipb is a generated protocol buffer package.
Package tipb is a generated protocol buffer package.
src/github.com/prometheus/client_golang/prometheus
Package prometheus provides metrics primitives to instrument code for monitoring.
Package prometheus provides metrics primitives to instrument code for monitoring.
src/github.com/prometheus/client_golang/prometheus/push
Package push provides functions to push metrics to a Pushgateway.
Package push provides functions to push metrics to a Pushgateway.
src/github.com/prometheus/client_model/go
Package io_prometheus_client is a generated protocol buffer package.
Package io_prometheus_client is a generated protocol buffer package.
src/github.com/prometheus/common/expfmt
A package for reading and writing Prometheus metrics.
A package for reading and writing Prometheus metrics.
HTTP Content-Type Autonegotiation.
src/github.com/prometheus/common/model
Package model contains common data structures that are shared across Prometheus components and libraries.
Package model contains common data structures that are shared across Prometheus components and libraries.
src/github.com/prometheus/procfs
Package procfs provides functions to retrieve system, kernel and process metrics from the pseudo-filesystem proc.
Package procfs provides functions to retrieve system, kernel and process metrics from the pseudo-filesystem proc.
src/github.com/twinj/uuid
This package provides RFC4122 UUIDs.
This package provides RFC4122 UUIDs.
src/golang.org/x/net/context
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
src/golang.org/x/net/http2
Package http2 implements the HTTP/2 protocol.
Package http2 implements the HTTP/2 protocol.
src/golang.org/x/net/http2/hpack
Package hpack implements HPACK, a compression format for efficiently representing HTTP header fields in the context of HTTP/2.
Package hpack implements HPACK, a compression format for efficiently representing HTTP header fields in the context of HTTP/2.
src/golang.org/x/net/internal/timeseries
Package timeseries implements a time series structure for stats collection.
Package timeseries implements a time series structure for stats collection.
src/golang.org/x/net/trace
Package trace implements tracing of requests and long-lived objects.
Package trace implements tracing of requests and long-lived objects.
src/golang.org/x/sys/unix
Package unix contains an interface to the low-level operating system primitives.
Package unix contains an interface to the low-level operating system primitives.
src/golang.org/x/text/encoding
Package encoding defines an interface for character encodings, such as Shift JIS and Windows 1252, that can convert to and from UTF-8.
Package encoding defines an interface for character encodings, such as Shift JIS and Windows 1252, that can convert to and from UTF-8.
src/golang.org/x/text/encoding/charmap
Package charmap provides simple character encodings such as IBM Code Page 437 and Windows 1252.
Package charmap provides simple character encodings such as IBM Code Page 437 and Windows 1252.
src/golang.org/x/text/encoding/internal
Package internal contains code that is shared among encoding implementations.
Package internal contains code that is shared among encoding implementations.
src/golang.org/x/text/encoding/internal/identifier
Package identifier defines the contract between implementations of Encoding and Index by defining identifiers that uniquely identify standardized coded character sets (CCS) and character encoding schemes (CES), which we will together refer to as encodings, for which Encoding implementations provide converters to and from UTF-8.
Package identifier defines the contract between implementations of Encoding and Index by defining identifiers that uniquely identify standardized coded character sets (CCS) and character encoding schemes (CES), which we will together refer to as encodings, for which Encoding implementations provide converters to and from UTF-8.
src/golang.org/x/text/encoding/japanese
Package japanese provides Japanese encodings such as EUC-JP and Shift JIS.
Package japanese provides Japanese encodings such as EUC-JP and Shift JIS.
src/golang.org/x/text/encoding/korean
Package korean provides Korean encodings such as EUC-KR.
Package korean provides Korean encodings such as EUC-KR.
src/golang.org/x/text/encoding/simplifiedchinese
Package simplifiedchinese provides Simplified Chinese encodings such as GBK.
Package simplifiedchinese provides Simplified Chinese encodings such as GBK.
src/golang.org/x/text/encoding/traditionalchinese
Package traditionalchinese provides Traditional Chinese encodings such as Big5.
Package traditionalchinese provides Traditional Chinese encodings such as Big5.
src/golang.org/x/text/encoding/unicode
Package unicode provides Unicode encodings such as UTF-16.
Package unicode provides Unicode encodings such as UTF-16.
src/golang.org/x/text/transform
Package transform provides reader and writer wrappers that transform the bytes passing through as well as various transformations.
Package transform provides reader and writer wrappers that transform the bytes passing through as well as various transformations.
src/google.golang.org/grpc
Package grpc implements an RPC system called gRPC.
Package grpc implements an RPC system called gRPC.
src/google.golang.org/grpc/codes
Package codes defines the canonical error codes used by gRPC.
Package codes defines the canonical error codes used by gRPC.
src/google.golang.org/grpc/credentials
Package credentials implements various credentials supported by gRPC library, which encapsulate all the state needed by a client to authenticate with a server and make various assertions, e.g., about the client's identity, role, or whether it is authorized to make a particular call.
Package credentials implements various credentials supported by gRPC library, which encapsulate all the state needed by a client to authenticate with a server and make various assertions, e.g., about the client's identity, role, or whether it is authorized to make a particular call.
src/google.golang.org/grpc/grpclog
Package grpclog defines logging for grpc.
Package grpclog defines logging for grpc.
src/google.golang.org/grpc/internal
Package internal contains gRPC-internal code for testing, to avoid polluting the godoc of the top-level grpc package.
Package internal contains gRPC-internal code for testing, to avoid polluting the godoc of the top-level grpc package.
src/google.golang.org/grpc/metadata
Package metadata define the structure of the metadata supported by gRPC library.
Package metadata define the structure of the metadata supported by gRPC library.
src/google.golang.org/grpc/naming
Package naming defines the naming API and related data structures for gRPC.
Package naming defines the naming API and related data structures for gRPC.
src/google.golang.org/grpc/peer
Package peer defines various peer information associated with RPCs and corresponding utils.
Package peer defines various peer information associated with RPCs and corresponding utils.
src/google.golang.org/grpc/transport
Package transport defines and implements message oriented communication channel to complete various transactions (e.g., an RPC).
Package transport defines and implements message oriented communication channel to complete various transactions (e.g., an RPC).
Package ast is the abstract syntax tree parsed from a SQL statement by parser.
Package ast is the abstract syntax tree parsed from a SQL statement by parser.
cmd
goyacc
Goyacc is a version of yacc generating Go parsers.
Goyacc is a version of yacc generating Go parsers.
store
tikv
Package tikv provides tcp connection to kvserver.
Package tikv provides tcp connection to kvserver.
mock
Package mock is just for test only.
Package mock is just for test only.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL