Coder Social home page Coder Social logo

pingcap / tidb Goto Github PK

View Code? Open in Web Editor NEW
36.1K 1.3K 5.7K 452.1 MB

TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://tidbcloud.com/free-trial

Home Page: https://pingcap.com

License: Apache License 2.0

Makefile 0.09% Go 94.16% Shell 1.39% Dockerfile 0.01% Ragel 0.01% HTML 0.01% TypeScript 0.15% JavaScript 0.01% Yacc 0.94% Jsonnet 0.04% Starlark 3.21% Smarty 0.01%
distributed-database distributed-transactions tidb database scale mysql htap sql cloud-native serverless

tidb's Introduction

TiDB, a distributed SQL database

LICENSE Language Build Status Go Report Card GitHub release GitHub release date Coverage Status GoDoc

Official Website Playground


       

What is TiDB?

TiDB (/’taɪdiːbi:/, "Ti" stands for Titanium) is an open-source distributed SQL database that supports Hybrid Transactional and Analytical Processing (HTAP) workloads. It is MySQL compatible and features horizontal scalability, strong consistency, and high availability.

See what TiDB is capable ONLINE at TiDB Playground.

For more details and latest updates, see TiDB documentation and release notes.

For future plans, see the TiDB roadmap.

Quick start

Start with TiDB Cloud

TiDB Cloud is the fully-managed service of TiDB, currently available on AWS and GCP.

Quickly check out TiDB Cloud with a free trial.

See TiDB Cloud Quick Start Guide.

Start with TiDB

See TiDB Quick Start Guide.

Start developing TiDB

See the Get Started chapter of TiDB Development Guide.

Community

You can join the following groups or channels to discuss or ask questions about TiDB, and to keep yourself informed of the latest TiDB updates:

For support, please contact PingCAP.

Contributing

The community repository hosts all information about the TiDB community, including how to contribute to TiDB, how the TiDB community is governed, how teams are organized.

Contributions are welcomed and greatly appreciated. You can get started with one of the good first issues or help wanted issues. For more details on typical contribution workflows, see Contribute to TiDB. For more contributing information about where to start, click the contributor icon below.

contribution-map

Every contributor is welcome to claim your contribution swag by filling in and submitting this form.

Activity Trends of pingcap/tidb - Last 28 days

Case studies

Architecture

TiDB architecture

License

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

Acknowledgments

tidb's People

Contributors

ailinkid avatar alivxxx avatar coocood avatar crazycs520 avatar defined2014 avatar disksing avatar eurekaka avatar hanfei1991 avatar hawkingrei avatar jackysp avatar lance6716 avatar lcwangchao avatar lysu avatar lzmhhh123 avatar morgo avatar ngaut avatar qiuyesuifeng avatar qw4990 avatar shenli avatar siddontang avatar tangenta avatar tiancaiamao avatar winoros avatar wjhuang2016 avatar wshwsh12 avatar xiongjiwei avatar xuhuaiyu avatar yisaer avatar zimulala avatar zz-jason avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tidb's Issues

add separator for index key prefix and index value

now the index prefix is fmt.Sprintf("%s_%s", indexPrefix, indexName), it is not enough as the index key prefix.

the index key format: prefix + codec(value)

assume we have two indices naming c1 and c, the index c1 may be 123_c1{value}, but the index c may be 123_c{value}, as you see, if the value contain 1 in index c, we may have same prefix for index c1, and we will get the wrong data using index c1.

the index key format may be indexPrefix_indexName\xff\xff, why \xff\xff? We will guarantee that any codec value is less than \xff\xff.

Wrap all the data in tidb into a struct

We should define a struct like:
type TidbData struct {
Type *FieldType
Value interface{}
}
When doing string encode/decode/compare we need know charset/collation information. But we can not get this information at anywhere. For examples:
In cast/convert we do not known the current encoding.
In compare, we do not known the collation for string (collation is used to decide case-sensitive of case-insensitive).

And with this struct, we could abandon mysql.Time mysql.Duration.

compile fail on Windows

qq 20150906173942

two questions:

  1. syscall.Dup2() can't works on Windows. There is any plan for Windows support.
  2. it needs iconv.h as cgo library. Is it possible to use pure go codes instead of cgo codes ?

