~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to lib/GenTest/Validator/ResultsetComparatorSimplify.pm

merge from internal tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
        my ($comparator, $executors, $results) = @_;
28
28
 
29
29
        return STATUS_WONT_HANDLE if $#$results != 1;
 
30
 
 
31
        return STATUS_WONT_HANDLE if $results->[0]->query() =~ m{EXPLAIN}sio;
 
32
 
30
33
        return STATUS_WONT_HANDLE if $results->[0]->status() != STATUS_OK;
31
34
        return STATUS_WONT_HANDLE if $results->[1]->status() != STATUS_OK;
32
35
 
56
59
                my $simplifier_sql = GenTest::Simplifier::SQL->new(
57
60
                        oracle => sub {
58
61
                                my $oracle_query = shift;
 
62
 
59
63
                                my @oracle_results;
60
64
                                foreach my $executor (@$executors) {
61
 
                                        push @oracle_results, $executor->execute($oracle_query, 1);
62
 
 
 
65
                                        my $oracle_result = $executor->execute($oracle_query, 1);
 
66
 
 
67
                                        return ORACLE_ISSUE_STATUS_UNKNOWN if $oracle_result->status() != STATUS_OK;
 
68
 
 
69
                                        push @oracle_results, $oracle_result;
63
70
                                }
 
71
 
64
72
                                my $oracle_compare = GenTest::Comparator::compare($oracle_results[0], $oracle_results[1]);
65
 
                                if (
 
73
 
 
74
                                #
 
75
                                # If both result sets are empty, we can not decide if the issue continues to be repeatable
 
76
                                # or not. So, to be safe, we return "unknown", otherwise we risk messing up the differential
 
77
                                # coverage reports
 
78
                                #
 
79
 
 
80
                                if (($oracle_results[0]->rows() == 0) && ($oracle_results[1]->rows() == 0)) {
 
81
                                        return ORACLE_ISSUE_STATUS_UNKNOWN;
 
82
                                } elsif (
66
83
                                        ($oracle_compare == STATUS_LENGTH_MISMATCH) ||
67
84
                                        ($oracle_compare == STATUS_CONTENT_MISMATCH)
68
85
                                ) {
69
 
                                        return 1;
 
86
                                        return ORACLE_ISSUE_STILL_REPEATABLE;
70
87
                                } else {
71
 
                                        return 0;
 
88
                                        return ORACLE_ISSUE_NO_LONGER_REPEATABLE;
72
89
                                }
73
90
                        }
74
91
                );
79
96
                        say("Simplified query: $simplified_query;");
80
97
                        my $simplified_results = [];
81
98
 
82
 
                        $simplified_results->[0] = $executors->[0]->execute($simplified_query);
83
 
                        $simplified_results->[1] = $executors->[1]->execute($simplified_query);
 
99
                        $simplified_results->[0] = $executors->[0]->execute($simplified_query, 1);
 
100
                        $simplified_results->[1] = $executors->[1]->execute($simplified_query, 1);
84
101
                        say(GenTest::Comparator::dumpDiff($simplified_results->[0], $simplified_results->[1]));
85
102
 
86
103
                        my $simplifier_test = GenTest::Simplifier::Test->new(
107
124
        # If the discrepancy is on an UPDATE, then the servers have diverged and the test can not continue safely.
108
125
        # 
109
126
 
110
 
        if ($query =~ m{^\s*(select|alter)}io) {
 
127
        if ($query =~ m{^[\s/*!0-9]*(EXPLAIN|SELECT|ALTER|LOAD\s+INDEX|CACHE\s+INDEX)}io) {
111
128
                return $compare_outcome - STATUS_SELECT_REDUCTION;
112
129
        } else {
113
 
                $compare_outcome;
 
130
                return $compare_outcome;
114
131
        }
115
132
}
116
133