146
142
[qw(first_seen last_seen reviewed_by reviewed_on comments)],
147
143
'review columns');
149
# ##############################################################################
150
# Test review history stuff
151
# ##############################################################################
152
my $pat = $opt_parser->read_para_after("$trunk/bin/pt-query-digest",
153
qr/MAGIC_history_cols/);
155
my $create_table = $opt_parser->read_para_after(
156
"$trunk/bin/pt-query-digest", qr/MAGIC_create_review_history/);
157
$create_table =~ s/query_review_history/test.query_review_history/;
158
$dbh->do($create_table);
159
my $hist_struct = $tp->parse(
160
$tp->get_create_table($dbh, 'test', 'query_review_history'));
162
$qv->set_history_options(
163
table => 'test.query_review_history',
165
tbl_struct => $hist_struct,
166
col_pat => qr/^(.*?)_($pat)$/,
169
$qv->set_review_history(
179
median => '0.000682',
181
pct_95 => '0.000682',
184
min => '090101 12:39:12',
185
max => '090101 13:19:12',
190
$res = $dbh->selectall_arrayref(
191
'SELECT Lock_time_median, Lock_time_stddev, Query_time_sum, checksum, Rows_examined_stddev, ts_cnt, sample, Rows_examined_median, Rows_sent_min, Rows_examined_min, Rows_sent_sum, Query_time_min, Query_time_pct_95, Rows_examined_sum, Rows_sent_stddev, Rows_sent_pct_95, Query_time_max, Rows_examined_max, Query_time_stddev, Rows_sent_median, Lock_time_pct_95, ts_min, Lock_time_min, Lock_time_max, ts_max, Rows_examined_pct_95 ,Rows_sent_max, Query_time_median, Lock_time_sum
192
FROM test.query_review_history',
196
[ { checksum => '17145033699835028696',
197
sample => 'foo sample',
198
ts_min => '2009-01-01 12:39:12',
199
ts_max => '2009-01-01 13:19:12',
201
Query_time_sum => '0.000682',
202
Query_time_min => '0.000682',
203
Query_time_max => '0.000682',
204
Query_time_median => '0.000682',
205
Query_time_stddev => 0,
206
Query_time_pct_95 => '0.000682',
207
Lock_time_sum => undef,
208
Lock_time_min => undef,
209
Lock_time_max => undef,
210
Lock_time_pct_95 => undef,
211
Lock_time_stddev => undef,
212
Lock_time_median => undef,
213
Rows_sent_sum => undef,
214
Rows_sent_min => undef,
215
Rows_sent_max => undef,
216
Rows_sent_pct_95 => undef,
217
Rows_sent_stddev => undef,
218
Rows_sent_median => undef,
219
Rows_examined_sum => undef,
220
Rows_examined_min => undef,
221
Rows_examined_max => undef,
222
Rows_examined_pct_95 => undef,
223
Rows_examined_stddev => undef,
224
Rows_examined_median => undef,
227
'Review history information is in the DB',
231
$qv->set_review_history(
241
is($EVAL_ERROR, '', 'No error on undef ts_min and ts_max');
243
# #############################################################################
244
# Issue 1265: mk-query-digest --review-history table with minimum 2 columns
245
# #############################################################################
246
$dbh->do('truncate table test.query_review');
247
$dbh->do('drop table test.query_review_history');
248
# mqd says "The table must have at least the following columns:"
249
my $min_tbl = "CREATE TABLE query_review_history (
250
checksum BIGINT UNSIGNED NOT NULL,
255
$hist_struct = $tp->parse(
256
$tp->get_create_table($dbh, 'test', 'query_review_history'));
257
$qv->set_history_options(
258
table => 'test.query_review_history',
260
tbl_struct => $hist_struct,
261
col_pat => qr/^(.*?)_($pat)$/,
264
$qv->set_review_history(
274
median => '0.000682',
276
pct_95 => '0.000682',
279
min => '090101 12:39:12',
280
max => '090101 13:19:12',
288
"Minimum 2-column review history table (issue 1265)"
291
145
# #############################################################################
293
147
# #############################################################################