~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/archive/ha_archive.cc

  • Committer: Brian Aker
  • Date: 2008-10-20 04:28:21 UTC
  • mto: (492.3.21 drizzle-clean-code)
  • mto: This revision was merged to the branch mainline in revision 530.
  • Revision ID: brian@tangent.org-20081020042821-rqqdrccuu8195k3y
Second pass of thd cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
static handler *archive_create_handler(handlerton *hton, 
102
102
                                       TABLE_SHARE *table, 
103
103
                                       MEM_ROOT *mem_root);
104
 
int archive_discover(handlerton *hton, Session* thd, const char *db, 
 
104
int archive_discover(handlerton *hton, Session* session, const char *db, 
105
105
                     const char *name,
106
106
                     unsigned char **frmblob, 
107
107
                     size_t *frmlen);
208
208
}
209
209
 
210
210
int archive_discover(handlerton *hton __attribute__((unused)),
211
 
                     Session* thd __attribute__((unused)),
 
211
                     Session* session __attribute__((unused)),
212
212
                     const char *db,
213
213
                     const char *name,
214
214
                     unsigned char **frmblob,
1069
1069
  rewriting the meta file. Currently it does this by calling optimize with
1070
1070
  the extended flag.
1071
1071
*/
1072
 
int ha_archive::repair(Session* thd, HA_CHECK_OPT* check_opt)
 
1072
int ha_archive::repair(Session* session, HA_CHECK_OPT* check_opt)
1073
1073
{
1074
1074
  check_opt->flags= T_EXTEND;
1075
 
  int rc= optimize(thd, check_opt);
 
1075
  int rc= optimize(session, check_opt);
1076
1076
 
1077
1077
  if (rc)
1078
1078
    return(HA_ERR_CRASHED_ON_REPAIR);
1085
1085
  The table can become fragmented if data was inserted, read, and then
1086
1086
  inserted again. What we do is open up the file and recompress it completely. 
1087
1087
*/
1088
 
int ha_archive::optimize(Session* thd __attribute__((unused)),
 
1088
int ha_archive::optimize(Session* session __attribute__((unused)),
1089
1089
                         HA_CHECK_OPT* check_opt __attribute__((unused)))
1090
1090
{
1091
1091
  int rc= 0;
1189
1189
/* 
1190
1190
  Below is an example of how to setup row level locking.
1191
1191
*/
1192
 
THR_LOCK_DATA **ha_archive::store_lock(Session *thd,
 
1192
THR_LOCK_DATA **ha_archive::store_lock(Session *session,
1193
1193
                                       THR_LOCK_DATA **to,
1194
1194
                                       enum thr_lock_type lock_type)
1195
1195
{
1208
1208
    */
1209
1209
 
1210
1210
    if ((lock_type >= TL_WRITE_CONCURRENT_INSERT &&
1211
 
         lock_type <= TL_WRITE) && !thd_in_lock_tables(thd)
1212
 
        && !thd_tablespace_op(thd))
 
1211
         lock_type <= TL_WRITE) && !session_in_lock_tables(session)
 
1212
        && !session_tablespace_op(session))
1213
1213
      lock_type = TL_WRITE_ALLOW_WRITE;
1214
1214
 
1215
1215
    /* 
1220
1220
      concurrent inserts to t2. 
1221
1221
    */
1222
1222
 
1223
 
    if (lock_type == TL_READ_NO_INSERT && !thd_in_lock_tables(thd)) 
 
1223
    if (lock_type == TL_READ_NO_INSERT && !session_in_lock_tables(session)) 
1224
1224
      lock_type = TL_READ;
1225
1225
 
1226
1226
    lock.type=lock_type;
1355
1355
  Simple scan of the tables to make sure everything is ok.
1356
1356
*/
1357
1357
 
1358
 
int ha_archive::check(Session* thd,
 
1358
int ha_archive::check(Session* session,
1359
1359
                      HA_CHECK_OPT* check_opt __attribute__((unused)))
1360
1360
{
1361
1361
  int rc= 0;
1362
1362
  const char *old_proc_info;
1363
1363
  uint64_t x;
1364
1364
 
1365
 
  old_proc_info= get_thd_proc_info(thd);
1366
 
  set_thd_proc_info(thd, "Checking table");
 
1365
  old_proc_info= get_session_proc_info(session);
 
1366
  set_session_proc_info(session, "Checking table");
1367
1367
  /* Flush any waiting data */
1368
1368
  pthread_mutex_lock(&share->mutex);
1369
1369
  azflush(&(share->archive_write), Z_SYNC_FLUSH);
1384
1384
      break;
1385
1385
  }
1386
1386
 
1387
 
  set_thd_proc_info(thd, old_proc_info);
 
1387
  set_session_proc_info(session, old_proc_info);
1388
1388
 
1389
1389
  if ((rc && rc != HA_ERR_END_OF_FILE))  
1390
1390
  {
1400
1400
/*
1401
1401
  Check and repair the table if needed.
1402
1402
*/
1403
 
bool ha_archive::check_and_repair(Session *thd) 
 
1403
bool ha_archive::check_and_repair(Session *session) 
1404
1404
{
1405
1405
  HA_CHECK_OPT check_opt;
1406
1406
 
1407
1407
  check_opt.init();
1408
1408
 
1409
 
  return(repair(thd, &check_opt));
 
1409
  return(repair(session, &check_opt));
1410
1410
}
1411
1411
 
1412
1412
archive_record_buffer *ha_archive::create_record_buffer(unsigned int length)