~clint-fewbar/drizzle/regex-policy-cache-limiter

« back to all changes in this revision

Viewing changes to plugin/myisam/mi_locking.cc

  • Committer: Clint Byrum
  • Date: 2012-03-15 18:05:43 UTC
  • mfrom: (2224.1.302 workspace)
  • Revision ID: clint@ubuntu.com-20120315180543-9jxxm4q10k3np2ws
merging with latest trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
*/
22
22
 
23
23
#include "myisam_priv.h"
24
 
#include <drizzled/charset_info.h>
 
24
#include <drizzled/charset.h>
25
25
#include <drizzled/util/test.h>
26
26
 
27
27
using namespace std;
34
34
  int error;
35
35
  uint32_t count;
36
36
  MYISAM_SHARE *share=info->s;
 
37
#if defined(FULL_LOG) || defined(_lint)
37
38
  uint32_t flag;
 
39
#endif
38
40
 
39
41
  if (!info->s->in_use)
40
42
    info->s->in_use= new list<Session *>;
47
49
    info->s->in_use->push_front(info->in_use);
48
50
    return(0);
49
51
  }
 
52
#if defined(FULL_LOG) || defined(_lint)
 
53
  flag=0;
 
54
#endif
50
55
 
51
 
  flag=error=0;
 
56
  error=0;
52
57
  if (share->kfile >= 0)                /* May only be false on windows */
53
58
  {
54
59
    switch (lock_type) {
58
63
      else
59
64
        count= --share->w_locks;
60
65
      --share->tot_locks;
61
 
      if (info->lock_type == F_WRLCK && !share->w_locks &&
62
 
          !share->delay_key_write && flush_key_blocks(share->getKeyCache(),
63
 
                                                      share->kfile,FLUSH_KEEP))
64
 
      {
65
 
        error=errno;
66
 
        mi_print_error(info->s, HA_ERR_CRASHED);
67
 
        mi_mark_crashed(info);          /* Mark that table must be checked */
68
 
      }
69
66
      if (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED))
70
67
      {
71
68
        if (info->rec_cache.end_io_cache())
98
95
            mi_mark_crashed(info);
99
96
          }
100
97
        }
 
98
#if defined(FULL_LOG) || defined(_lint)
101
99
        if (info->lock_type != F_EXTRA_LCK)
102
100
        {
103
101
          if (share->r_locks)
109
107
            flag=1;
110
108
          }
111
109
        }
 
110
#endif
112
111
      }
113
112
      info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
114
113
      info->lock_type= F_UNLCK;
123
122
          mysqld does not turn write locks to read locks,
124
123
          so we're never here in mysqld.
125
124
        */
 
125
#if defined(FULL_LOG) || defined(_lint)
126
126
        if (share->w_locks == 1)
127
127
        {
128
128
          flag=1;
129
129
        }
 
130
#endif
130
131
        share->w_locks--;
131
132
        share->r_locks++;
132
133
        info->lock_type=lock_type;
134
135
      }
135
136
      if (!share->r_locks && !share->w_locks)
136
137
      {
 
138
#if defined(FULL_LOG) || defined(_lint)
137
139
        flag=1;
 
140
#endif
138
141
        if (mi_state_info_read_dsk(share->kfile, &share->state, 1))
139
142
        {
140
143
          error=errno;
158
161
      {                                         /* Change READONLY to RW */
159
162
        if (share->r_locks == 1)
160
163
        {
 
164
#if defined(FULL_LOG) || defined(_lint)
161
165
          flag=1;
 
166
#endif
162
167
          share->r_locks--;
163
168
          share->w_locks++;
164
169
          info->lock_type=lock_type;
169
174
      {
170
175
        if (!share->w_locks)
171
176
        {
 
177
#if defined(FULL_LOG) || defined(_lint)
172
178
          flag=1;
 
179
#endif
173
180
          if (!share->r_locks)
174
181
          {
175
182
            if (mi_state_info_read_dsk(share->kfile, &share->state, 1))
286
293
      share->state.unique  != info->last_unique ||
287
294
      share->state.update_count != info->last_loop)
288
295
  {                                             /* Keyfile has changed */
289
 
    if (share->state.process != share->this_process)
290
 
      flush_key_blocks(share->getKeyCache(), share->kfile, FLUSH_RELEASE);
291
296
    share->last_process=share->state.process;
292
297
    info->last_unique=  share->state.unique;
293
298
    info->last_loop=    share->state.update_count;