~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/transaction_log/module.cc

Merge replication-pairs

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
 * in truncating the log file. 
62
62
 */
63
63
static bool sysvar_transaction_log_truncate_debug= false;
 
64
/**
 
65
 * The name of the main transaction log file on disk.  With no prefix,
 
66
 * this goes into Drizzle's $datadir.
 
67
 */
64
68
static const char DEFAULT_LOG_FILE_PATH[]= "transaction.log"; /* In datadir... */
65
69
/** 
66
70
 * Transaction Log plugin system variable - Should we write a CRC32 checksum for 
76
80
 * TransactionLog::SYNC_METHOD_EVERY_SECOND == 2  ... sync at most once a second
77
81
 */
78
82
static uint32_t sysvar_transaction_log_sync_method= 0;
 
83
/**
 
84
 * Transaction Log plugin system variable - Number of slots to create
 
85
 * for managing write buffers
 
86
 */
 
87
static uint32_t sysvar_transaction_log_num_write_buffers= 8;
 
88
/**
 
89
 * Transaction Log plugin system variable - The name of the replicator plugin
 
90
 * to pair the transaction log's applier with.  Defaults to "default"
 
91
 */
 
92
static char *sysvar_transaction_log_use_replicator= NULL;
 
93
static const char DEFAULT_USE_REPLICATOR[]= "default";
79
94
 
80
95
/** DATA_DICTIONARY views */
81
96
static TransactionLogTool *transaction_log_tool;
99
114
  if (sysvar_transaction_log_enabled)
100
115
  {
101
116
    transaction_log= new (nothrow) TransactionLog(string(sysvar_transaction_log_file),
102
 
                                                  sysvar_transaction_log_sync_method);
 
117
                                                  sysvar_transaction_log_sync_method,
 
118
                                                  sysvar_transaction_log_checksum_enabled);
103
119
 
104
120
    if (transaction_log == NULL)
105
121
    {
120
136
    /* Create the applier plugin and register it */
121
137
    transaction_log_applier= new (nothrow) TransactionLogApplier("transaction_log_applier",
122
138
                                                                 *transaction_log, 
123
 
                                                                 sysvar_transaction_log_checksum_enabled);
 
139
                                                                 sysvar_transaction_log_num_write_buffers);
124
140
    if (transaction_log_applier == NULL)
125
141
    {
126
142
      errmsg_printf(ERRMSG_LVL_ERROR, _("Failed to allocate the TransactionLogApplier instance.  Got error: %s\n"), 
128
144
      return 1;
129
145
    }
130
146
    context.add(transaction_log_applier);
 
147
    ReplicationServices &replication_services= ReplicationServices::singleton();
 
148
    string replicator_name(sysvar_transaction_log_use_replicator);
 
149
    replication_services.attachApplier(transaction_log_applier, replicator_name);
131
150
 
132
151
    /* Setup DATA_DICTIONARY views */
133
152
 
212
231
                           set_truncate_debug, /* update func */
213
232
                           false /* default */);
214
233
 
215
 
static DRIZZLE_SYSVAR_STR(log_file,
 
234
static DRIZZLE_SYSVAR_STR(file,
216
235
                          sysvar_transaction_log_file,
217
236
                          PLUGIN_VAR_READONLY,
218
237
                          N_("Path to the file to use for transaction log"),
220
239
                          NULL, /* update func*/
221
240
                          DEFAULT_LOG_FILE_PATH /* default */);
222
241
 
 
242
static DRIZZLE_SYSVAR_STR(use_replicator,
 
243
                          sysvar_transaction_log_use_replicator,
 
244
                          PLUGIN_VAR_READONLY,
 
245
                          N_("Name of the replicator plugin to use (default='default_replicator')"),
 
246
                          NULL, /* check func */
 
247
                          NULL, /* update func*/
 
248
                          DEFAULT_USE_REPLICATOR /* default */);
 
249
 
223
250
static DRIZZLE_SYSVAR_BOOL(enable_checksum,
224
251
                           sysvar_transaction_log_checksum_enabled,
225
252
                           PLUGIN_VAR_NOCMDARG,
241
268
                           2,
242
269
                           0);
243
270
 
 
271
static DRIZZLE_SYSVAR_UINT(num_write_buffers,
 
272
                           sysvar_transaction_log_num_write_buffers,
 
273
                           PLUGIN_VAR_OPCMDARG,
 
274
                           N_("Number of slots for in-memory write buffers (default=8)."),
 
275
                           NULL, /* check func */
 
276
                           NULL, /* update func */
 
277
                           8, /* default */
 
278
                           4,
 
279
                           8192,
 
280
                           0);
 
281
 
244
282
static drizzle_sys_var* sys_variables[]= {
245
283
  DRIZZLE_SYSVAR(enable),
246
284
  DRIZZLE_SYSVAR(truncate_debug),
247
 
  DRIZZLE_SYSVAR(log_file),
 
285
  DRIZZLE_SYSVAR(file),
248
286
  DRIZZLE_SYSVAR(enable_checksum),
249
287
  DRIZZLE_SYSVAR(sync_method),
 
288
  DRIZZLE_SYSVAR(num_write_buffers),
 
289
  DRIZZLE_SYSVAR(use_replicator),
250
290
  NULL
251
291
};
252
292