################################################################################
# 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. 终于明白为什么要赋值给ret ,

    def my_max(a,b): if a > b: return a else: return b my_max(10,45)# 如果只是这样,那么只是运行了并产生返回值,但没有打印返回值t ...

  2. CSS盒子模型之CSS3可伸缩框属性(Flexible Box)

    CSS盒子模型(下) 一.CSS3可伸缩框(Flexible Box) 可伸缩框属性(Flexible Box)是css3新添加的盒子模型属性,有人称之为弹性盒模型,它的出现打破了我们经常使用的浮动布 ...

  3. python第十四课--排序及自定义函数之自定义函数(案例一)

    案例一: 演示自定义函数的使用:包含:1).定义格式的掌握2).函数的好处 自定义函数:实现打印矩形的操作两个原则需要考虑:1).有没有形参?有,2个 2).有没有返回值?没有. def printR ...

  4. 鲜为人知的 Python 语法

    所有人(好吧,不是所有人)都知道 python 是一门用途广泛.易读.而且容易入门的编程语言.   但同时 python 语法也允许我们做一些很奇怪的事情.   使用 lambda 表达式重写多行函数 ...

  5. 1051. [HAOI2006]受欢迎的牛【强连通分量】

    Description 每一头牛的愿望就是变成一头最受欢迎的牛.现在有N头牛,给你M对整数(A,B),表示牛A认为牛B受欢迎. 这 种关系是具有传递性的,如果A认为B受欢迎,B认为C受欢迎,那么牛A也 ...

  6. php表单笔记

    PHP获取表单值: $_POST    //获取POST提交 $_GET      //  获取GET提交 <!DOCTYPE html> <html> <head> ...

  7. python 模拟126邮箱登陆

    #coding=utf-8from selenium import webdriverimport time mydriver=webdriver.Firefox()mydriver.get(&quo ...

  8. 20165302 2017-2018-2《Java程序设计》课程总结

    20165302 2017-2018-2<Java程序设计>课程总结 每周作业汇总 预备作业1 对师生关系的看法 预备作业2 C语言基础调查 预备作业3 安装虚拟机,初步学习虚拟机及常用命 ...

  9. Data Binding Android - Type parameter T has incompatible upper bounds : ViewDataBinding and MainAct

    Go to your "some_layout.xml" Click right -> Refactor -> Rename (or SHIFT + F6) Renam ...

  10. 数字电路中应避免产生不必要的锁存器 Latch

    锁存器(Latch)是数字逻辑电路中很重要的一种基本电路,常见的锁存器包括三个端口:数据输入口.数据输出口.使能端.当使能端为高电平时,输入口的数据直接送到输出口,此时输入输出口可以看成是直接连通的: ...