1
# Copyright (c) 2008, 2010 Oracle and/or its affiliates, Inc. All
2
# rights reserved. Use is subject to license terms.
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; version 2 of the License.
8
# This program is distributed in the hope that it will be useful, but
9
# WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
# General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
18
package GenTest::Validator::MarkErrorLog;
21
@ISA = qw(GenTest::Validator);
25
use GenTest::Validator;
26
use GenTest::Constants;
31
my ($validator, $executors, $results) = @_;
32
my $dbh = $executors->[0]->dbh();
34
if (not defined $error_log) {
35
my ($foo, $error_log_mysql) = $dbh->selectrow_array("SHOW VARIABLES LIKE 'log_error'");
37
if ($error_log_mysql ne '') {
38
$error_log = $error_log_mysql;
40
my ($bar, $datadir_mysql) = $dbh->selectrow_array("SHOW VARIABLES LIKE 'datadir'");
41
foreach my $errlog ('../log/master.err', '../mysql.err') {
42
if (-f $datadir_mysql.'/'.$errlog) {
43
$error_log = $datadir_mysql.'/'.$errlog;
49
say ("MarkErrorLog found errorlog at " . $error_log);
54
my $query = $results->[0]->query();
56
open(LOG, ">>$error_log") or die "unable to open $error_log: $!";
57
print LOG isoTimestamp()." [$$] Query: $query\n";