~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mi_locking.c

  • Committer: Jay Pipes
  • Date: 2008-09-09 20:10:57 UTC
  • mto: (383.2.4 fix-failing-tests)
  • mto: This revision was merged to the branch mainline in revision 386.
  • Revision ID: jay@mysql.com-20080909201057-3qkgcxqaps2s58y9
Re-enabled a number of passing tests from trunk

Show diffs side-by-side

added added

removed removed

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