1 # Example how to use this auxiliary script
2 #-----------------------------------------
4 ### The table/tables used in $part must have the right content.
5 ### $title_prefix is used for the generation of titles
7 # let $title_prefix= 4.3;
8 ### $check_num is used for the generation of titles and gets incremented after
9 ### every call of the current script.
11 ### $diff_column_list is used for the generation of error information and valid for
13 # let $diff_column_list=
14 # t2.COUNT_READ - t1.COUNT_READ AS D_COUNT_READ,
15 # t2.COUNT_READ AS S2_COUNT_READ,
16 # t1.COUNT_READ AS S1_COUNT_READ,
17 # t2.SUM_NUMBER_OF_BYTES_READ - t1.SUM_NUMBER_OF_BYTES_READ AS D_SUM_NUMBER_OF_BYTES_READ,
18 # t2.SUM_NUMBER_OF_BYTES_READ AS S2_SUM_NUMBER_OF_BYTES_READ,
19 # t1.SUM_NUMBER_OF_BYTES_READ AS S1_SUM_NUMBER_OF_BYTES_READ,
20 # t2.COUNT_WRITE - t1.COUNT_WRITE AS D_COUNT_WRITE,
21 # t2.COUNT_WRITE AS S2_COUNT_WRITE,
22 # t1.COUNT_WRITE AS S1_COUNT_WRITE,
23 # t2.SUM_NUMBER_OF_BYTES_WRITE - t1.SUM_NUMBER_OF_BYTES_WRITE AS D_UM_NUMBER_OF_BYTES_WRITE,
24 # t2.SUM_NUMBER_OF_BYTES_WRITE AS S2_SUM_NUMBER_OF_BYTES_WRITE,
25 # t1.SUM_NUMBER_OF_BYTES_WRITE AS S1_SUM_NUMBER_OF_BYTES_WRITE,
26 # t2.COUNT_MISC - t1.COUNT_MISC AS D_COUNT_MISC,
27 # t2.COUNT_MISC AS S2_COUNT_MISC,
28 # t1.COUNT_MISC AS S1_COUNT_MISC;
29 ### $part is used for the generation of "check" statements + error information
30 ### and valid for every sub test.
32 # FROM mysqltest.socket_summary_by_instance_detail t1
33 # JOIN mysqltest.socket_summary_by_instance_detail t2
34 # USING (EVENT_NAME, OBJECT_INSTANCE_BEGIN, run)
35 # WHERE OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
36 # AND EVENT_NAME LIKE ('%client_connection')
39 # --echo # $title_prefix Check the differences caused by SQL statement
41 # let stmt1= SELECT col2 FROM does_not_exist;
42 # let stmt2= SELECT col2 FROM does_not_exist WHERE col1 = 0;
43 ### $msg is used to generate some explanation of what we compare.
45 # # One statement is longer than the other.
46 # # Both statements fail with the same error message (table does not exist);
48 # t2.COUNT_READ - t1.COUNT_READ = 0 AND
49 # t2.SUM_NUMBER_OF_BYTES_READ - t1.SUM_NUMBER_OF_BYTES_READ = LENGTH('$stmt2') - LENGTH('$stmt1') AND
50 # t2.COUNT_WRITE - t1.COUNT_WRITE = 0 AND
51 # t2.SUM_NUMBER_OF_BYTES_WRITE - t1.SUM_NUMBER_OF_BYTES_WRITE = 0 AND
52 # t2.COUNT_MISC - t1.COUNT_MISC = 0;
53 # --source ../include/socket_check1.inc
58 # --source ../include/socket_check1.inc
63 --echo # $title_prefix.$check_num Compare impact of statements
68 # Enable this when extending the checks for SQL statements.
71 if (`SELECT CONCAT(
"$stmt1",
"$stmt2",
"$my_rules") LIKE
'%_not_set%'`)
73 --echo # INTERNAL ERROR:
74 --echo # At least one of the variables has no value (is like
'%_not_set')
75 --echo # stmt1 : $stmt1
76 --echo # stmt2 : $stmt2
77 --echo # my_rules : $my_rules
78 --echo # Sorry, have
to abort
83 if(`SELECT NOT ( $my_rules )
85 AND t2.statement =
'$stmt2' AND t1.statement =
'$stmt1'`)
89 --echo # The compared statistics looks suspicious
95 SELECT $my_rules AS Expect_1
97 AND t2.statement =
'$stmt2' AND t1.statement =
'$stmt1';
101 SELECT $diff_column_list
103 AND t1.statement =
'$stmt1' AND t2.statement =
'$stmt2';
109 LPAD(COUNT_READ, 8,
' ') AS CNT_READ,
110 LPAD(SUM_NUMBER_OF_BYTES_READ, 10,' ') AS BYTES_READ,
111 LPAD(COUNT_WRITE,9, ' ') AS CNT_WRITE,
112 LPAD(SUM_NUMBER_OF_BYTES_WRITE, 11,' ') AS BYTES_WRITE,
113 LPAD(COUNT_MISC, 8, ' ') AS CNT_MISC,
statement
114 FROM mysqltest.socket_summary_by_instance_detail
115 WHERE OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
116 AND EVENT_NAME LIKE ('%client_connection')
119 let $print_details= 1;
121 # Initialize all variables which depend on the statements to be checked.
122 # This prevents that we run with wrong data.
123 let $stmt1= stmt1_not_set;
124 let $stmt2= stmt2_not_set;
125 let $my_rules= my_rules_not_set;
126 let $msg= msg_not_set;