1--let $label = [$table_name]
2--let $partition_spec =
3if($partition_name != '')
4{
5  --let $label = $label[$partition_name]
6  --let $partition_spec = PARTITION ($partition_name)
7}
8
9--disable_query_log
10eval SET @a_short = '$a_short';
11eval SET @b_short = '$b_short';
12eval SET @a_long = '$a_long';
13eval SET @b_long = '$b_long';
14--enable_query_log
15
16--echo $label checking data consistency just after upgrade
17--let $assert_text= $label initial number of records must be 2
18--let $assert_cond= [SELECT COUNT(*) FROM $table_name $partition_spec] = 2
19--source include/assert.inc
20--let $assert_text= $label initial short record must not be corrupted
21--let $assert_cond= [SELECT COUNT(*) FROM $table_name $partition_spec WHERE id = 0 + $part_shift + $subpart_shift AND a = @a_short AND b = @b_short] = 1
22--source include/assert.inc
23--let $assert_text= $label initial long record must not be corrupted
24--let $assert_cond= [SELECT COUNT(*) FROM $table_name $partition_spec WHERE id = 2 + $part_shift + $subpart_shift AND a = @a_long AND b = @b_long] = 1
25--source include/assert.inc
26
27--echo $label inserting a new record
28eval INSERT INTO $table_name VALUES (4 + $part_shift + $subpart_shift, @a_short, @b_long);
29--let $assert_text= $label number of records after insert must be 3
30--let $assert_cond= [SELECT COUNT(*) FROM $table_name $partition_spec] = 3
31--source include/assert.inc
32--let $assert_text= $label short record after insert must not be corrupted
33--let $assert_cond= [SELECT COUNT(*) FROM $table_name $partition_spec WHERE id = 0 + $part_shift + $subpart_shift AND a = @a_short AND b = @b_short] = 1
34--source include/assert.inc
35--let $assert_text= $label long record after insert must not be corrupted
36--let $assert_cond= [SELECT COUNT(*) FROM $table_name $partition_spec WHERE id = 2 + $part_shift + $subpart_shift AND a = @a_long AND b = @b_long] = 1
37--source include/assert.inc
38--let $assert_text= $label inserted record must not be corrupted
39--let $assert_cond= [SELECT COUNT(*) FROM $table_name $partition_spec WHERE id = 4 + $part_shift + $subpart_shift AND a = @a_short AND b = @b_long] = 1
40--source include/assert.inc
41
42--echo $label updating existing record
43eval UPDATE $table_name SET a = @a_long, b = @b_short WHERE id = 4 + $part_shift + $subpart_shift;
44--let $assert_text= $label number of records after update must be 3
45--let $assert_cond= [SELECT COUNT(*) FROM $table_name $partition_spec] = 3
46--source include/assert.inc
47--let $assert_text= $label short record after update must not be corrupted
48--let $assert_cond= [SELECT COUNT(*) FROM $table_name $partition_spec WHERE id = 0 + $part_shift + $subpart_shift AND a = @a_short AND b = @b_short] = 1
49--source include/assert.inc
50--let $assert_text= $label long record after update must not be corrupted
51--let $assert_cond= [SELECT COUNT(*) FROM $table_name $partition_spec WHERE id = 2 + $part_shift + $subpart_shift AND a = @a_long AND b = @b_long] = 1
52--source include/assert.inc
53--let $assert_text= $label updated record must not be corrupted
54--let $assert_cond= [SELECT COUNT(*) FROM $table_name $partition_spec WHERE id = 4 + $part_shift + $subpart_shift AND a = @a_long AND b = @b_short] = 1
55--source include/assert.inc
56
57--echo $label deleting existing record
58eval DELETE FROM $table_name WHERE id = 4 + $part_shift + $subpart_shift;
59--let $assert_text= $label number of records after delete must be 2
60--let $assert_cond= [SELECT COUNT(*) FROM $table_name $partition_spec] = 2
61--source include/assert.inc
62--let $assert_text= $label short record after delete must not be corrupted
63--let $assert_cond= [SELECT COUNT(*) FROM $table_name $partition_spec WHERE id = 0 + $part_shift + $subpart_shift AND a = @a_short AND b = @b_short] = 1
64--source include/assert.inc
65--let $assert_text= $label long record after delete must not be corrupted
66--let $assert_cond= [SELECT COUNT(*) FROM $table_name $partition_spec WHERE id = 2 + $part_shift + $subpart_shift AND a = @a_long AND b = @b_long] = 1
67--source include/assert.inc
68--let $assert_text= $label deleted record must not exist
69--let $assert_cond= [SELECT COUNT(*) FROM $table_name $partition_spec WHERE id = 4] = 0
70--source include/assert.inc
71