forked from MyCATApache/Mycat-doc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e4de20f
commit 0e234dc
Showing
112 changed files
with
87 additions
and
180 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
DROP TABLE IF EXISTS MYCAT_SEQUENCE; | ||
CREATE TABLE MYCAT_SEQUENCE ( name VARCHAR(50) NOT NULL, current_value INT NOT NULL, increment INT NOT NULL DEFAULT 100, PRIMARY KEY (name) ) ENGINE=InnoDB; | ||
|
||
-- ---------------------------- | ||
-- Function structure for `mycat_seq_currval` | ||
-- ---------------------------- | ||
DROP FUNCTION IF EXISTS `mycat_seq_currval`; | ||
DELIMITER ;; | ||
CREATE DEFINER=`root`@`%` FUNCTION `mycat_seq_currval`(seq_name VARCHAR(50)) RETURNS varchar(64) CHARSET latin1 | ||
DETERMINISTIC | ||
BEGIN | ||
DECLARE retval VARCHAR(64); | ||
SET retval="-999999999,null"; | ||
SELECT concat(CAST(current_value AS CHAR),",",CAST(increment AS CHAR) ) INTO retval FROM MYCAT_SEQUENCE WHERE name = seq_name; | ||
RETURN retval ; | ||
END | ||
;; | ||
DELIMITER ; | ||
|
||
-- ---------------------------- | ||
-- Function structure for `mycat_seq_nextval` | ||
-- ---------------------------- | ||
DROP FUNCTION IF EXISTS `mycat_seq_nextval`; | ||
DELIMITER ;; | ||
CREATE DEFINER=`root`@`%` FUNCTION `mycat_seq_nextval`(seq_name VARCHAR(50)) RETURNS varchar(64) CHARSET latin1 | ||
DETERMINISTIC | ||
BEGIN | ||
UPDATE MYCAT_SEQUENCE | ||
SET current_value = current_value + increment WHERE name = seq_name; | ||
RETURN mycat_seq_currval(seq_name); | ||
END | ||
;; | ||
DELIMITER ; | ||
|
||
-- ---------------------------- | ||
-- Function structure for `mycat_seq_setval` | ||
-- ---------------------------- | ||
DROP FUNCTION IF EXISTS `mycat_seq_setval`; | ||
DELIMITER ;; | ||
CREATE DEFINER=`root`@`%` FUNCTION `mycat_seq_setval`(seq_name VARCHAR(50), value INTEGER) RETURNS varchar(64) CHARSET latin1 | ||
DETERMINISTIC | ||
BEGIN | ||
UPDATE MYCAT_SEQUENCE | ||
SET current_value = value | ||
WHERE name = seq_name; | ||
RETURN mycat_seq_currval(seq_name); | ||
END | ||
;; | ||
DELIMITER ; | ||
|
||
INSERT INTO MYCAT_SEQUENCE VALUES ('GLOBAL', 0, 100); | ||
SELECT MYCAT_SEQ_SETVAL('GLOBAL', 1); | ||
SELECT MYCAT_SEQ_CURRVAL('GLOBAL'); | ||
SELECT MYCAT_SEQ_NEXTVAL('GLOBAL'); | ||
|
||
|
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
1.在包含employee的分片上创建存储过程: | ||
/*!mycat: sql=select sharding_id from employee */ create procedure proc_rtn_list(in v_in int) begin select * from employee where sharding_id=v_in;end; | ||
|
||
2.调用存储过程, 通过注解指定在哪个分片上执行: | ||
/*!mycat: sql=select sharding_id from employee where sharding_id=10000*/ call proc_rtn_list(10000); | ||
|
||
3.出现问题: | ||
"[Err] 1312 - PROCEDURE db1.proc_rtn_list can't return a result set in the given context" | ||
|
||
4.解决方案:修改代码 org.opencloudb.mysql.nio包内的MySQLConnection类, 取消第85行的注释. | ||
|
||
5.遗留问题: | ||
调用存储过程后, 客户端没有收到相应的报文, 导致一直处于等待状态, 而不是正常的显示"mysql> ", 求大侠抓包解决, 看下mysql直连情况下,返回的这个报文跟Mycat的有哪些不同, 解决这个问题 | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
����A��ͬ����SQL������˳��д��B��C | ||
|
||
���� 1 ����2 | ||
update xx from table1 where id =1 update yy from table where id=1 | ||
������1 �ȷ��أ�����Ҫ��֤A�Ĵ���ͬ��SQL�������2��B��C����ִ�� | ||
������Ҫ�첽��������1 commit���Զ�commit)����ԺŽ�SQLͬʱ����BCִ�У� | ||
BCִ����ɺ�ִ����һ������2 | ||
|
||
|
||
|
||
���˼·��ÿ��DataNode��Ƭ��ά��һ������ͬ����SQL˳����У��첽ִ�У�����Ҫͬ����SQL������A��ִ����ɺ���˶��У��첽�����ڵ�ִ�У�ִ��ʧ�ܵĽڵ㣬�����Ӷ������Ƴ������ٿ��ã� | ||
|
||
|
||
��SQL������ʱ����Sessino��û��ִ�й������ݵ�SQL����������Է����������ͬ��SQL����Ϊ�յķ�Ƭִ�У�������ֻ����д�ڵ� |
File renamed without changes.
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.