config root man

Current Path : /home/usr.opt/mysql57/mysql-test/suite/rpl/t/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //home/usr.opt/mysql57/mysql-test/suite/rpl/t/rpl_row_hash_scan_sanity.test

-- source include/not_group_replication_plugin.inc
-- source include/have_binlog_format_row.inc
-- source include/have_debug.inc
-- source include/master-slave.inc

#
# WL#5597 tests
#
# These tests check whether the correct algorithm for searching the
# rows was chosen, depending on the setting of
# @@global.slave_rows_search_algorithms and the table definition.
#
# We test all combinations, but leave out the offending ones:
# - @@global.slave_rows_search_algorithms= ''
# - @@global.slave_rows_search_algorithms= 'INDEX_SCAN'
#
# We do not allow setting only INDEX_SCAN or the empty value.
#

-- connection master

CREATE TABLE t1 (c1 INT);
CREATE TABLE t2 (c1 INT PRIMARY KEY);
CREATE TABLE t3 (c1 INT UNIQUE KEY NOT NULL);
CREATE TABLE t4 (c1 INT KEY);

INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
INSERT INTO t3 VALUES (1);
INSERT INTO t4 VALUES (1);

--source include/sync_slave_sql_with_master.inc
SET @saved_slave_rows_search_algorithms= @@global.slave_rows_search_algorithms;

###################### TABLE_SCAN assertions

-- connection slave
SET @@global.slave_rows_search_algorithms= 'TABLE_SCAN';
-- connection master

UPDATE t1 SET c1= 2;
-- let $expected_alg= 'TABLE_SCAN'
-- source include/rpl_hash_scan_assertion.inc

UPDATE t2 SET c1= 2;
-- let $expected_alg= 'TABLE_SCAN'
-- source include/rpl_hash_scan_assertion.inc

UPDATE t3 SET c1= 2;
-- let $expected_alg= 'TABLE_SCAN'
-- source include/rpl_hash_scan_assertion.inc

UPDATE t4 SET c1= 2;
-- let $expected_alg= 'TABLE_SCAN'
-- source include/rpl_hash_scan_assertion.inc

###################### TABLE_SCAN,INDEX_SCAN

-- connection slave
SET @@global.slave_rows_search_algorithms= 'TABLE_SCAN,INDEX_SCAN';
-- connection master

UPDATE t1 SET c1= 3;
-- let $expected_alg= 'TABLE_SCAN'
-- source include/rpl_hash_scan_assertion.inc

UPDATE t2 SET c1= 3;
-- let $expected_alg= 'INDEX_SCAN'
-- source include/rpl_hash_scan_assertion.inc

UPDATE t3 SET c1= 3;
-- let $expected_alg= 'INDEX_SCAN'
-- source include/rpl_hash_scan_assertion.inc

UPDATE t4 SET c1= 3;
-- let $expected_alg= 'INDEX_SCAN'
-- source include/rpl_hash_scan_assertion.inc

###################### TABLE_SCAN,HASH_SCAN

-- connection slave
SET @@global.slave_rows_search_algorithms= 'TABLE_SCAN,HASH_SCAN';
-- connection master

UPDATE t1 SET c1= 4;
-- let $expected_alg= 'HASH_SCAN'
-- source include/rpl_hash_scan_assertion.inc

UPDATE t2 SET c1= 4;
-- let $expected_alg= 'HASH_SCAN'
-- source include/rpl_hash_scan_assertion.inc

UPDATE t3 SET c1= 4;
-- let $expected_alg= 'HASH_SCAN'
-- source include/rpl_hash_scan_assertion.inc

UPDATE t4 SET c1= 4;
-- let $expected_alg= 'HASH_SCAN'
-- source include/rpl_hash_scan_assertion.inc

###################### HASH_SCAN

-- connection slave
SET @@global.slave_rows_search_algorithms= 'HASH_SCAN';
-- connection master

UPDATE t1 SET c1= 5;
-- let $expected_alg= 'HASH_SCAN'
-- source include/rpl_hash_scan_assertion.inc

UPDATE t2 SET c1= 5;
-- let $expected_alg= 'HASH_SCAN'
-- source include/rpl_hash_scan_assertion.inc

UPDATE t3 SET c1= 5;
-- let $expected_alg= 'HASH_SCAN'
-- source include/rpl_hash_scan_assertion.inc

UPDATE t4 SET c1= 5;
-- let $expected_alg= 'HASH_SCAN'
-- source include/rpl_hash_scan_assertion.inc

###################### HASH_SCAN,INDEX_SCAN

