~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/transaction_log/module.cc

  • Committer: Andrew Hutchings
  • Date: 2010-09-08 19:03:09 UTC
  • mfrom: (1750 staging)
  • mto: (1750.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1751.
  • Revision ID: andrew@linuxjedi.co.uk-20100908190309-mya1nu7xvo1fpvk8
Merge trunk into branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
 
56
56
/** 
57
57
 * Transaction Log plugin system variable - Is the log enabled? Only used on init().  
58
 
 * The enable() and disable() methods of the TransactionLog class control online
59
 
 * disabling.
60
58
 */
61
59
static bool sysvar_transaction_log_enabled= false;
62
60
/** Transaction Log plugin system variable - The path to the log file used */
80
78
 * Numeric option controlling the sync/flush behaviour of the transaction
81
79
 * log.  Options are:
82
80
 *
83
 
 * TransactionLog::SYNC_METHOD_OS == 0            ... let OS do sync'ing
84
 
 * TransactionLog::SYNC_METHOD_EVERY_WRITE == 1   ... sync on every write
85
 
 * TransactionLog::SYNC_METHOD_EVERY_SECOND == 2  ... sync at most once a second
 
81
 * TransactionLog::FLUSH_FREQUENCY_OS == 0            ... let OS do sync'ing
 
82
 * TransactionLog::FLUSH_FREQUENCY_EVERY_WRITE == 1   ... sync on every write
 
83
 * TransactionLog::FLUSH_FREQUENCY_EVERY_SECOND == 2  ... sync at most once a second
86
84
 */
87
 
static uint32_t sysvar_transaction_log_sync_method= 0;
 
85
static uint32_t sysvar_transaction_log_flush_frequency= 0;
88
86
/**
89
87
 * Transaction Log plugin system variable - Number of slots to create
90
88
 * for managing write buffers
130
128
{
131
129
  const module::option_map &vm= context.getOptions();
132
130
 
133
 
  if (vm.count("sync-method"))
 
131
  if (vm.count("flush-frequency"))
134
132
  {
135
 
    if (sysvar_transaction_log_sync_method > 2)
 
133
    if (sysvar_transaction_log_flush_frequency > 2)
136
134
    {
137
135
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for sync-method\n"));
138
136
      exit(-1);
172
170
  if (sysvar_transaction_log_enabled)
173
171
  {
174
172
    transaction_log= new (nothrow) TransactionLog(string(sysvar_transaction_log_file),
175
 
                                                  sysvar_transaction_log_sync_method,
 
173
                                                  sysvar_transaction_log_flush_frequency,
176
174
                                                  sysvar_transaction_log_checksum_enabled);
177
175
 
178
176
    if (transaction_log == NULL)
283
281
 
284
282
static DRIZZLE_SYSVAR_BOOL(enable,
285
283
                           sysvar_transaction_log_enabled,
286
 
                           PLUGIN_VAR_NOCMDARG,
 
284
                           PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
287
285
                           N_("Enable transaction log"),
288
286
                           NULL, /* check func */
289
287
                           NULL, /* update func */
321
319
                           NULL, /* update func */
322
320
                           false /* default */);
323
321
 
324
 
static DRIZZLE_SYSVAR_UINT(sync_method,
325
 
                           sysvar_transaction_log_sync_method,
 
322
static DRIZZLE_SYSVAR_UINT(flush_frequency,
 
323
                           sysvar_transaction_log_flush_frequency,
326
324
                           PLUGIN_VAR_OPCMDARG,
327
325
                           N_("0 == rely on operating system to sync log file (default), "
328
326
                              "1 == sync file at each transaction write, "
362
360
  context("use-replicator",
363
361
          po::value<string>(),
364
362
          N_("Name of the replicator plugin to use (default='default_replicator')")); 
365
 
  context("sync-method",
366
 
          po::value<uint32_t>(&sysvar_transaction_log_sync_method)->default_value(0),
 
363
  context("flush-frequency",
 
364
          po::value<uint32_t>(&sysvar_transaction_log_flush_frequency)->default_value(0),
367
365
          N_("0 == rely on operating system to sync log file (default), 1 == sync file at each transaction write, 2 == sync log file once per second"));
368
366
  context("num-write-buffers",
369
367
          po::value<uint32_t>(&sysvar_transaction_log_num_write_buffers)->default_value(8),
375
373
  DRIZZLE_SYSVAR(truncate_debug),
376
374
  DRIZZLE_SYSVAR(file),
377
375
  DRIZZLE_SYSVAR(enable_checksum),
378
 
  DRIZZLE_SYSVAR(sync_method),
 
376
  DRIZZLE_SYSVAR(flush_frequency),
379
377
  DRIZZLE_SYSVAR(num_write_buffers),
380
378
  DRIZZLE_SYSVAR(use_replicator),
381
379
  NULL