~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mi_locking.c

  • Committer: Monty Taylor
  • Date: 2008-10-16 06:32:30 UTC
  • mto: (511.1.5 codestyle)
  • mto: This revision was merged to the branch mainline in revision 521.
  • Revision ID: monty@inaugust.com-20081016063230-4brxsra0qsmsg84q
Added -Wunused-macros.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
*/
22
22
 
23
23
#include "myisamdef.h"
24
 
#include <m_ctype.h>
25
 
#include <my_tree.h>
26
 
#include <queues.h>
27
 
#include <mysql/plugin.h>
 
24
#include <mystrings/m_ctype.h>
 
25
#include <mysys/my_tree.h>
 
26
#include <mysys/queues.h>
 
27
#include <drizzled/util/test.h>
28
28
 
29
29
        /* lock table by F_UNLCK, F_RDLCK or F_WRLCK */
30
30
 
31
31
int mi_lock_database(MI_INFO *info, int lock_type)
32
32
{
33
33
  int error;
34
 
  uint count;
 
34
  uint32_t count;
35
35
  MYISAM_SHARE *share=info->s;
36
 
  uint flag;
 
36
  uint32_t flag;
37
37
 
38
38
  if (share->options & HA_OPTION_READ_ONLY_DATA ||
39
39
      info->lock_type == lock_type)
161
161
          break;
162
162
        }
163
163
      }
164
 
      VOID(_mi_test_if_changed(info));
 
164
      _mi_test_if_changed(info);
165
165
      share->r_locks++;
166
166
      share->tot_locks++;
167
167
      info->lock_type=lock_type;
195
195
          }
196
196
        }
197
197
      }
198
 
      VOID(_mi_test_if_changed(info));
 
198
      _mi_test_if_changed(info);
199
199
        
200
200
      info->lock_type=lock_type;
201
201
      info->invalidator=info->s->invalidator;
225
225
  pthread_mutex_unlock(&share->intern_lock);
226
226
#if defined(FULL_LOG) || defined(_lint)
227
227
  lock_type|=(int) (flag << 8);         /* Set bit to set if real lock */
228
 
  myisam_log_command(MI_LOG_LOCK,info,(uchar*) &lock_type,sizeof(lock_type),
 
228
  myisam_log_command(MI_LOG_LOCK,info,(unsigned char*) &lock_type,sizeof(lock_type),
229
229
                     error);
230
230
#endif
231
231
  return(error);
332
332
    external lock (in other words: w_locks == 1 means no other threads has
333
333
    a write lock)
334
334
  */
335
 
  return (my_bool) !(info->s->state.dellink == HA_OFFSET_ERROR ||
 
335
  return (bool) !(info->s->state.dellink == HA_OFFSET_ERROR ||
336
336
                     (myisam_concurrent_insert == 2 && info->s->r_locks &&
337
337
                      info->s->w_locks == 1));
338
338
}
357
357
      }
358
358
    }
359
359
    if (check_keybuffer)
360
 
      VOID(_mi_test_if_changed(info));
 
360
      _mi_test_if_changed(info);
361
361
    info->invalidator=info->s->invalidator;
362
362
  }
363
363
  else if (lock_type == F_WRLCK && info->lock_type == F_RDLCK)
374
374
  request
375
375
*/
376
376
 
377
 
int _mi_writeinfo(register MI_INFO *info, uint operation)
 
377
int _mi_writeinfo(register MI_INFO *info, uint32_t operation)
378
378
{
379
379
  int error,olderror;
380
380
  MYISAM_SHARE *share=info->s;
417
417
      share->state.update_count != info->last_loop)
418
418
  {                                             /* Keyfile has changed */
419
419
    if (share->state.process != share->this_process)
420
 
      VOID(flush_key_blocks(share->key_cache, share->kfile, FLUSH_RELEASE));
 
420
      flush_key_blocks(share->key_cache, share->kfile, FLUSH_RELEASE);
421
421
    share->last_process=share->state.process;
422
422
    info->last_unique=  share->state.unique;
423
423
    info->last_loop=    share->state.update_count;
450
450
 
451
451
int _mi_mark_file_changed(MI_INFO *info)
452
452
{
453
 
  uchar buff[3];
 
453
  unsigned char buff[3];
454
454
  register MYISAM_SHARE *share=info->s;
455
455
 
456
456
  if (!(share->state.changed & STATE_CHANGED) || ! share->global_changed)
482
482
 
483
483
int _mi_decrement_open_count(MI_INFO *info)
484
484
{
485
 
  uchar buff[2];
 
485
  unsigned char buff[2];
486
486
  register MYISAM_SHARE *share=info->s;
487
487
  int lock_error=0,write_error=0;
488
488
  if (share->global_changed)
489
489
  {
490
 
    uint old_lock=info->lock_type;
 
490
    uint32_t old_lock=info->lock_type;
491
491
    share->global_changed=0;
492
492
    lock_error=mi_lock_database(info,F_WRLCK);
493
493
    /* Its not fatal even if we couldn't get the lock ! */