~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/archive/ha_archive.cc

Merged in Jay's tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
118
118
                     uchar **frmblob, 
119
119
                     size_t *frmlen);
120
120
 
121
 
static my_bool archive_use_aio= FALSE;
 
121
static my_bool archive_use_aio= false;
122
122
 
123
123
/*
124
124
  Number of rows that will force a bulk insert.
156
156
    void *
157
157
 
158
158
  RETURN
159
 
    FALSE       OK
160
 
    TRUE        Error
 
159
    false       OK
 
160
    true        Error
161
161
*/
162
162
 
163
163
int archive_db_init(void *p)
184
184
  }
185
185
  else
186
186
  {
187
 
    DBUG_RETURN(FALSE);
 
187
    DBUG_RETURN(false);
188
188
  }
189
189
error:
190
 
  DBUG_RETURN(TRUE);
 
190
  DBUG_RETURN(true);
191
191
}
192
192
 
193
193
/*
198
198
    void
199
199
 
200
200
  RETURN
201
 
    FALSE       OK
 
201
    false       OK
202
202
*/
203
203
 
204
204
int archive_db_done(void *p __attribute__((__unused__)))
218
218
 
219
219
  /* The size of the offset value we will use for position() */
220
220
  ref_length= sizeof(my_off_t);
221
 
  archive_reader_open= FALSE;
 
221
  archive_reader_open= false;
222
222
}
223
223
 
224
224
int archive_discover(handlerton *hton __attribute__((__unused__)),
315
315
    share->use_count= 0;
316
316
    share->table_name_length= length;
317
317
    share->table_name= tmp_name;
318
 
    share->crashed= FALSE;
319
 
    share->archive_write_open= FALSE;
 
318
    share->crashed= false;
 
319
    share->archive_write_open= false;
320
320
    fn_format(share->data_file_name, table_name, "",
321
321
              ARZ, MY_REPLACE_EXT | MY_UNPACK_FILENAME);
322
322
    strmov(share->table_name, table_name);
393
393
      Since we will close the data down after this, we go on and count
394
394
      the flush on close;
395
395
    */
396
 
    if (share->archive_write_open == TRUE)
 
396
    if (share->archive_write_open == true)
397
397
    {
398
398
      if (azclose(&(share->archive_write)))
399
399
        rc= 1;
417
417
               O_RDWR|O_BINARY, AZ_METHOD_BLOCK)))
418
418
  {
419
419
    DBUG_PRINT("ha_archive", ("Could not open archive write file"));
420
 
    share->crashed= TRUE;
 
420
    share->crashed= true;
421
421
    DBUG_RETURN(1);
422
422
  }
423
 
  share->archive_write_open= TRUE;
 
423
  share->archive_write_open= true;
424
424
 
425
425
  DBUG_RETURN(0);
426
426
}
437
437
    a gzip file that can be both read and written we keep a writer open
438
438
    that is shared amoung all open tables.
439
439
  */
440
 
  if (archive_reader_open == FALSE)
 
440
  if (archive_reader_open == false)
441
441
  {
442
442
    az_method method;
443
443
 
444
444
    switch (archive_use_aio)
445
445
    {
446
 
    case FALSE:
 
446
    case false:
447
447
      method= AZ_METHOD_BLOCK;
448
448
      break;
449
 
    case TRUE:
 
449
    case true:
450
450
      method= AZ_METHOD_AIO;
451
451
      break;
452
452
    default:
456
456
                 method)))
457
457
    {
458
458
      DBUG_PRINT("ha_archive", ("Could not open archive read file"));
459
 
      share->crashed= TRUE;
 
459
      share->crashed= true;
460
460
      DBUG_RETURN(1);
461
461
    }
462
 
    archive_reader_open= TRUE;
 
462
    archive_reader_open= true;
463
463
  }
464
464
 
465
465
  DBUG_RETURN(0);
558
558
  destroy_record_buffer(record_buffer);
559
559
 
560
560
  /* First close stream */
561
 
  if (archive_reader_open == TRUE)
 
561
  if (archive_reader_open == true)
562
562
  {
563
563
    if (azclose(&archive))
564
564
      rc= 1;
724
724
  }
725
725
 
726
726
  if (!delayed_insert || !bulk_insert)
727
 
    share->dirty= TRUE;
 
727
    share->dirty= true;
728
728
 
729
729
  DBUG_RETURN(0);
730
730
}
805
805
    table->timestamp_field->set_time();
806
806
  pthread_mutex_lock(&share->mutex);
807
807
 
