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::DrizzleErrorLogScan;
21
@ISA = qw(GenTest::Validator);
25
use GenTest::Validator;
26
use GenTest::Constants;
32
my ($validator, $executors, $results) = @_;
33
my $dbh = $executors->[0]->dbh();
34
my @basedir= $dbh->selectrow_array('SELECT @@basedir');
35
my $error_log = @basedir->[0].'/tests/var/log/master.err';
37
my $err_msg = "InnoDB: Error: unlock row could not find a 2 mode lock on the record" ;
38
# my $err_msg = "lt-drizzled: Sort aborted" ;
39
my $query = $results->[0]->query();
41
# We check the log after each query and kill the server if we
42
# encounter the target err_msg
43
open( ERR_LOG, $error_log) or die 'Could not open file: ' .$!;
44
my @list = grep /\b$err_msg\b/, <ERR_LOG>;
46
my $list_size = @list ;
50
say("Message: $err_msg detected in $error_log. Killing server");
51
system("killall -9 lt-drizzled");
52
say("Message: $err_msg detected after executing query $query");
53
return STATUS_DATABASE_CORRUPTION ;