~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/flush.cc

  • Committer: lbieber
  • Date: 2010-01-21 18:21:39 UTC
  • mto: This revision was merged to the branch mainline in revision 1277.
  • Revision ID: lbieber@orisndriz08-20100121182139-h549us3gsysyyl0e
clean up japanese tests, remove tests that no longer apply.  In test-run.pl change mysql_version_id to drizzle_version_id

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <drizzled/lock.h>
25
25
#include <drizzled/statement/flush.h>
26
26
#include "drizzled/sql_table.h"
27
 
#include "drizzled/plugin/logging.h"
28
27
 
29
28
namespace drizzled
30
29
{
35
34
   * reloadCache() will tell us if we are allowed to write to the
36
35
   * binlog or not.
37
36
   */
38
 
  if (not reloadCache())
 
37
  if (! reloadCache())
39
38
  {
40
39
    /*
41
40
     * We WANT to write and we CAN write.
43
42
     *
44
43
     * Presumably, RESET and binlog writing doesn't require synchronization
45
44
     */
46
 
    write_bin_log(session, *session->getQueryString());
 
45
    write_bin_log(session, session->query, session->query_length);
47
46
    session->my_ok();
48
47
  }
49
48
 
53
52
bool statement::Flush::reloadCache()
54
53
{
55
54
  bool result= false;
 
55
  ulong options= session->lex->type;
56
56
  TableList *tables= (TableList *) session->lex->select_lex.table_list.first;
57
57
 
58
 
  if (flush_log)
 
58
  if (options & REFRESH_LOG)
59
59
  {
60
60
    if (plugin::StorageEngine::flushLogs(NULL))
61
61
    {
66
66
    Note that if REFRESH_READ_LOCK bit is set then REFRESH_TABLES is set too
67
67
    (see sql_yacc.yy)
68
68
  */
69
 
  if (flush_tables || flush_tables_with_read_lock)
 
69
  if (options & (REFRESH_TABLES | REFRESH_READ_LOCK))
70
70
  {
71
 
    if (session && flush_tables_with_read_lock)
 
71
    if ((options & REFRESH_READ_LOCK) && session)
72
72
    {
73
 
      if (session->lockGlobalReadLock())
 
73
      if (lock_global_read_lock(session))
74
74
      {
75
75
        return true; /* Killed */
76
76
      }
77
 
      result= session->close_cached_tables(tables, true, true);
78
 
 
79
 
      if (session->makeGlobalReadLockBlockCommit()) /* Killed */
 
77
      result= session->close_cached_tables(tables, 
 
78
                                           (options & REFRESH_FAST) ?  false : true, 
 
79
                                           true);
 
80
      if (make_global_read_lock_block_commit(session)) /* Killed */
80
81
      {
81
82
        /* Don't leave things in a half-locked state */
82
 
        session->unlockGlobalReadLock();
 
83
        unlock_global_read_lock(session);
83
84
        return true;
84
85
      }
85
86
    }
86
87
    else
87
88
    {
88
 
      result= session->close_cached_tables(tables, true, false);
 
89
      result= session->close_cached_tables(tables, 
 
90
                                           (options & REFRESH_FAST) ?  false : true, 
 
91
                                           false);
89
92
    }
90
93
  }
91
94
 
92
 
  if (session && flush_status)
93
 
  {
94
 
    session->refresh_status();
95
 
  }
96
 
 
97
 
  if (session && flush_global_status)
98
 
  {
99
 
    memset(&current_global_counters, 0, sizeof(current_global_counters));
100
 
    plugin::Logging::resetStats(session);
101
 
    session->refresh_status();
102
 
  }
103
 
 
104
 
  return result;
 
95
  if (session && (options & REFRESH_STATUS))
 
96
  {
 
97
    session->refresh_status();
 
98
  }
 
99
 
 
100
 return result;
105
101
}
106
102
 
107
103
}