1.1.3
by Tobias Frost
Import upstream version 2012.01.30 |
1 |
# Copyright (c) 2008, 2010 Oracle and/or its affiliates, Inc. All
|
2 |
# rights reserved. Use is subject to license terms.
|
|
3 |
#
|
|
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.
|
|
7 |
#
|
|
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.
|
|
12 |
#
|
|
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
|
|
16 |
# USA
|
|
17 |
||
18 |
package GenTest::Validator::DrizzleErrorLogScan; |
|
19 |
||
20 |
require Exporter; |
|
21 |
@ISA = qw(GenTest::Validator); |
|
22 |
||
23 |
use strict; |
|
24 |
use GenTest; |
|
25 |
use GenTest::Validator; |
|
26 |
use GenTest::Constants; |
|
27 |
||
28 |
my $error_log; |
|
29 |
||
30 |
sub validate |
|
31 |
{
|
|
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'; |
|
36 |
say("$error_log"); |
|
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(); |
|
40 |
||
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>; |
|
45 |
say("@list->[0]"); |
|
46 |
my $list_size = @list ; |
|
47 |
if ($list_size > 0) |
|
48 |
{
|
|
49 |
#kill our server
|
|
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 ; |
|
54 |
}
|
|
55 |
||
56 |
||
57 |
return STATUS_OK; |
|
58 |
}
|
|
59 |
||
60 |
1; |