~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbms/src/cslib/CSMutex.h

  • 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
 
/* Copyright (C) 2008 PrimeBase Technologies GmbH, Germany
2
 
 *
3
 
 * PrimeBase Media Stream for MySQL
4
 
 *
5
 
 * This program is free software; you can redistribute it and/or modify
6
 
 * it under the terms of the GNU General Public License as published by
7
 
 * the Free Software Foundation; either version 2 of the License, or
8
 
 * (at your option) any later version.
9
 
 *
10
 
 * This program is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 * GNU General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU General Public License
16
 
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
 
 *
19
 
 * Original author: Paul McCullagh (H&G2JCtL)
20
 
 * Continued development: Barry Leslie
21
 
 *
22
 
 * 2007-06-06
23
 
 *
24
 
 * CORE SYSTEM:
25
 
 * A basic mutex (mutual exclusion) object.
26
 
 *
27
 
 */
28
 
 
29
 
#ifndef __CSMUTEX_H__
30
 
#define __CSMUTEX_H__
31
 
 
32
 
#include <pthread.h>
33
 
 
34
 
#include "CSDefs.h"
35
 
 
36
 
class CSThread;
37
 
 
38
 
class CSMutex {
39
 
public:
40
 
        CSMutex();
41
 
        virtual ~CSMutex();
42
 
 
43
 
        virtual void lock();
44
 
        virtual void unlock();
45
 
 
46
 
        friend class CSLock;
47
 
        friend class CSSync;
48
 
 
49
 
private:
50
 
        pthread_mutex_t iMutex;
51
 
#ifdef DEBUG
52
 
        CSThread                *iLocker;
53
 
public:
54
 
        bool                    trace;
55
 
#endif
56
 
};
57
 
 
58
 
class CSLock : public CSMutex {
59
 
public:
60
 
        CSLock();
61
 
        virtual ~CSLock();
62
 
 
63
 
        virtual void lock();
64
 
        virtual void unlock();
65
 
        virtual bool haveLock();
66
 
 
67
 
        friend class CSSync;
68
 
 
69
 
private:
70
 
        CSThread                *iLockingThread;
71
 
        int                             iLockCount;
72
 
};
73
 
 
74
 
class CSSync : public CSLock {
75
 
public:
76
 
        CSSync();
77
 
        virtual ~CSSync();
78
 
        
79
 
        /* Wait for resources on the object
80
 
         * to be freed.
81
 
         *
82
 
         * This function may only be called
83
 
         * if the thread has already locked the
84
 
         * object.
85
 
         */
86
 
        virtual void wait();
87
 
 
88
 
        /* Wait for a certain amount of time, in
89
 
         * milli-seconds (1/1000th of a second).
90
 
         */
91
 
        void wait(time_t mill_sec);
92
 
 
93
 
        /*
94
 
         * Wakeup any waiters.
95
 
         */
96
 
        virtual void wakeup();
97
 
 
98
 
private:
99
 
        pthread_cond_t  iCondition;
100
 
};
101
 
 
102
 
#endif
103