~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/transaction_log/module.cc

  • Committer: Brian Aker
  • Date: 2011-01-12 06:45:23 UTC
  • mto: (2073.1.4 catalogs)
  • mto: This revision was merged to the branch mainline in revision 2080.
  • Revision ID: brian@tangent.org-20110112064523-rqhptaqbph22qmj1
RemoveĀ customĀ error.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 * registration.
31
31
 */
32
32
 
33
 
#include <config.h>
 
33
#include "config.h"
34
34
 
35
35
#include "transaction_log.h"
36
36
#include "transaction_log_applier.h"
38
38
#include "data_dictionary_schema.h"
39
39
#include "print_transaction_message.h"
40
40
#include "hexdump_transaction_message.h"
 
41
#include "background_worker.h"
41
42
 
42
43
#include <errno.h>
43
44
 
165
166
 
166
167
    if (transaction_log == NULL)
167
168
    {
168
 
      sql_perror(_("Failed to allocate the TransactionLog instance"), sysvar_transaction_log_file);
 
169
      char errmsg[STRERROR_MAX];
 
170
      strerror_r(errno, errmsg, sizeof(errmsg));
 
171
      errmsg_printf(ERRMSG_LVL_ERROR, _("Failed to allocate the TransactionLog instance.  Got error: %s\n"), 
 
172
                    errmsg);
169
173
      return 1;
170
174
    }
171
175
    else
173
177
      /* Check to see if the log was not created properly */
174
178
      if (transaction_log->hasError())
175
179
      {
176
 
        errmsg_printf(error::ERROR, _("Failed to initialize the Transaction Log.  Got error: %s\n"), 
 
180
        errmsg_printf(ERRMSG_LVL_ERROR, _("Failed to initialize the Transaction Log.  Got error: %s\n"), 
177
181
                      transaction_log->getErrorMessage().c_str());
178
182
        return 1;
179
183
      }
183
187
    transaction_log_index= new (nothrow) TransactionLogIndex(*transaction_log);
184
188
    if (transaction_log_index == NULL)
185
189
    {
186
 
      sql_perror(_("Failed to allocate the TransactionLogIndex instance"), sysvar_transaction_log_file);
 
190
      char errmsg[STRERROR_MAX];
 
191
      strerror_r(errno, errmsg, sizeof(errmsg));
 
192
      errmsg_printf(ERRMSG_LVL_ERROR, _("Failed to allocate the TransactionLogIndex instance.  Got error: %s\n"), 
 
193
                    errmsg);
187
194
      return 1;
188
195
    }
189
196
    else
191
198
      /* Check to see if the index was not created properly */
192
199
      if (transaction_log_index->hasError())
193
200
      {
194
 
        errmsg_printf(error::ERROR, _("Failed to initialize the Transaction Log Index.  Got error: %s\n"), 
 
201
        errmsg_printf(ERRMSG_LVL_ERROR, _("Failed to initialize the Transaction Log Index.  Got error: %s\n"), 
195
202
                      transaction_log_index->getErrorMessage().c_str());
196
203
        return 1;
197
204
      }
204
211
                                                                 static_cast<uint32_t>(sysvar_transaction_log_num_write_buffers));
205
212
    if (transaction_log_applier == NULL)
206
213
    {
207
 
      sql_perror(_("Failed to allocate the TransactionLogApplier instance"), sysvar_transaction_log_file);
 
214
      char errmsg[STRERROR_MAX];
 
215
      strerror_r(errno, errmsg, sizeof(errmsg));
 
216
      errmsg_printf(ERRMSG_LVL_ERROR, _("Failed to allocate the TransactionLogApplier instance.  Got error: %s\n"), 
 
217
                    errmsg);
208
218
      return 1;
209
219
    }
210
220
    context.add(transaction_log_applier);
229
239
    hexdump_transaction_message_func_factory=
230
240
      new plugin::Create_function<HexdumpTransactionMessageFunction>("hexdump_transaction_message");
231
241
    context.add(hexdump_transaction_message_func_factory);
 
242
 
 
243
    /* 
 
244
     * Setup the background worker thread which maintains
 
245
     * summary information about the transaction log.
 
246
     */
 
247
    if (initTransactionLogBackgroundWorker())
 
248
      return 1; /* Error message output handled in function above */
232
249
  }
233
250
  return 0;
234
251
}