`

[beego-orm]Support Like binary

https://dev.mysql.com/doc/refman/5.7/en/string-comparison-functions.html#operator_like

The following two statements illustrate that string comparisons are not case sensitive unless one of the operands is a case sensitive (uses a case-sensitive collation or is a binary string):

mysql> SELECT 'abc' LIKE 'ABC';
-> 1
mysql> SELECT 'abc' LIKE _latin1 'ABC' COLLATE latin1_general_cs;
-> 0
mysql> SELECT 'abc' LIKE _latin1 'ABC' COLLATE latin1_bin;
-> 0
mysql> SELECT 'abc' LIKE BINARY 'ABC';
-> 0

time_test failure

Hi,
when running the tests I get a failure:

FAIL: time_test.go:292: testTimeSuite.TestCodec

time_test.go:305:
    c.Assert(t.String(), Not(Equals), t1.String())
... obtained string = "2010-10-10 10:11:11"
... expected string = "2010-10-10 10:11:11

I think the problem is that the tested timezone is equal to my local timezone while it is assumed to be different.

golint not happy with these files

😃

golint ./...
driver.go:331:24: func LastInsertId should be LastInsertID
parser/scanner.go:41:30: exported func NewLexer returns unexported type *parser.lexer, which can be annoying to use

Better explanation on errors

Hi,

I'm using https://github.com/go-xorm/tidb as driver for xorm, and when xorm executes following command:

SELECT `TABLE_NAME`, `ENGINE`, `TABLE_ROWS`, `AUTO_INCREMENT` from `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=? AND (`ENGINE`='MyISAM' OR `ENGINE` = 'InnoDB') [data/gogs.tidb]

TiDB gives me error:

[error] Compile sql error: use gogs.tidb - 1:9 expected one of [$end, ';', CHARACTER, CHARSET, COLLATE, DEFAULT]

So, which exactly this 1:9 points to? Maybe error message can be more clear like how MySQL does:

xxx near "my statement"

Or

expect xx but found yy 

can be very helpful, too!

Thanks!

make interpreter failed

The make interpreter is running

godep go build -ldflags -X "github.com/pingcap/pingcap/util/printer.TiDBBuildTS=2015-09-07 03:40:55" -X
"github.com/pingcap/pingcap/util/printer.TiDBGitHash=81db754a49a63551beb9cd936153eb1f6c612c67  

and it failed. godep go build succeed though.

can't load package: package github.com/pingcap/pingcap/util/printer.TiDBBuildTS=2015-09-07 03:40:55: cannot find package "github.com/pingcap/pingcap/util/printer.TiDBBuildTS=2015-09-07 03:40:55" in any of:
    /usr/local/Cellar/go/1.4.2/libexec/src/github.com/pingcap/pingcap/util/printer.TiDBBuildTS=2015-09-07 03:40:55 (from $GOROOT)
    /Users/leicao/programming/go/src/github.com/pingcap/tidb/Godeps/_workspace/src/github.com/pingcap/pingcap/util/printer.TiDBBuildTS=2015-09-07 03:40:55 (from $GOPATH)
    /Users/leicao/programming/go/src/github.com/pingcap/pingcap/util/printer.TiDBBuildTS=2015-09-07 03:40:55
can't load package: package -X: cannot find package "-X" in any of:
    /usr/local/Cellar/go/1.4.2/libexec/src/-X (from $GOROOT)
    /Users/leicao/programming/go/src/github.com/pingcap/tidb/Godeps/_workspace/src/-X (from $GOPATH)
    /Users/leicao/programming/go/src/-X
can't load package: package github.com/pingcap/pingcap/util/printer.TiDBGitHash=81db754a49a63551beb9cd936153eb1f6c612c67: cannot find package "github.com/pingcap/pingcap/util/printer.TiDBGitHash=81db754a49a63551beb9cd936153eb1f6c612c67" in any of:
    /usr/local/Cellar/go/1.4.2/libexec/src/github.com/pingcap/pingcap/util/printer.TiDBGitHash=81db754a49a63551beb9cd936153eb1f6c612c67 (from $GOROOT)
    /Users/leicao/programming/go/src/github.com/pingcap/tidb/Godeps/_workspace/src/github.com/pingcap/pingcap/util/printer.TiDBGitHash=81db754a49a63551beb9cd936153eb1f6c612c67 (from $GOPATH)
    /Users/leicao/programming/go/src/github.com/pingcap/pingcap/util/printer.TiDBGitHash=81db754a49a63551beb9cd936153eb1f6c612c67
