GithubHelp home page GithubHelp logo

actiontech / dble Goto Github PK

View Code? Open in Web Editor NEW
1.1K 1.1K 318.0 25.75 MB

A High Scalability Middle-ware for MySQL Sharding

Home Page: https://opensource.actionsky.com

License: GNU General Public License v2.0

Shell 2.17% Java 97.67% Batchfile 0.01% Makefile 0.01% Dockerfile 0.01% Python 0.15%
dble distributed-database mysql mysql-sharding sharding

dble's Issues

cannot insert data without column definitions, to dble-created table

Raised by: @sevenFH
Log:

2016-12-16 14:50:14.061  WARN [$_NIOREACTOR-1-RW] (io.mycat.server.ServerConnection.routeEndExecuteSQL(ServerConnection.java:299)) - ServerConnection [id=1, schema=TESTDB, host=10.186.23.12, user=test,txIsolation=3, autocommit=true, schema=TESTDB]insert into enum_patch_integer values (1,1,'computer') err:java.sql.SQLNonTransientException: bad insert sql (sharding column:ID not provided,INSERT INTO enum_patch_integer
VALUES (1, 1, 'computer')
java.sql.SQLNonTransientException: bad insert sql (sharding column:ID not provided,INSERT INTO enum_patch_integer
VALUES (1, 1, 'computer')
        at io.mycat.route.parser.druid.impl.DruidInsertParser.parserSingleInsert(DruidInsertParser.java:162) ~[Action_Mycat-0.2.1-DEV.jar:?]
        at io.mycat.route.parser.druid.impl.DruidInsertParser.statementParse(DruidInsertParser.java:70) ~[Action_Mycat-0.2.1-DEV.jar:?]
        at io.mycat.route.parser.druid.impl.DefaultDruidParser.parser(DefaultDruidParser.java:64) ~[Action_Mycat-0.2.1-DEV.jar:?]
        at io.mycat.route.impl.DruidMycatRouteStrategy.routeNormalSqlWithAST(DruidMycatRouteStrategy.java:79) ~[Action_Mycat-0.2.1-DEV.jar:?]
        at io.mycat.route.impl.AbstractRouteStrategy.route(AbstractRouteStrategy.java:81) ~[Action_Mycat-0.2.1-DEV.jar:?]
        at io.mycat.route.RouteService.route(RouteService.java:133) ~[Action_Mycat-0.2.1-DEV.jar:?]
        at io.mycat.server.ServerConnection.routeEndExecuteSQL(ServerConnection.java:291) ~[Action_Mycat-0.2.1-DEV.jar:?]
        at io.mycat.server.ServerConnection.execute(ServerConnection.java:240) ~[Action_Mycat-0.2.1-DEV.jar:?]
        at io.mycat.server.ServerQueryHandler.query(ServerQueryHandler.java:144) ~[Action_Mycat-0.2.1-DEV.jar:?]
        at io.mycat.net.FrontendConnection.query(FrontendConnection.java:324) ~[Action_Mycat-0.2.1-DEV.jar:?]
        at io.mycat.net.FrontendConnection.query(FrontendConnection.java:344) ~[Action_Mycat-0.2.1-DEV.jar:?]
        at io.mycat.net.handler.FrontendCommandHandler.handle(FrontendCommandHandler.java:71) ~[Action_Mycat-0.2.1-DEV.jar:?]
        at io.mycat.net.FrontendConnection.rawHandle(FrontendConnection.java:500) ~[Action_Mycat-0.2.1-DEV.jar:?]
        at io.mycat.net.FrontendConnection.handle(FrontendConnection.java:482) ~[Action_Mycat-0.2.1-DEV.jar:?]
        at io.mycat.net.AbstractConnection.onReadData(AbstractConnection.java:322) ~[Action_Mycat-0.2.1-DEV.jar:?]
        at io.mycat.net.NIOSocketWR.asynRead(NIOSocketWR.java:190) ~[Action_Mycat-0.2.1-DEV.jar:?]
        at io.mycat.net.AbstractConnection.asynRead(AbstractConnection.java:274) ~[Action_Mycat-0.2.1-DEV.jar:?]
        at io.mycat.net.NIOReactor$RW.run(NIOReactor.java:102) ~[Action_Mycat-0.2.1-DEV.jar:?]
        at java.lang.Thread.run(Thread.java:745) [?:1.7.0_79]

insert failed, when dble is case-nonsensitive and MySQL is case-sensitive

Raised by: @FlyingMao
Steps:

  1. MySQL set lower_case_table_names=0
  2. Dble use default configuration
  3. Create table:
CREATE TABLE sbtest1 (
id int(10) unsigned NOT NULL,
k int(10) unsigned NOT NULL DEFAULT '0',
c char(120) NOT NULL DEFAULT '',
pad int(11) NOT NULL,
PRIMARY KEY (id),
KEY k_1 (k)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  1. Query: insert into sbtest1 values (1,1,1,1),(2,2,2,2);
    Returns: Error 1064(HY000):can't find table [SBTEST1] define in schema:sbtest

make stress when dble is starting, server resource is exhaust, and client hangs

Raised by: @FlyingMao
Steps:

  1. Prepare a vm with 4-core
  2. Start dble
  3. Sysbench 100-threads test with following lua:
function event(thread_id)
local table_name
local a=sb_rand(1, oltp_table_size-1)
local b=a+1
table_name = "sbtest".. sb_rand_uniform(1, oltp_tables_count)
rs = db_query("SELECT max(pad) from " .. table_name .. " where id between " .. a .. " and " ..b)
end
  1. Found:
    1. dble use up to 400% cpu
    2. sysbench hang

query select with large result set in stress test, dble restart or abort client connection

Raised by: helingyun
Steps:

  1. Sysbench makes stress test
    • SQL:
case1 : select a.k from test1 a inner join test2 b where a.k = b.k limit 4000000
case2 : select a.k from test1 a inner join test2 b where a.k = b.k limit 100  
* Command:
./sysbench --test=../db/select.lua --mysql-table-engine=innodb --mysql-user=action --mysql-password=action --mysql-port=8066 --mysql-host=10.186.17.107 --mysql-db=hly_test  --max-requests=0  --max-time=120 --oltp-tables-count=2 --report-interval=1 --oltp-nontrx-mode=select --oltp-table-size=50000000 --num-threads=512  run   
  1. Case1 found:

    1. Make stress for a while, stop sysbench, dble cpu usage lasts high, and then it's restarted for unknown reason.
    2. Make stress for a while, client connections will be abort.
  2. Case2 works find

unfinished transaction doesn't auto-rollback after client exit

Raised by: @sevenFH
Steps:

  1. Execute sql on client:
mysql> begin;

Query OK, 0 rows affected (0.00 sec)

mysql> update parent_table set name = 'hhh' where f_id='001';

Query OK, 1 row affected (0.00 sec)

Rows matched: 0  Changed: 0  Warnings: 0

mysql> exit
  1. Transaction is running on data-node
mysql> select trx_id,trx_mysql_thread_id,trx_state from information_schema.INNODB_TRX;

+---------+---------------------+-----------+

| trx_id  | trx_mysql_thread_id | trx_state |

+---------+---------------------+-----------+

| 1324669 |                 314 | RUNNING   |

| 1324668 |                 316 | RUNNING   |

+---------+---------------------+-----------+

2 rows in set (0.00 sec)
  1. Reconnect to dble, query:
mysql> update parent_table set name = 'hhh' where f_id='002';

ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction

Load data with empty value '' makes wrong data

Raised by: @zhunina
Steps:

  1. Execute
create table binary_columns(
   id int  primary key,
   c_binary binary(255) 
);
  1. Load Data: load data local infile '/opt/loaddata/binary_columns' into table binary_columns fields terminated by ',' lines terminated by '\r\n' (id,c_binary);
    (data is attached: binary_columns.zip )
  2. Result:
    1. 16 rows inserted, while 40 rows are expected
    2. the data of id=19: c_binary is '000000000...000', while '' was expected

cannot create view

Raised by: @sevenFH
Steps:

  1. SQL: create view view1 as select * from fixed_patch_uniform;
  2. got error: ERROR 1064 (HY000): op table not in schema----VIEW

[internal]

This issue is internal, and will not be migrated.

[internal]

This issue is internal, and will not be migrated.

Data type set is not supported

Raised by: @zhunina
Steps:

  1. Execute
create table set_columns(
   id int  primary key,
   c_set set('s','m','x') 
);

return error: ERROR 1064 (HY000): error SET

Log:

2016-12-09 11:26:40,556 [WARN ][$_NIOREACTOR-3-RW] ServerConnection [id=1, schema=TESTDB, host=10.186.21.74, user=test,txIsolation=3, autocommit=true, schema=TESTDB]create table set_columns(
INFO   | jvm 1    | 2016/12/09 11:26:40 |    id int  primary key,
INFO   | jvm 1    | 2016/12/09 11:26:40 |    c_set set('s','m','x') 
INFO   | jvm 1    | 2016/12/09 11:26:40 | ) err:com.alibaba.druid.sql.parser.ParserException: error SET com.alibaba.druid.sql.parser.ParserException: error SET
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at com.alibaba.druid.sql.parser.SQLExprParser.name(SQLExprParser.java:974)
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at com.alibaba.druid.sql.parser.SQLExprParser.parseDataType(SQLExprParser.java:1624)
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at com.alibaba.druid.sql.dialect.mysql.parser.MySqlExprParser.parseColumn(MySqlExprParser.java:537)
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at com.alibaba.druid.sql.dialect.mysql.parser.MySqlCreateTableParser.parseCrateTable(MySqlCreateTableParser.java:114)
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser.parseCreate(MySqlStatementParser.java:342)
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:194)
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatement(SQLStatementParser.java:2065)
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at io.mycat.server.interceptor.impl.GlobalTableUtil.handleDDLSQL(GlobalTableUtil.java:127)
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at io.mycat.server.interceptor.impl.GlobalTableUtil.consistencyInterceptor(GlobalTableUtil.java:100)
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at io.mycat.server.interceptor.impl.GlobalTableUtil.interceptSQL(GlobalTableUtil.java:83)
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at io.mycat.server.interceptor.impl.DefaultSqlInterceptor.interceptSQL(DefaultSqlInterceptor.java:56)
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at io.mycat.route.impl.AbstractRouteStrategy.route(AbstractRouteStrategy.java:43)
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at io.mycat.route.RouteService.route(RouteService.java:133)
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at io.mycat.server.ServerConnection.routeEndExecuteSQL(ServerConnection.java:273)
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at io.mycat.server.ServerConnection.execute(ServerConnection.java:222)
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at io.mycat.server.ServerQueryHandler.query(ServerQueryHandler.java:136)
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at io.mycat.net.FrontendConnection.query(FrontendConnection.java:317)
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at io.mycat.net.FrontendConnection.query(FrontendConnection.java:337)
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at io.mycat.net.handler.FrontendCommandHandler.handle(FrontendCommandHandler.java:71)
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at io.mycat.net.FrontendConnection.rawHandle(FrontendConnection.java:478)
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at io.mycat.net.FrontendConnection.handle(FrontendConnection.java:460)
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at io.mycat.net.AbstractConnection.onReadData(AbstractConnection.java:321)
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at io.mycat.net.NIOSocketWR.asynRead(NIOSocketWR.java:190)
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at io.mycat.net.AbstractConnection.asynRead(AbstractConnection.java:273)
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at io.mycat.net.NIOReactor$RW.run(NIOReactor.java:102)
INFO   | jvm 1    | 2016/12/09 11:26:40 |       at java.lang.Thread.run(Thread.java:722)
INFO   | jvm 1    | 2016/12/09 11:26:40 |  (io.mycat.server.ServerConnection:ServerConnection.java:281)

Null is retreated as 0, when aggregating, which is not correct.

Raised by: @yanhuqing666
Steps:

  1. 2 data-nodes, a is empty while b is not:
mysql> select * from char_columns;
+----+--------+
| id | c_char |
+----+--------+
|  1 | 512    |
+----+--------+
1 row in set (0.01 sec)
  1. Aggregation is not correct if a returns NULL
mysql> select min(id) from char_columns;
+------+
| MIN0 |
+------+
|    0 |
+------+
1 row in set (0.01 sec)

crash when query aggregation with where

Raised by: @FlyingMao
Steps:

  1. sysbench query: select sum(id) from sbtest1 where id between a and a+3; (a is random number between 1-50000000)
  2. run sysbench:
./sysbench --test=/usr/local/sysbench-1.0/db/select32.lua --mysql-user=test --mysql-password=test --mysql-port=8066 --mysql-host=10.186.23.70 --oltp_auto_inc=off --max-time=300 --max-requests=0 --report-interval=10 --num-threads=1 run
  1. after a while, dble crashed: Error in Java :double free or cprruption(out):0x00007fcc9c121360

transaction (update+select) failed, it relates to autocommit

Raised by: @FlyingMao
Steps:

  1. Prepare
create table aly_test (orderID int(11),R_REGIONKEY int(11) primary key,R_NAME varchar(50),R_COMMENT varchar(50));

insert into aly_test (orderID,R_REGIONKEY,R_NAME,R_COMMENT) values (1,1, 'Eastern','test001'),(3,3, 'Northern','test003'),(2,2, 'Western','test002'),(4,4, 'Southern','test004');

alter table aly_test engine=INNODB;
  1. Execute transaction
begin;
update aly_test set R_COMMENT='25-989-741-4444' where orderID=1;
select * from aly_test;
commit;
  1. Transaction was commited, but the data wasn't updated.

Log:

From general log:

  1. there is no set autocommit=0 before update
  2. there is set autocommit=0 before select
  3. Subsequence queries on the same connection will be under autocommit=0

[internal]

This issue is internal, and will not be migrated.

Set isolation level in configuration will fail

Raised by: @FlyingMao
Steps:

  1. Change isolation level to 4(serializable) in configuration
  2. Restart dble
  3. Query select
  4. Found:
    1. no set isolation in data-node's general log
    2. two transaction read/write same table will not be blocked, which is under lower isolation level.

`select @@session.tx_isolation; ` gives wrong answer

Steps:

  1. Query: set session transaction isolation level READ UNCOMMITTED;
  2. Query: select * from sbtest1;
  3. According to general log of data-node, tx_isolation is set successfully
  4. Query: select @@session.tx_isolation;
    Returns: REPEATABLE-READ
    Expects: READ UNCOMMITTED

Auto-increment column generates same values with global sequence

Raised by: @zhunina
Steps:

  1. Create a table:
    create table sbtest1(id int,name varchar(8),p_id int primary key auto_increment);
  2. Make 4 shardings, whose sharding column is id
  3. Make a global sequence
GLOBAL.HISIDS=
GLOBAL.MINID=10001
GLOBAL.MAXID=20000
GLOBAL.CURID=10000
  1. Query insert into sbtest1(id,name,p_id) values(1,'a',next value for MYCATSEQ_GLOBAL);
    returns (1,‘a’,10001)
  2. Query insert into sbtest1(id,name,p_id) values(2,'a',next value for MYCATSEQ_GLOBAL),(3,'a',next value for MYCATSEQ_GLOBAL),(4,'a',next value for MYCATSEQ_GLOBAL);
    returns (2,'a',10002),(3,'a',10002),(4,'a',10002), which is not correct

Expectation:

Step 5 should give increment values of global sequence.

alter table failed for global table

Raised by: @sevenFH

Steps:

  1. Make a global table called global_table
  2. Following queries will fail with error: ERROR 1064 (HY000): op table not in schema----GLOBAL_TABLE DROP|ADD|CHANGE
    1. alter table global_table drop name; //drop column
    2. alter table global_table add name1 char(10); //add column
    3. alter table global_table change name name char(15); //alter column type
    4. alter table global_table change name name1 varchar(10); //update column name
    5. alter table global_table drop index global_table_inx; //drop index
  3. Above queries succeed on sharding table

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.