~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/dbqp.py

  • Committer: Prafulla Tekawade
  • Date: 2010-07-13 16:07:35 UTC
  • mto: (1662.1.4 rollup)
  • mto: This revision was merged to the branch mainline in revision 1664.
  • Revision ID: prafulla_t@users.sourceforge.net-20100713160735-2fsdtrm3azayuyu1
This bug is simillar to mysql bug 36133
http://bugs.mysql.com/bug.php?id=36133

Taking changes from that fix.

  - The problem was that the range optimizer evaluated constant expressions, 
    and among them it would try to evaluate IN-subquery predicates slated for
    handling with materialization strategy. However, these predicates require
    that parent_join->setup_subquery_materialization() is invoked before one
    attempts to evaluate them.
  
  - Fixed by making the range optimizer not to evaluate expressions that have
    item->is_expensive() == TRUE (these are materialization subqueries and 
    stored function calls). This should also resolve the problem that EXPLAIN 
    may be too long. 
    This change cuts off some opportunities for range optimizer, but this is 
    the price we're willing to pay for separation of query optimization and
    execution. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /usr/bin/env python
2
 
# -*- mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
3
 
# vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
 
#
5
 
# Copyright (C) 2010 Patrick Crews
6
 
#
7
 
# This program is free software; you can redistribute it and/or modify
8
 
# it under the terms of the GNU General Public License as published by
9
 
# the Free Software Foundation; either version 2 of the License, or
10
 
# (at your option) any later version.
11
 
#
12
 
# This program is distributed in the hope that it will be useful,
13
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
# GNU General Public License for more details.
16
 
#
17
 
# You should have received a copy of the GNU General Public License
18
 
# along with this program; if not, write to the Free Software
19
 
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
 
 
21
 
 
22
 
""" dbqp.py
23
 
 
24
 
DataBase Quality Platform - system for executing various
25
 
testing systems and the helper code 
26
 
 
27
 
Currently only executing drizzle-test-run tests
28
 
But we can compose various combinations of servers, system,
29
 
and test definitions to produce various results
30
 
 
31
 
"""
32
 
 
33
 
# imports
34
 
import os
35
 
import sys
36
 
import lib.test_run_options as test_run_options
37
 
from lib.test_mode import handle_mode
38
 
from lib.server_mgmt.server_management import serverManager
39
 
from lib.sys_mgmt.system_management import systemManager
40
 
from lib.test_mgmt.execution_management import executionManager
41
 
 
42
 
# functions
43
 
 
44
 
 
45
 
# main
46
 
variables = test_run_options.variables
47
 
system_manager = None
48
 
server_manager = None
49
 
test_manager = None
50
 
test_executor = None
51
 
execution_manager = None
52
 
 
53
 
try:
54
 
    # Some system-level work is constant regardless
55
 
    # of the test to be run
56
 
    system_manager = systemManager(variables)
57
 
 
58
 
    # Create our server_manager
59
 
    server_manager = serverManager(system_manager, variables)
60
 
 
61
 
    # Get our mode-specific test_manager and test_executor
62
 
    (test_manager,test_executor) = handle_mode(variables, system_manager)
63
 
 
64
 
    # Gather our tests for execution
65
 
    test_manager.gather_tests()
66
 
 
67
 
    # Initialize test execution manager
68
 
    execution_manager = executionManager(server_manager, system_manager
69
 
                                    , test_manager, test_executor
70
 
                                    , variables)
71
 
 
72
 
    # Execute our tests!
73
 
    execution_manager.execute_tests()
74
 
 
75
 
except Exception, e:
76
 
   print Exception, e
77
 
 
78
 
except KeyboardInterrupt:
79
 
  print "\n\nDetected <Ctrl>+c, shutting down and cleaning up..."
80
 
 
81
 
finally:
82
 
# TODO - make a more robust cleanup
83
 
# At the moment, runaway servers are our biggest concern
84
 
    if server_manager and not variables['startandexit']:
85
 
        if variables['gdb']:
86
 
            server_manager.cleanup_all_servers()
87
 
        else:
88
 
            server_manager.cleanup()
89
 
    if not variables['startandexit']:
90
 
        if test_manager:
91
 
            fail_count = test_manager.has_failing_tests()
92
 
            sys.exit(test_manager.has_failing_tests())
93
 
        else:
94
 
            # return 1 as we likely have a problem if we don't have a
95
 
            # test_manager
96
 
            sys.exit(1)
97