godep: go exit status 1

having for aggregate field alias name bug

create table t1 (a int, b int) engine=innodb;
insert into t1 values (1,2), (1,3), (2,3), (2,4), (2,5), (3,4), (4,5), (4,100);

mysql> select a, sum(b) as b from t1 group by a having b > 4;
+------+------+
| a    | b    |
+------+------+
|    1 |    5 |
|    2 |   12 |
|    4 |  105 |
+------+------+

but we only get one row result.

Support phpMyAdmin

TiDB are some distance away from running phpMyAdmin.

Support "SHOW VARIABLES LIKE 'character_set_results'" fixed in #114

TODO:
SET CHARACTER SET 'utf8mb4';

Several cases of copyright infringement

This repository publishes code copied from and/or based on copyrighted 3rd party code published under specific licenses; without fulfilling the terms defined in those licenses. Particularly, the original license comments in the original files were removed and replaced by a license claim of the infringing party. That's not acceptable. Also, it's just silly, as the original licenses permit to use/modify/republish or even sell the code without having to pay anything to the authors of the original code.

Examples

  • format.go contains verbatim copies of parts of code originaly published in strutil.go.
  • btree.go contains verbatim copies of parts of code originaly published in btree.go.
  • Many files found in the plan directory contain code clearly derived and/or parts sometimes verbatim copied from code originally published in plan.go.

In only minutes, I was able to found tens of similar additional copyright infringements. Also, this repository now has 100+ of forks and every single fork has the same copyright issue.

In essence, this project is an adaption/extension of the QL project for other SQL syntax and features, including alternative back-ends. (Which is, in sum, an amazing achievement - sincere congratulations.)

To the owners, maintainers of this repository: Please let me know your thoughts/plans/intentions related to this issue. Thanks.

Make test fail

System: Mac OS 10.10.5

Dump from console:

----------------------------------------------------------------------
FAIL: time_test.go:292: testTimeSuite.TestCodec

time_test.go:339:
    c.Assert(t.String(), Equals, t4.String())
... obtained string = "0001-01-01 00:00:00"
... expected string = "0000-12-31 23:00:00"


----------------------------------------------------------------------
FAIL: time_test.go:342: testTimeSuite.TestParseTimeFromNum

time_test.go:392:
    c.Assert(err, NotNil)
... value = nil

OOPS: 14 passed, 2 FAILED
--- FAIL: TestT (0.01s)
FAIL
coverage: 89.6% of statements

Is this a actually bug or just something wrong with test case?

[goleveldb] panic: runtime error: invalid memory address or nil pointer dereference

When I try to delete, it panic.

[xorm] [info]  2015/09/08 09:35:50.145837 [sql] DELETE FROM `userinfo` WHERE `id` = ? [args] [3]
2015/09/08 09:35:50 tidb.go:97: [debug] compiling prepared DELETE FROM `userinfo` WHERE `id` = ?
2015/09/08 09:35:50 txn.go:108: [debug] get key:142_r   �sdd, txn:94
2015/09/08 09:35:50 tidb.go:97: [debug] compiling prepared DELETE FROM `userinfo` WHERE `id` = ?
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x411745]

goroutine 201 [running]:
github.com/pingcap/tidb/store/localstore.(*dbSnapshot).Get(0xc820c49ff0, 0xc820e67300, 0x11, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0)
    /Users/lunny/gopath/src/github.com/pingcap/tidb/store/localstore/snapshot.go:34 +0x85
github.com/pingcap/tidb/kv.(*UnionStore).Get(0xc820c5c120, 0xc820e67300, 0x11, 0x20, 0x0, 0x0, 0x0, 0x1b00000, 0xc820061210)
    /Users/lunny/gopath/src/github.com/pingcap/tidb/kv/union_store.go:91 +0x11c
github.com/pingcap/tidb/store/localstore.(*dbTxn).Get(0xc820c5c120, 0xc820e67300, 0x11, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0)
    /Users/lunny/gopath/src/github.com/pingcap/tidb/store/localstore/txn.go:110 +0x34a
github.com/pingcap/tidb/table/tables.(*Table).RowWithCols(0xc82045d5f0, 0x1b82050, 0xc820018180, 0x9, 0xc8204208c0, 0x8, 0x8, 0x0, 0x0, 0x0, ...)
    /Users/lunny/gopath/src/github.com/pingcap/tidb/table/tables/tables.go:412 +0x23d
