~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/mi_extra.cc

  • Committer: Brian Aker
  • Date: 2010-11-07 00:54:27 UTC
  • mfrom: (1909.1.2 merge)
  • Revision ID: brian@tangent.org-20101107005427-a3kcx1lytrm36a97
Rollup merge of iocache work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
                                        /* Next/prev gives first/last */
58
58
    if (info->opt_flag & READ_CACHE_USED)
59
59
    {
60
 
      reinit_io_cache(&info->rec_cache, internal::READ_CACHE,0,
61
 
                      (bool) (info->lock_type != F_UNLCK),
62
 
                      (bool) test(info->update & HA_STATE_ROW_CHANGED)
63
 
                      );
 
60
      info->rec_cache.reinit_io_cache(internal::READ_CACHE,0,
 
61
                                      (bool) (info->lock_type != F_UNLCK),
 
62
                                      (bool) test(info->update & HA_STATE_ROW_CHANGED));
64
63
    }
65
64
    info->update= ((info->update & HA_STATE_CHANGED) | HA_STATE_NEXT_FOUND |
66
65
                   HA_STATE_PREV_FOUND);
78
77
    if (info->opt_flag & WRITE_CACHE_USED)
79
78
    {
80
79
      info->opt_flag&= ~WRITE_CACHE_USED;
81
 
      if ((error=end_io_cache(&info->rec_cache)))
 
80
      if ((error= info->rec_cache.end_io_cache()))
82
81
        break;
83
82
    }
84
83
    if (!(info->opt_flag &
86
85
    {
87
86
      cache_size= (extra_arg ? *(uint32_t*) extra_arg :
88
87
                   internal::my_default_record_cache_size);
89
 
      if (!(init_io_cache(&info->rec_cache,info->dfile,
90
 
                         (uint) min((uint32_t)info->state->data_file_length+1,
91
 
                                    cache_size),
92
 
                          internal::READ_CACHE,0L,(bool) (info->lock_type != F_UNLCK),
93
 
                          MYF(share->write_flag & MY_WAIT_IF_FULL))))
 
88
      if (!(info->rec_cache.init_io_cache(info->dfile, (uint) min((uint32_t)info->state->data_file_length+1, cache_size),
 
89
                                          internal::READ_CACHE,0L,(bool) (info->lock_type != F_UNLCK),
 
90
                                          MYF(share->write_flag & MY_WAIT_IF_FULL))))
94
91
      {
95
92
        info->opt_flag|=READ_CACHE_USED;
96
93
        info->update&= ~HA_STATE_ROW_CHANGED;
102
99
  case HA_EXTRA_REINIT_CACHE:
103
100
    if (info->opt_flag & READ_CACHE_USED)
104
101
    {
105
 
      reinit_io_cache(&info->rec_cache,internal::READ_CACHE,info->nextpos,
 
102
      info->rec_cache.reinit_io_cache(internal::READ_CACHE,info->nextpos,
106
103
                      (bool) (info->lock_type != F_UNLCK),
107
104
                      (bool) test(info->update & HA_STATE_ROW_CHANGED));
108
105
      info->update&= ~HA_STATE_ROW_CHANGED;
119
116
 
120
117
    cache_size= (extra_arg ? *(uint32_t*) extra_arg :
121
118
                 internal::my_default_record_cache_size);
122
 
    if (!(info->opt_flag &
123
 
          (READ_CACHE_USED | WRITE_CACHE_USED | OPT_NO_ROWS)) &&
124
 
        !share->state.header.uniques)
125
 
      if (!(init_io_cache(&info->rec_cache,info->dfile, cache_size,
126
 
                         internal::WRITE_CACHE,info->state->data_file_length,
127
 
                          (bool) (info->lock_type != F_UNLCK),
128
 
                          MYF(share->write_flag & MY_WAIT_IF_FULL))))
 
119
    if (not (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED | OPT_NO_ROWS)) && !share->state.header.uniques)
 
120
    {
 
121
      if (not (info->rec_cache.init_io_cache(info->dfile, cache_size,
 
122
                                             internal::WRITE_CACHE,info->state->data_file_length,
 
123
                                             (bool) (info->lock_type != F_UNLCK),
 
124
                                             MYF(share->write_flag & MY_WAIT_IF_FULL))))
129
125
      {
130
 
        info->opt_flag|=WRITE_CACHE_USED;
131
 
        info->update&= ~(HA_STATE_ROW_CHANGED |
 
126
        info->opt_flag|=WRITE_CACHE_USED;
 
127
        info->update&= ~(HA_STATE_ROW_CHANGED |
132
128
                         HA_STATE_WRITE_AT_END |
133
129
                         HA_STATE_EXTEND_BLOCK);
134
130
      }
 
131
    }
135
132
    break;
136
133
  case HA_EXTRA_PREPARE_FOR_UPDATE:
137
134
    if (info->s->data_file_type != DYNAMIC_RECORD)
141
138
    if (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED))
142
139
    {
143
140
      info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
144
 
      error=end_io_cache(&info->rec_cache);
 
141
      error= info->rec_cache.end_io_cache();
145
142
      /* Sergei will insert full text index caching here */
146
143
    }
147
144
#if !defined(TARGET_OS_SOLARIS)
369
366
  if (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED))
370
367
  {
371
368
    info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
372
 
    error= end_io_cache(&info->rec_cache);
 
369
    error= info->rec_cache.end_io_cache();
373
370
  }
374
371
  if (share->base.blobs)
375
372
    mi_alloc_rec_buff(info, SIZE_MAX, &info->rec_buff);