~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/archive/ha_archive.cc

Encapsulate the mutex in Archive.

Show diffs side-by-side

added added

removed removed

Lines of Context:
272
272
  /*
273
273
    We will use this lock for rows.
274
274
  */
275
 
  pthread_mutex_init(&mutex,MY_MUTEX_INIT_FAST);
 
275
  pthread_mutex_init(&_mutex,MY_MUTEX_INIT_FAST);
276
276
}
277
277
 
278
278
ArchiveShare::~ArchiveShare()
279
279
{
280
280
  thr_lock_delete(&_lock);
281
 
  pthread_mutex_destroy(&mutex);
 
281
  pthread_mutex_destroy(&_mutex);
282
282
  /*
283
283
    We need to make sure we don't reset the crashed state.
284
284
    If we open a crashed file, wee need to close it as crashed unless
714
714
  if (share->crashed)
715
715
    return(HA_ERR_CRASHED_ON_USAGE);
716
716
 
717
 
  pthread_mutex_lock(&share->mutex);
 
717
  pthread_mutex_lock(&share->mutex());
718
718
 
719
719
  if (share->archive_write_open == false)
720
720
    if (init_archive_writer())
751
751
  share->rows_recorded++;
752
752
  rc= real_write_row(buf,  &(share->archive_write));
753
753
error:
754
 
  pthread_mutex_unlock(&share->mutex);
 
754
  pthread_mutex_unlock(&share->mutex());
755
755
  if (read_buf)
756
756
    free((unsigned char*) read_buf);
757
757
 
1152
1152
    If dirty, we lock, and then reset/flush the data.
1153
1153
    I found that just calling azflush() doesn't always work.
1154
1154
  */
1155
 
  pthread_mutex_lock(&share->mutex);
 
1155
  pthread_mutex_lock(&share->mutex());
1156
1156
  if (share->dirty == true)
1157
1157
  {
1158
1158
    azflush(&(share->archive_write), Z_SYNC_FLUSH);
1171
1171
    cause the number to be inaccurate.
1172
1172
  */
1173
1173
  stats.records= share->rows_recorded;
1174
 
  pthread_mutex_unlock(&share->mutex);
 
1174
  pthread_mutex_unlock(&share->mutex());
1175
1175
 
1176
1176
  scan_rows= stats.records;
1177
1177
  stats.deleted= 0;
1195
1195
  if (flag & HA_STATUS_AUTO)
1196
1196
  {
1197
1197
    init_archive_reader();
1198
 
    pthread_mutex_lock(&share->mutex);
 
1198
    pthread_mutex_lock(&share->mutex());
1199
1199
    azflush(&archive, Z_SYNC_FLUSH);
1200
 
    pthread_mutex_unlock(&share->mutex);
 
1200
    pthread_mutex_unlock(&share->mutex());
1201
1201
    stats.auto_increment_value= archive.auto_increment + 1;
1202
1202
  }
1203
1203
 
1252
1252
  old_proc_info= get_session_proc_info(session);
1253
1253
  set_session_proc_info(session, "Checking table");
1254
1254
  /* Flush any waiting data */
1255
 
  pthread_mutex_lock(&share->mutex);
 
1255
  pthread_mutex_lock(&share->mutex());
1256
1256
  azflush(&(share->archive_write), Z_SYNC_FLUSH);
1257
 
  pthread_mutex_unlock(&share->mutex);
 
1257
  pthread_mutex_unlock(&share->mutex());
1258
1258
 
1259
1259
  /*
1260
1260
    Now we will rewind the archive file so that we are positioned at the