github.com/pingcap/tidb/table/tables.(*Table).Row(0xc82045d5f0, 0x1b82050, 0xc820018180, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0)
    /Users/lunny/gopath/src/github.com/pingcap/tidb/table/tables/tables.go:430 +0xce
github.com/pingcap/tidb/plan/plans.(*TableDefaultPlan).Do(0xc820c46e70, 0x1b82050, 0xc820018180, 0xc820222640, 0x0, 0x0)
    /Users/lunny/gopath/src/github.com/pingcap/tidb/plan/plans/from.go:283 +0x3d1
github.com/pingcap/tidb/plan/plans.(*JoinPlan).Do(0xc820019f80, 0x1b82050, 0xc820018180, 0xc820222640, 0x0, 0x0)
    /Users/lunny/gopath/src/github.com/pingcap/tidb/plan/plans/join.go:140 +0x6e
github.com/pingcap/tidb/plan/plans.(*FilterDefaultPlan).Do(0xc820c4e840, 0x1b82050, 0xc820018180, 0xc820c46fc0, 0x0, 0x0)
    /Users/lunny/gopath/src/github.com/pingcap/tidb/plan/plans/where.go:72 +0x1ad
github.com/pingcap/tidb/plan/plans.(*SelectLockPlan).Do(0xc820c4e880, 0x1b82050, 0xc820018180, 0xc820c46f90, 0x0, 0x0)
    /Users/lunny/gopath/src/github.com/pingcap/tidb/plan/plans/lock.go:63 +0xd7
github.com/pingcap/tidb/plan/plans.(*LimitDefaultPlan).Do(0xc820c46f60, 0x1b82050, 0xc820018180, 0xc820c4e980, 0x0, 0x0)
    /Users/lunny/gopath/src/github.com/pingcap/tidb/plan/plans/limit.go:69 +0x103
github.com/pingcap/tidb/plan/plans.(*SelectFinalPlan).Do(0xc820c4e8e0, 0x1b82050, 0xc820018180, 0xc820c49fb0, 0x0, 0x0)
    /Users/lunny/gopath/src/github.com/pingcap/tidb/plan/plans/final.go:59 +0xc4
github.com/pingcap/tidb/rset/rsets.Recordset.Do(0x1b82050, 0xc820018180, 0x1b82e58, 0xc820c4e8e0, 0xc820c49fa0, 0x0, 0x0)
    /Users/lunny/gopath/src/github.com/pingcap/tidb/rset/rsets/rsets.go:42 +0x97
github.com/pingcap/tidb/rset/rsets.(*Recordset).Do(0xc820c4e900, 0xc820c49fa0, 0x0, 0x0)
    <autogenerated>:6 +0xac
github.com/pingcap/tidb.newdriverRows.func1(0xc820c4e920)
    /Users/lunny/gopath/src/github.com/pingcap/tidb/driver.go:355 +0xa9
created by github.com/pingcap/tidb.newdriverRows
    /Users/lunny/gopath/src/github.com/pingcap/tidb/driver.go:374 +0xeb

goroutine 1 [chan receive]:
testing.RunTests(0xa13c40, 0xd70b20, 0x2, 0x2, 0x1)
    /Users/lunny/go1.5/src/testing/testing.go:562 +0x8ad
testing.(*M).Run(0xc820039f08, 0xc8201d1e60)
    /Users/lunny/go1.5/src/testing/testing.go:494 +0x70
main.main()
    github.com/go-xorm/tidb/_test/_testmain.go:72 +0x116

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /Users/lunny/go1.5/src/runtime/asm_amd64.s:1696 +0x1

goroutine 20 [IO wait]:
net.runtime_pollWait(0x1b81050, 0x72, 0xc820060080)
    /Users/lunny/go1.5/src/runtime/netpoll.go:157 +0x60
net.(*pollDesc).Wait(0xc820698060, 0x72, 0x0, 0x0)
    /Users/lunny/go1.5/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc820698060, 0x0, 0x0)
    /Users/lunny/go1.5/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).accept(0xc820698000, 0x0, 0x1b81148, 0xc8206920a0)
    /Users/lunny/go1.5/src/net/fd_unix.go:408 +0x27c
net.(*TCPListener).AcceptTCP(0xc820230008, 0xc820057dd0, 0x0, 0x0)
    /Users/lunny/go1.5/src/net/tcpsock_posix.go:254 +0x4d