-- connection slave
SET @@global.slave_rows_search_algorithms= 'HASH_SCAN,INDEX_SCAN';
-- connection master

UPDATE t1 SET c1= 6;
-- let $expected_alg= 'HASH_SCAN'
-- source include/rpl_hash_scan_assertion.inc

UPDATE t2 SET c1= 6;
-- let $expected_alg= 'INDEX_SCAN'
-- source include/rpl_hash_scan_assertion.inc

UPDATE t3 SET c1= 6;
-- let $expected_alg= 'INDEX_SCAN'
-- source include/rpl_hash_scan_assertion.inc

UPDATE t4 SET c1= 6;
-- let $expected_alg= 'INDEX_SCAN'
-- source include/rpl_hash_scan_assertion.inc

###################### HASH_SCAN,INDEX_SCAN,TABLE_SCAN

-- connection slave
SET @@global.slave_rows_search_algorithms= 'HASH_SCAN,INDEX_SCAN,TABLE_SCAN';
-- connection master

UPDATE t1 SET c1= 7;
-- let $expected_alg= 'HASH_SCAN'
-- source include/rpl_hash_scan_assertion.inc

UPDATE t2 SET c1= 7;
-- let $expected_alg= 'INDEX_SCAN'
-- source include/rpl_hash_scan_assertion.inc

UPDATE t3 SET c1= 7;
-- let $expected_alg= 'INDEX_SCAN'
-- source include/rpl_hash_scan_assertion.inc

UPDATE t4 SET c1= 7;
-- let $expected_alg= 'INDEX_SCAN'
-- source include/rpl_hash_scan_assertion.inc

# Begin of Test cases for Bug#18860225
# HASH_SCAN SEEMS BROKEN: CAN'T FIND RECORD IN 'T1' ERROR_CODE: 1032
# Test Case 1: Key type is <Int>
--connection slave
SET @@global.slave_rows_search_algorithms= 'HASH_SCAN';
--connection master
CREATE TABLE t5(c1 INT, c2 INT, KEY(c2));
INSERT INTO t5 VALUES (1,1),(2,2),(3,1),(4,NULL),(5,2),(6,3);
DELETE FROM t5 ORDER BY c1;
DROP TABLE t5;
--source include/sync_slave_sql_with_master.inc

# Test Case 2: Key type is <BigInt>
--connection master
CREATE TABLE t5(c1 BIGINT, c2 BIGINT, KEY(c2));
INSERT INTO t5 VALUES (1,1),(2,2),(3,1),(4,NULL),(5,2),(6,3);
DELETE FROM t5 ORDER BY c1;
DROP TABLE t5;
--source include/sync_slave_sql_with_master.inc

# Test Case 3: Key type is <Varchar>
--connection master
CREATE TABLE t5(c1 INT, c2 VARCHAR(20), KEY(c2));
INSERT INTO t5 VALUES (1,"value1"),(2,"value2"),(3,"value1"),(4,NULL),(5,"value2"),(6,"value3");
DELETE FROM t5 ORDER BY c1;
DROP TABLE t5;
--source include/sync_slave_sql_with_master.inc

# Test Case 4: Key is composite key and type is <Int,Varchar>
#  and Varchar key having different length values
--connection master
CREATE TABLE t5(c1 INT, c2 INT, c3 VARCHAR(20), KEY(c2,c3));
INSERT INTO t5 VALUES (1,1,"ab"),(2,2,"cde"),(3,1,"12345"),(4,4,"random"),(5,NULL,NULL),(6,5,NULL),(7,NULL,"lmnopqr");
DELETE FROM t5 ORDER BY c1;
DROP TABLE t5;
--source include/sync_slave_sql_with_master.inc
# End of Test cases for Bug#18860225

# Test cases for BUG#26137159
# Verify that update and delete operations can be safely replicated when the
# partition function does not include the key used in the index

SET @@global.slave_rows_search_algorithms= 'INDEX_SCAN,HASH_SCAN';

call mtr.add_suppression("Could not execute Delete_rows event on table test.t6");
call mtr.add_suppression("Could not execute Update_rows event on table test.t6");
call mtr.add_suppression("Can't find record in 't6'");
# when mts is enabled
call mtr.add_suppression("The slave coordinator and worker threads are stopped");

--let $i= 1

