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_gcol_sec_index.test

#
# === Purpose ===
#
# This test verifies DMLs are applied on a table by the slave when
# 1. Table on slave has extra generated columns and containing a secondary
#    indexes defined on the generated columns.
# 2. Table on master has generated columns and slave modified the table by
#    changing the generated expressions and adding a secondary index on the
#    generated columns.
#
# === Implementation ===
# Note:
# Aliases used:
# Virtual Generated Column -> VGC
# Stored Generated Column -> SGC
#
# 1. a) Create a table without generated columns.
#    b) Create a table with a VGC and a SGC with secondary indexes defined on
#       them.
#
# 2. a) For 1.a), Add a VGC and SGC with secondary index on the Slave.
#    b) For 1.b), Modify the generated expression for the VGC and SGC on the
#                 Slave.
#
# 3. Perform INSERTs on the tables and validate table data.
#
# 4. Perform UPDATEs on the tables and validate table data.
#
# 5. Perform DELETEs on the tables and validate table data.
#
# === References ===
#
# BUG#30034874: INDEX CORRUPTION WHEN SLAVE HAS VIRTUAL COLUMNS/INDEXES
#               AND MASTER DOESN'T
#
#

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

# ===========================================================================
--echo
--echo # Create a table without generated columns.
CREATE TABLE t1 (id INT) ENGINE=InnoDB;

--echo
--echo # Create a table with a VGC and a SGC with secondary indexes defined on
--echo # them.
CREATE TABLE t2(
id INT,
v_gcol INT GENERATED ALWAYS AS (id + 1) VIRTUAL NOT NULL,
s_gcol INT GENERATED ALWAYS AS (id + 1) STORED NOT NULL,
KEY v_idx (v_gcol), KEY s_idx (s_gcol)
) ENGINE=InnoDB;

# ===========================================================================
--source include/sync_slave_sql_with_master.inc
--echo
--echo # Add a VGC and also define secondary indexes on the VGC and SGC on the
--echo # Slave.
ALTER TABLE t1
ADD v_gcol INT GENERATED ALWAYS AS (id + 1) VIRTUAL NOT NULL,
ADD s_gcol INT GENERATED ALWAYS AS (id + 1) STORED NOT NULL,
ADD KEY v_idx (v_gcol), ADD KEY s_idx (s_gcol);

--echo
--echo # Modify the generated expression for the VGC and SGC on the Slave.
ALTER TABLE t2
MODIFY v_gcol INT GENERATED ALWAYS AS (id + 2) VIRTUAL NOT NULL,
MODIFY s_gcol INT GENERATED ALWAYS AS (id + 2) STORED NOT NULL;

# ===========================================================================
# Helper file for table data validation.
--write_file $MYSQLTEST_VARDIR/tmp/validate_table_data.inc
--let $i= 1
while ($i != 3)
{
  --let diff_tables= master:t$i, slave:t$i
  --let $mask_column_list= v_gcol, s_gcol
  --source include/diff_tables.inc

  --let $assert_text= Verified that table t$i has $expected_row_count rows
  --let $assert_cond= [SELECT count(*) as count from t$i where t$i.v_gcol= t$i.id+$i and t$i.s_gcol= t$i.id+$i ] = $expected_row_count
  --source include/assert.inc

  --inc $i
}
EOF

# ===========================================================================
--source include/rpl_connection_master.inc
--echo
--echo # INSERT values into the tables on the master.
INSERT INTO t1 VALUES (1);
INSERT INTO t2(id) VALUES (1);

--source include/sync_slave_sql_with_master.inc
--echo
--echo # Validate the table data.
--let $expected_row_count= 1
--source $MYSQLTEST_VARDIR/tmp/validate_table_data.inc

# ===========================================================================
--echo
--echo # UPDATE a record in the tables on the master.
--source include/rpl_connection_master.inc
UPDATE t1 SET id= 2 WHERE id= 1;
UPDATE t2 SET id= 2 WHERE id= 1;

--source include/sync_slave_sql_with_master.inc
--echo
--echo # Validate the table data.
--let $expected_row_count= 1
--source $MYSQLTEST_VARDIR/tmp/validate_table_data.inc

# ===========================================================================
--echo
--echo # DELETE a record in the tables on the master.
--source include/rpl_connection_master.inc
DELETE FROM t1 WHERE id= 2;
DELETE FROM t2 WHERE id= 2;

--source include/sync_slave_sql_with_master.inc
--echo
--echo # Validate the table data.
--let $expected_row_count= 0
--source $MYSQLTEST_VARDIR/tmp/validate_table_data.inc

# ===================================================================
--echo
--echo # Cleanup
--source include/rpl_connection_master.inc
DROP TABLE t1;
DROP TABLE t2;
--remove_file $MYSQLTEST_VARDIR/tmp/validate_table_data.inc
--source include/rpl_end.inc

Man Man