net/http.tcpKeepAliveListener.Accept(0xc820230008, 0x0, 0x0, 0x0, 0x0)
    /Users/lunny/go1.5/src/net/http/server.go:2135 +0x41
net/http.(*Server).Serve(0xc820214000, 0x1b81110, 0xc820230008, 0x0, 0x0)
    /Users/lunny/go1.5/src/net/http/server.go:1887 +0xb3
net/http.(*Server).ListenAndServe(0xc820214000, 0x0, 0x0)
    /Users/lunny/go1.5/src/net/http/server.go:1877 +0x136
net/http.ListenAndServe(0x8c06d0, 0xe, 0x0, 0x0, 0x0, 0x0)
    /Users/lunny/go1.5/src/net/http/server.go:1967 +0x8f
created by github.com/pingcap/tidb.init.2
    /Users/lunny/gopath/src/github.com/pingcap/tidb/tidb.go:262 +0x1a6

Tidb not supported on windows built it?

C:\Users\insio>go get github.com/pingcap/tidb

github.com/pingcap/tidb/parser

E:\gopath\src\github.com\pingcap\tidb\parser\yy_parser.go:17: undefined: yyLexer
E:\gopath\src\github.com\pingcap\tidb\parser\yy_parser.go:18: undefined: yyParse

Duplicate column name 'id' when select count(*) from ...

go get github.com/go-xorm/tidb

and run go test, then it panic. Then we open the db use interpreter, and the result is below.

➜  tidb git:(master) ✗ interpreter -dbpath=./tidb -store=goleveldb
Welcome to the TiDB.
Version:
Git Commit Hash: None
UTC Build Time:  None

tidb> show tables;
+----------------+
| Tables_in_tidb |
+----------------+
| numeric        |
| picture        |
| userdetail     |
| userinfo       |
+----------------+
tidb> select * from userinfo;
2015/09/07 14:58:22 main.go:202: [error] github.com/pingcap/tidb/rset/rsets/join.go:210: Duplicate column name 'id'
github.com/pingcap/tidb/rset/rsets/join.go:104:
github.com/pingcap/tidb/rset/rsets/join.go:225:
github.com/pingcap/tidb/tidb.go:160:
github.com/pingcap/tidb/session.go:133:
github.com/pingcap/tidb/driver.go:309:
github.com/pingcap/tidb/interpreter/main.go:60:
tidb> desc userinfo;
+------------+---------------+------+-----+---------+----------------+
| Field      | Type          | Null | Key | Default | Extra          |
+------------+---------------+------+-----+---------+----------------+
| id         | BIGINT (20)   | NO   | PRI | NULL    | auto_increment |
| username   | VARCHAR (255) | YES  | UNI | NULL    |                |
| departname | VARCHAR (255) | YES  |     | NULL    |                |
| created    | DATETIME      | YES  |     | NULL    |                |
| detail_id  | INT (11)      | YES  |     | NULL    |                |
| height     | DOUBLE        | YES  |     | NULL    |                |
| avatar     | BLOB          | YES  |     | NULL    |                |
| is_man     | TINYINT (1)   | YES  |     | NULL    |                |
| id         | BIGINT (20)   | NO   | PRI | NULL    | auto_increment |
| username   | VARCHAR (255) | YES  |     | NULL    |                |
| departname | VARCHAR (255) | YES  |     | NULL    |                |
| created    | DATETIME      | YES  |     | NULL    |                |
| detail_id  | INT (11)      | YES  |     | NULL    |                |
| height     | DOUBLE        | YES  |     | NULL    |                |
| avatar     | BLOB          | YES  |     | NULL    |                |
| is_man     | TINYINT (1)   | YES  |     | NULL    |                |
+------------+---------------+------+-----+---------+----------------+

Add ParseTimeFromNum function for timezone support.

see #19 and #20
ParseTimeFromNum function not consider timezone, when convert to timestamp type, time validity check does not work well.

we should check following tests later.

    table := []struct {
        Input                int64
        ExpectDateTimeError  bool
        ExpectDateTimeValue  string
        ExpectTimeStampError bool
        ExpectTimeStampValue string
        ExpectDateError      bool
        ExpectDateValue      string
    }{
        {700101000000, false, "1970-01-01 00:00:00", false, "1970-01-01 00:00:00", false, "1970-01-01"},
        {380119031407, false, "2038-01-19 03:14:07", false, "2038-01-19 03:14:07", false, "2038-01-19"},
       }