808
 
  if (share->archive_write_open == FALSE)
 
808
  if (share->archive_write_open == false)
809
809
    if (init_archive_writer())
810
810
      DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
811
811
 
900
900
                                    uint64_t *first_value __attribute__((__unused__)),
901
901
                                    uint64_t *nb_reserved_values __attribute__((__unused__)))
902
902
{
903
 
  *nb_reserved_values= ULONGLONG_MAX;
 
903
  *nb_reserved_values= UINT64_MAX;
904
904
  *first_value= share->archive_write.auto_increment + 1;
905
905
}
906
906
 
941
941
 
942
942
  DBUG_ENTER("ha_archive::index_read_idx");
943
943
 
944
 
  rc= rnd_init(TRUE);
 
944
  rc= rnd_init(true);
945
945
 
946
946
  if (rc)
947
947
    goto error;
1167
1167
  if (rc)
1168
1168
    DBUG_RETURN(HA_ERR_CRASHED_ON_REPAIR);
1169
1169
 
1170
 
  share->crashed= FALSE;
 
1170
  share->crashed= false;
1171
1171
  DBUG_RETURN(0);
1172
1172
}
1173
1173
 
1189
1189
  if (share->archive_write_open)
1190
1190
  {
1191
1191
    azclose(&(share->archive_write));
1192
 
    share->archive_write_open= FALSE;
 
1192
    share->archive_write_open= false;
1193
1193
  }
1194
1194
 
1195
1195
  /* Lets create a file to contain the new data */
1272
1272
  } 
1273
1273
 
1274
1274
  azclose(&writer);
1275
 
  share->dirty= FALSE;
 
1275
  share->dirty= false;
1276
1276
  
1277
1277
  azclose(&archive);
1278
1278
 
1296
1296
                                       enum thr_lock_type lock_type)
1297
1297
{
1298
1298
  if (lock_type == TL_WRITE_DELAYED)
1299
 
    delayed_insert= TRUE;
 
1299
    delayed_insert= true;
1300
1300
  else
1301
 
    delayed_insert= FALSE;
 
1301
    delayed_insert= false;
1302
1302
 
1303
1303
  if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK) 
1304
1304
  {
1362
1362
    I found that just calling azflush() doesn't always work.
1363
1363
  */
1364
1364
  pthread_mutex_lock(&share->mutex);
1365
 
  if (share->dirty == TRUE)
 
1365
  if (share->dirty == true)
1366
1366
  {
1367
1367
    DBUG_PRINT("ha_archive", ("archive flushing out rows for scan"));
1368
1368
    azflush(&(share->archive_write), Z_SYNC_FLUSH);
1369
1369
    share->rows_recorded= share->archive_write.rows;
1370
 
    share->dirty= FALSE;
 
1370
    share->dirty= false;
1371
1371
    if (share->version < global_version)
1372
1372
    {
1373
1373
      share->version_rows= share->rows_recorded;
1426
1426
{
1427
1427
  DBUG_ENTER("ha_archive::start_bulk_insert");
1428
1428
  if (!rows || rows >= ARCHIVE_MIN_ROWS_TO_USE_BULK_INSERT)
1429
 
    bulk_insert= TRUE;
 
1429
    bulk_insert= true;
1430
1430
  DBUG_VOID_RETURN;
1431
1431
}
1432
1432
 
1438
1438
int ha_archive::end_bulk_insert()
1439
1439
{
1440
1440
  DBUG_ENTER("ha_archive::end_bulk_insert");
1441
 
  bulk_insert= FALSE;
1442
 
  share->dirty= TRUE;
 
1441
  bulk_insert= false;
 
1442
  share->dirty= true;
1443
1443
  DBUG_RETURN(0);
1444
1444
}
1445
1445
 
1500
1500
 
1501
1501
  if ((rc && rc != HA_ERR_END_OF_FILE))  
1502
1502
  {
1503
 
    share->crashed= FALSE;
 
1503
    share->crashed= false;
1504
1504
    DBUG_RETURN(HA_ADMIN_CORRUPT);
1505
1505
  }
1506
1506
  else
1555
1555
static MYSQL_SYSVAR_BOOL(aio, archive_use_aio,
1556
1556
  PLUGIN_VAR_NOCMDOPT,
1557
1557
  "Whether or not to use asynchronous IO.",
1558
 
  NULL, NULL, TRUE);
 
1558
  NULL, NULL, true);
1559
1559
 
1560
1560
static struct st_mysql_sys_var* archive_system_variables[]= {
1561
1561
  MYSQL_SYSVAR(aio),