~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/execute.cc

  • Committer: Stewart Smith
  • Author(s): Vasil Dimov, Stewart Smith
  • Date: 2010-12-20 02:24:00 UTC
  • mto: (2021.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2022.
  • Revision ID: stewart@flamingspork.com-20101220022400-0p9lvvppwgaowdju
Merge Revision revid:vasil.dimov@oracle.com-20101102165720-164z3666y3tut4c2 from MySQL InnoDB

Original revid:vasil.dimov@oracle.com-20101102165720-164z3666y3tut4c2

Original Authors: Vasil Dimov <vasil.dimov@oracle.com>
Original commit message:
Fix Bug#53046 dict_update_statistics_low can still be run concurrently on same table

Replace the array of mutexes that used to protect
dict_index_t::stat_n_diff_key_vals[] with an array of rw locks that protects
all the stats related members in dict_table_t and all of its indexes.

Approved by:    Jimmy (rb://503)

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#include <config.h>
 
21
#include "config.h"
22
22
 
23
 
#include <drizzled/session.h>
24
 
#include <drizzled/user_var_entry.h>
25
 
#include <drizzled/plugin/client/concurrent.h>
26
 
#include <drizzled/catalog/local.h>
27
 
#include <drizzled/execute.h>
 
23
#include "drizzled/session.h"
 
24
#include "drizzled/user_var_entry.h"
 
25
#include "drizzled/plugin/client/concurrent.h"
 
26
#include "drizzled/execute.h"
28
27
 
29
28
namespace drizzled
30
29
{
53
52
  {
54
53
    plugin::client::Concurrent *client= new plugin::client::Concurrent;
55
54
    client->pushSQL(execution_string);
56
 
    Session::shared_ptr new_session= Session::make_shared(client, catalog::local());
 
55
    Session::shared_ptr new_session(new Session(client));
57
56
 
58
57
    // We set the current schema.  @todo do the same with catalog
59
58
    util::string::const_shared_ptr schema(_session.schema());
65
64
    // Overwrite the context in the next session, with what we have in our
66
65
    // session. Eventually we will allow someone to change the effective
67
66
    // user.
68
 
    new_session->user()= _session.user();
 
67
    new_session->getSecurityContext()= _session.getSecurityContext();
69
68
 
70
69
    if (Session::schedule(new_session))
71
70
    {
85
84
  if (wait && thread && thread->joinable())
86
85
  {
87
86
    // We want to make sure that we can be killed
88
 
    if (_session.getThread())
89
 
    {
90
 
      boost::this_thread::restore_interruption dl(_session.getThreadInterupt());
91
 
 
92
 
      try {
93
 
        thread->join();
94
 
      }
95
 
      catch(boost::thread_interrupted const&)
96
 
      {
97
 
        // Just surpress and return the error
98
 
        my_error(drizzled::ER_QUERY_INTERRUPTED, MYF(0));
99
 
        return;
100
 
      }
101
 
    }
102
 
    else
103
 
    {
 
87
    boost::this_thread::restore_interruption dl(_session.getThreadInterupt());
 
88
    try {
104
89
      thread->join();
105
90
    }
 
91
    catch(boost::thread_interrupted const&)
 
92
    {
 
93
      // Just surpress and return the error
 
94
      my_error(drizzled::ER_QUERY_INTERRUPTED, MYF(0));
 
95
 
 
96
      return;
 
97
    }
106
98
  }
107
99
}
108
100