~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/mi_write.cc

Merge in security refactor.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
/* Write a row to a MyISAM table */
17
17
 
100
100
                                  is_tree_inited(&info->bulk_insert[i])));
101
101
      if (local_lock_tree)
102
102
      {
 
103
        pthread_rwlock_wrlock(&share->key_root_lock[i]);
103
104
        share->keyinfo[i].version++;
104
105
      }
105
106
      {
106
107
        if (share->keyinfo[i].ck_insert(info,i,buff,
107
108
                        _mi_make_key(info,i,buff,record,filepos)))
108
109
        {
 
110
          if (local_lock_tree)
 
111
            pthread_rwlock_unlock(&share->key_root_lock[i]);
109
112
          goto err;
110
113
        }
111
114
      }
112
115
 
113
116
      /* The above changed info->lastkey2. Inform mi_rnext_same(). */
114
117
      info->update&= ~HA_STATE_RNEXT_SAME;
 
118
 
 
119
      if (local_lock_tree)
 
120
        pthread_rwlock_unlock(&share->key_root_lock[i]);
115
121
    }
116
122
  }
117
123
  if (share->calc_checksum)
139
145
    not critical to use outdated share->is_log_table value (2) locking
140
146
    mutex here for every write is too expensive.
141
147
  */
142
 
  if (share->is_log_table) // Log table do not exist in Drizzle
143
 
    assert(0);
 
148
  if (share->is_log_table)
 
149
    mi_update_status((void*) info);
144
150
 
145
151
  return(0);
146
152
 
160
166
    {
161
167
      if (mi_is_key_active(share->state.key_map, i))
162
168
      {
 
169
        bool local_lock_tree= (lock_tree &&
 
170
                                  !(info->bulk_insert &&
 
171
                                    is_tree_inited(&info->bulk_insert[i])));
 
172
        if (local_lock_tree)
 
173
          pthread_rwlock_wrlock(&share->key_root_lock[i]);
163
174
        {
164
175
          uint32_t key_length=_mi_make_key(info,i,buff,record,filepos);
165
176
          if (_mi_ck_delete(info,i,buff,key_length))
166
177
          {
 
178
            if (local_lock_tree)
 
179
              pthread_rwlock_unlock(&share->key_root_lock[i]);
167
180
            break;
168
181
          }
169
182
        }
 
183
        if (local_lock_tree)
 
184
          pthread_rwlock_unlock(&share->key_root_lock[i]);
170
185
      }
171
186
    }
172
187
  }
749
764
  case free_init:
750
765
    if (param->info->s->concurrent_insert)
751
766
    {
 
767
      pthread_rwlock_wrlock(&param->info->s->key_root_lock[param->keynr]);
752
768
      param->info->s->keyinfo[param->keynr].version++;
753
769
    }
754
770
    return 0;
759
775
    return _mi_ck_write_btree(param->info,param->keynr,lastkey,
760
776
                              keylen - param->info->s->rec_reflength);
761
777
  case free_end:
 
778
    if (param->info->s->concurrent_insert)
 
779
      pthread_rwlock_unlock(&param->info->s->key_root_lock[param->keynr]);
762
780
    return 0;
763
781
  }
764
782
  return -1;