while ($i<3)
{
  # Check that the slave can delete/update a value that is not the index key
  --source include/rpl_connection_master.inc
  CREATE TABLE t6(num INT, year INT, KEY year (year))
    PARTITION BY HASH(num) PARTITIONS 5;
  INSERT INTO t6 VALUES(6, 1977);
  INSERT INTO t6 VALUES(1, 1983);
  INSERT INTO t6 VALUES(9, 1977);
  if ($i==1)
  {
    DELETE FROM t6 WHERE num= 9;
  }
  if ($i==2)
  {
    UPDATE t6 SET num= 10 WHERE num= 9;
  }
  --source include/sync_slave_sql_with_master.inc
  --source include/rpl_connection_master.inc
  --let $diff_tables= master:t6, slave:t6
  --source include/diff_tables.inc
  DROP TABLE t6;
  --source include/sync_slave_sql_with_master.inc

  # Check that the slave can delete/update a repeated value that is not the
  # index key
  --source include/rpl_connection_master.inc
  CREATE TABLE t6(num INT, year INT, KEY year (year))
    PARTITION BY HASH(num) PARTITIONS 5;
  INSERT INTO t6 VALUES(6, 1977);
  INSERT INTO t6 VALUES(1, 1983);
  INSERT INTO t6 VALUES(9, 1977);
  INSERT INTO t6 VALUES(9, 1977);
  INSERT INTO t6 VALUES(9, 1987);
  INSERT INTO t6 VALUES(9, 9);
  INSERT INTO t6 VALUES(9, 1555555500);
  if ($i==1)
  {
    DELETE FROM t6 WHERE num= 9;
  }
  if ($i==2)
  {
    UPDATE t6 SET num= 10 WHERE num= 9;
  }
  --source include/sync_slave_sql_with_master.inc
  --source include/rpl_connection_master.inc
  --let $diff_tables= master:t6, slave:t6
  --source include/diff_tables.inc
  DROP TABLE t6;
  --source include/sync_slave_sql_with_master.inc

  # Check that the slave can delete/update a repeated value that is not the
  # index key when using another column for key and a more complex partition
  # function
  --source include/rpl_connection_master.inc
  CREATE TABLE t6(num INT, year INT, num_2 INT, KEY year (year))
    PARTITION BY HASH(num_2-num) PARTITIONS 5;
  INSERT INTO t6 VALUES(6, 1977, 1);
  INSERT INTO t6 VALUES(1, 1983, 2);
  INSERT INTO t6 VALUES(9, 1977, 1);
  INSERT INTO t6 VALUES(9, 1983, 1);
  INSERT INTO t6 VALUES(9, 1977, 3);
  if ($i==1)
  {
    DELETE FROM t6 WHERE num_2= 1;
  }
  if ($i==2)
  {
    UPDATE t6 SET num= 10 WHERE num_2= 1;
  }
  --source include/sync_slave_sql_with_master.inc
  --source include/rpl_connection_master.inc
  --let $diff_tables= master:t6, slave:t6
  --source include/diff_tables.inc
  DROP TABLE t6;
  --source include/sync_slave_sql_with_master.inc

  # Check that the slave will error if trying to delete a non-existing value
  --source include/stop_slave_sql.inc
  --source include/rpl_connection_master.inc
  CREATE TABLE t6(num INT, year INT, KEY year (year))
   PARTITION BY HASH(num) PARTITIONS 5;
  INSERT INTO t6 VALUES(6, 1977);
  INSERT INTO t6 VALUES(1, 1983);
  INSERT INTO t6 VALUES(9, 1977);
  SET SQL_LOG_BIN= 0;
  INSERT INTO t6 VALUES(10, 1977);
  SET SQL_LOG_BIN= 1;
  if ($i==1)
  {
    DELETE FROM t6 WHERE num= 10;
  }
  if ($i==2)
  {
    UPDATE t6 SET num= 9 WHERE num= 10;
  }

  --source include/rpl_connection_slave.inc
  START SLAVE SQL_THREAD;
  --let $slave_sql_errno= convert_error(ER_KEY_NOT_FOUND)
  --source include/wait_for_slave_sql_error.inc

  # update the slave to clear the error
  --source include/stop_slave.inc
  INSERT INTO t6 VALUES(10, 1977);
  -- source include/start_slave.inc

  --source include/rpl_connection_master.inc
  DROP TABLE t6;
  --source include/sync_slave_sql_with_master.inc

  --inc $i
}


#clean Up
SET @@global.slave_rows_search_algorithms= @saved_slave_rows_search_algorithms;
--connection master
DROP TABLE IF EXISTS t1, t2, t3, t4;
--source include/sync_slave_sql_with_master.inc
  
-- source include/rpl_reset.inc

-- source include/rpl_end.inc


Man Man