Define function name in parser explicitly

Now we will PrimaryExpression to check function name, which is very loose, and we already meet parsing conflict with "any"/"some".
Maybe the best way is to define function name like MySQL parser does.

@shenli

goleveldb failed at CI test.

It happens randomly.

full log is at https://travis-ci.org/pingcap/tidb/jobs/79117789

2015/09/07 12:54:47 kv.go:121: [debug] Begin txn:103
2015/09/07 12:54:47 kv.go:121: [debug] Begin txn:104
2015/09/07 12:54:47 txn.go:155: [debug] set key:1, txn:104
2015/09/07 12:54:47 txn.go:155: [debug] set key:1, txn:103
2015/09/07 12:54:47 txn.go:266: [info] commit txn 104
2015/09/07 12:54:47 txn.go:266: [info] commit txn 104
panic: runtime error: index out of range
goroutine 115 [running]:
github.com/syndtr/goleveldb/leveldb/memdb.(*dbIter).Next(0xc208084880, 0xc208084800)
    /home/travis/gopath/src/github.com/pingcap/tidb/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/memdb/memdb.go:129 +0x187
github.com/pingcap/tidb/store/localstore.(*dbTxn).each(0xc208096900, 0xc20a7aedb8, 0x0, 0x0)
    github.com/pingcap/tidb/store/localstore/_test/_obj_test/txn.go:201 +0x158
github.com/pingcap/tidb/store/localstore.(*dbTxn).doCommit(0xc208096900, 0x0, 0x0)
    github.com/pingcap/tidb/store/localstore/_test/_obj_test/txn.go:248 +0x405
github.com/pingcap/tidb/store/localstore.(*dbTxn).Commit(0xc208096900, 0x0, 0x0)
    github.com/pingcap/tidb/store/localstore/_test/_obj_test/txn.go:273 +0x1ba
github.com/pingcap/tidb/store/localstore.func·005()
    /home/travis/gopath/src/github.com/pingcap/tidb/store/localstore/kv_test.go:471 +0x234
created by github.com/pingcap/tidb/store/localstore.(*testKVSuite).TestConditionIfEqual
    /home/travis/gopath/src/github.com/pingcap/tidb/store/localstore/kv_test.go:475 +0x512

index name is not saved correctly.

create table t (c1 int, c2 int, index(c1), index(c2);
insert into values (1, 2), (3,4);
select * from t where c1 > 0;

it will output:

+----+----+
| c1 | c2 |
+----+----+
| 1  | 2  |
| 1  | 2  |
| 3  | 4  |
| 3  | 4  |
+----+----+

This is not correct. And we find that both c1 and c2 index use the same empty index name.

parser.y: Ambiguous grammar

It seems that parser.y has several shift/reduce and reduce/reduce conflicts.

S/R conflicts are sometimes expected and/or acceptable, but I don't think this applies in this case. R/R conflicts, on the other hand, are almost never okay.

The current state of the grammar with all of the conflicts means that there are valid sentences, part of the intended-to-parse language, which will parse incorrectly or not at all because the grammar is ambiguous and does not reflect the proper language.

I suggest to get rid of all conflicts in parser.y and, above that, perhaps use the -cr goyacc flag to verify reducibility of all grammar productions.

prepare parse panic

CREATE TABLE `t1` ( `a` char(3) NOT NULL default '', `b` char(3) NOT NULL default '', `c` char(3) NOT NULL default '', PRIMARY KEY  (`a`,`b`,`c`)) ENGINE=InnoDB;
CREATE TABLE `t2` ( `a` char(3) NOT NULL default '', `b` char(3) NOT NULL default '', `c` char(3) NOT NULL default '', PRIMARY KEY  (`a`,`b`,`c`)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,1,1);
INSERT INTO t2 VALUES (1,1,1);
PREPARE my_stmt FROM "SELECT t1.b, count(*) FROM t1 group by t1.b having
count(*) > ALL (SELECT COUNT(*) FROM t2 WHERE t2.a=1 GROUP By t2.b)";
EXECUTE my_stmt;
EXECUTE my_stmt;
deallocate prepare my_stmt;
drop table t1,t2;

It will raise panic when we run EXECUTE this prepare statement.

Replace `plan.Do` with `plan.Next`

plan.Do method make it difficult to incrementally process table rows.

When Do method is executing, the only way to pause it is to use another goroutine with a channel, as currently the driver does.

And with Do method the only way to process data is to use an closure, but with next, we can process data without closure.

The proposed next method looks like:

`Next(ctx context.Context) (data []interface{}, rowkeys []*RowKeyEntry, err error)`

MPP (Massively Parallel Processing) support?

Would really love to see this. As with mysql and postges, when dealing with very large queries. It eventually goes down to using 1 core.

Would be awesome to see MPP. An example of it being used, is CitusDB.

Having MPP makes it very powerful indeed! I believe, Aerospike uses it as well. Although I could be wrong and Postgres 9.5 with Parallel Sequential Scan was going to be available. But may have slipped.

NullData test failed.

https://github.com/ngaut/beego/tree/tidb-support

https://github.com/astaxie/beego/blob/master/orm/orm_test.go#L268

orm_test.go:136:    
    Error: cannot use 2015-09-10 16:26:58.291379202 +0800 CST (type time.Time) in assignment to, or comparison with, column datetime (type DATETIME)
    orm_test.go:362: 
          353:           Uint16Ptr:   &uint16Ptr,
          354:           Uint32Ptr:   &uint32Ptr,
          355:           Uint64Ptr:   &uint64Ptr,
          356:           Float32Ptr:  &float32Ptr,
          357:           Float64Ptr:  &float64Ptr,
          358:           DecimalPtr:  &decimalPtr,
          359:       }
          360:   
          361:       id, err = dORM.Insert(&d)
     >>   362:       throwFail(t, err)

