################################################################################
# This test verifies whether the group_replication works fine when the server
# in a group goes down while there are dml operations running on it.
#
# Test:
# 0. The test requires three servers: M1,M2 and M3.
# 1. Start GR on all the servers.
# 2. CREATE TABLE ON M1 and CREATE a procedure to insert data
# into the table
# 3. Call the procedure using send operation and sleep for some time.
# 4. Kill and restart the server M1.
# 5. Wait until there are two members in a group
# 6. Start GR on server M1.
# 7. Verify that table t1 has same data across all the members.
# 8. Clean up
################################################################################ # This test does crashes servers, thence we skip it on asan and valgrind.
--source include/not_asan.inc
--source include/not_valgrind.inc
--source include/big_test.inc
--source include/force_restart.inc
--source ../inc/have_group_replication_plugin.inc
--let $rpl_server_count= 3
--source ../inc/group_replication.inc --let $rpl_connection_name= server1
--source include/rpl_connection.inc set sql_log_bin=0;
call mtr.add_suppression("Error in Log_event::read_log_event()");
set sql_log_bin=1; --let $group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
--let $group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address` CREATE TABLE t1(a int auto_increment, primary key(a)); # Create the procedure to perform the dml operations.
# delimiter $$;
# CREATE PROCEDURE dml_operations()
# BEGIN
# declare x INT;
# set x=1;
# while x<300 do
# insert into t1 values (x);
# update t1 set a=x+300 where a=x;
# delete from t1 where a<310;
# set x=x+1;
# end while;
# end$$
# delimiter ;$$
# --echo
#
# --echo ----call procedure----
# --send call dml_operations()
# --echo
--disable_query_log
--let $i=30
while($i)
{
--EVAL INSERT INTO t1(a) VALUES(NULL);
--dec $i
}
--enable_query_log --let $rpl_connection_name= server1
--source include/rpl_connection.inc # Wait until some data is entered into table t1 to ensure that the server1
# will get killed while there are dml operations running on it
--let $wait_condition= SELECT COUNT(*) >20 FROM t1
--source include/wait_condition.inc # Kill server1
--echo # killing
--let $restart_parameters=restart:--group_replication_local_address=$group_replication_local_address --group_replication_group_seeds=$group_replication_group_seeds --group_replication_group_name=$group_replication_group_name
--replace_result $group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS $group_replication_group_name GROUP_REPLICATION_GROUP_NAME --source ../inc/kill_and_restart_mysqld.inc
--echo # restarting --exec date # Needed as we are not using rpl_restart_server.inc
--let $rpl_server_number= 1
--source include/rpl_reconnect.inc --let $rpl_connection_name= server2
--source include/rpl_connection.inc
# Wait until group has only 2 members, that is, server1 death is detected by
# the group.
--echo # check that there are 2 members in the group
--let $group_replication_number_of_members= 2
--source ../inc/gr_wait_for_number_of_members.inc # --let $rpl_server_number= 1
# --source include/rpl_reconnect.inc
--let $rpl_connection_name= server2
--source include/rpl_connection.inc --let $_rpl_server_number = 2
while ($_rpl_server_number <= $rpl_server_count){
--let $rpl_connection_name= server$_rpl_server_number
--source include/rpl_connection.inc
--let $saved_read_only=`SELECT @@GLOBAL.super_read_only;`
if (!$saved_read_only){
--EVAL INSERT INTO t1(a) VALUES(NULL);
--exec date;
}
--inc $_rpl_server_number
} --let $rpl_connection_name= server_1
--source include/rpl_connection.inc
# START GR on server1
--source include/start_group_replication.inc # Sync all the servers.
--source include/rpl_sync.inc # Verify that all the tables have same data.
--let $diff_tables=server_1:t1, server2:t1, server3:t1
--source include/diff_tables.inc drop table t1; --source ../inc/group_replication_end.inc

  

mysql自动化测试第一个例子的更多相关文章

  1. 04springMVC结构,mvc模式,spring-mvc流程,spring-mvc的第一个例子,三种handlerMapping,几种控制器,springmvc基于注解的开发,文件上传,拦截器,s

     1. Spring-mvc介绍 1.1市面上流行的框架 Struts2(比较多) Springmvc(比较多而且属于上升的趋势) Struts1(即将被淘汰) 其他 1.2  spring-mv ...

  2. Activity工作流(2)-入门安装运行第一个例子

    转: Activity工作流(2)-入门安装运行第一个例子 置顶 2017年05月24日 15:58:50 li_ch_ch 阅读数:24432   版权声明:本文为博主原创文章,未经博主允许不得转载 ...

  3. ElasticSearch 5学习(5)——第一个例子(很实用)

    想要知道ElasticSearch是如何使用的,最快的方式就是通过一个简单的例子,第一个例子将会包括基本概念如索引.搜索.和聚合等,需求是关于公司管理员工的一些业务. 员工文档索引 业务首先需要存储员 ...

  4. MySQL配置文件my.cnf 例子最详细翻译

    转的 MySQL配置文件my.cnf 例子最详细翻译,可以保存做笔记用. #BEGIN CONFIG INFO#DESCR: 4GB RAM, 只使用InnoDB, ACID, 少量的连接, 队列负载 ...

  5. MXNet学习~第一个例子~跑MNIST

    反正基本上是给自己看的,直接贴写过注释后的代码,可能有的地方理解不对,你多担待,看到了也提出来(基本上对未来的自己说的),三层跑到了97%,毕竟是第一个例子,主要就是用来理解MXNet怎么使用. #导 ...

  6. emberjs学习一(环境和第一个例子)

    code { margin: 0; padding: 0; white-space: pre; border: none; background: transparent; } code, pre t ...

  7. Qt之QCustomPlot绘图(一)配置和第一个例子

    最近一个用Qt开发的项目需要绘制坐标曲线,我在老师的指点下使用了QCustomPlot这个插件,使用方法简单,功能还算不错. 可是在网上找了很多资料和博文都只是将官方提供的例子演示一遍,没有系统全面的 ...

  8. 键盘过滤第一个例子ctrl2cap(4.1~4.4)汇总,测试

    键盘过滤第一个例子ctrl2cap(4.1~4.4)汇总,测试 完整源代码 /// /// @file ctrl2cap.c /// @author wowocock /// @date 2009-1 ...

  9. springmvc的介绍和第一个例子

    SpringMVC是Spring 框架自带的一部分. SpringMVC底层基于:Servlet Struts2底层基于:filter struts1底层基于:Servlet spring 各模块 我 ...

随机推荐

  1. SQL Server与CLR数据类型的对应关系

    数据库 C#程序 int int32 text string bigint int64 binary System.Byte[] bit Boolean char string date System ...

  2. SPL 笔记

    PHP  SPL是指 standard  php library,php标准库. SPL提供了一系列的类和接口,使用这些类和接口,我们可以更加高效.优雅的使用php进行程序设计.   从php5.0开 ...

  3. 【MySQL学习杂记】 2017年7月13日

    1. 关于分组 当select使用groupby语法时,select返回字段集合里面除去 <使用了聚合函数的字段>.<不包含在 group by 子句的字段> 的其他字段,这些 ...

  4. 【[TJOI2015]弦论】

    \(SA+SAM\) 第一问显然是一个\(SAM\)的经典问题,我们排完序之后直接使用一直往下找\(n+1-sa[i]-het[i]\)就好了,找到\(K\)减不动了输出就好了 第二问是\(SAM\) ...

  5. 【洛谷】【线段树】P1471 方差

    [题目背景:] 滚粗了的HansBug在收拾旧数学书,然而他发现了什么奇妙的东西. [题目描述:] 蒟蒻HansBug在一本数学书里面发现了一个神奇的数列,包含N个实数.他想算算这个数列的平均数和方差 ...

  6. HBase学习之路 (八)HBase大牛博客

    主要是记录一下链接 http://hbasefly.com

  7. 正则表达式详解<一>

    正则表达式是一种处理字符串的微型语言:有以下的基本术语: l  模式(pattern):正则表达式实际上是通过字符串表达的一个模式 l  匹配(match): 判断正则表达式和给出的序列[first ...

  8. [转]C结构体之位域(位段)

    有些信息在存储时,并不需要占用一个完整的字节, 而只需占几个或一个二进制位.例如在存放一个开关量时,只有0和1 两种状态, 用一位二进位即可.为了节省存储空间,并使处理简便,C语言又提供了一种数据结构 ...

  9. Jmeter新手频犯错误之一(登录)

    昨天被人问了一个问题:为什么我用Jmeter先创建一个登录请求,然后创建一个操作(比如计算账单)请求,运行之后结果树中却是status_code=401(即登录失败),我明明登录了啊.... emmm ...

  10. HDU 2639(01背包求第K大值)

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=2639 Bone Collector II Time Limit: 5000/2000 MS (Jav ...