parser/parser.y: TableIdentList grammar clarification needed

Attempting to resolve the last few S/R conflicts:

TableIdentList:
    {
        $$ = []table.Ident{}
    }
|   TableIdent
    {
        tbl := []table.Ident{$1.(table.Ident)}
        $$ = tbl
    }
|   TableIdentList ',' TableIdent
    {
        $$ = append($1.([]table.Ident), $3.(table.Ident))
    }

source

The TableIdentList production accepts

  • ɛ
  • foo
  • foo, bar
  • foo, bar, baz
  • , foo
  • , foo, bar

(Where foo, bar is possibly a.foo and b.bar.)

Is that intended? I guess not, because then, for example, this would be valid statements

  • DROP TABLE
  • DROP TABLE , foo

etc.

My guess is that TableIdentList should read like

TableIdentList:
    TableIdent
    {
        tbl := []table.Ident{$1.(table.Ident)}
        $$ = tbl
    }
|   TableIdentList ',' TableIdent
    {
        $$ = append($1.([]table.Ident), $3.(table.Ident))
    }

But I have little knowledge of MySQL grammar. Please clarify.

Blocks #73 .

Test fail on ARM(raspberry pi)

All tests passes except the following two:

# github.com/pingcap/tidb/util/codec
util/codec/codec_test.go:133: constant 1152921504606846975 overflows int
util/codec/codec_test.go:153: constant -9223372036854775808 overflows int
util/codec/codec_test.go:158: constant -9223372036854775808 overflows int
util/codec/codec_test.go:582: constant 9223372036854775807 overflows int
util/codec/codec_test.go:582: constant -9223372036854775808 overflows int
util/codec/codec_test.go:582: too many errors

I know it's kind of non-critical, but just in case you know how to fix it.

And another one:

FAIL    github.com/pingcap/tidb/util/types [build failed]
godep: go exit status 2
Makefile:76: recipe for target 'gotest' failed
make: *** [gotest] Error 1

subquery supports union

case

create table t1 (a int);
create table t2 (a int);
create table t3 (a int);
insert into t1 values (1),(2),(3),(4);
insert into t2 values (10),(20),(30),(40);
insert into t3 values (1),(2),(10),(50);
select a from t3 where t3.a in (select a from t1 where a <= 3 union select * from t2 where a <= 30);
a
1
2
10

Interpreter takes over terminal input

After I leave interpreter with Ctrl+D key combination, keyboard keys are no longer recognized in that terminal (I suppose they are taken over by other application). Is there any way to fix that?

Additional information:

andrey@andrey-ThinkCentre-M82:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.3 LTS
Release:    14.04
Codename:   trusty
andrey@andrey-ThinkCentre-M82:~$ go version
go version go1.5 linux/amd64

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.