~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/main.cc

  • Committer: Brian Aker
  • Date: 2010-09-28 06:27:36 UTC
  • mto: (1800.1.4 build)
  • mto: This revision was merged to the branch mainline in revision 1801.
  • Revision ID: brian@tangent.org-20100928062736-65a8ufnsji93fd99
Remove additional (maybe last of?) native_handle actual calls (safe_mutex is
historical and unused, so it does not count).

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
#include "drizzled/tztime.h"
60
60
#include "drizzled/signal_handler.h"
61
61
#include "drizzled/replication_services.h"
62
 
#include "drizzled/transaction_services.h"
63
62
 
64
63
using namespace drizzled;
65
64
using namespace std;
210
209
  case google::protobuf::LOGLEVEL_ERROR:
211
210
  case google::protobuf::LOGLEVEL_FATAL:
212
211
  default:
213
 
    std::cerr << "GoogleProtoErrorThrower(" << filename << ", " << line << ", " << message << ")";
214
212
    throw("error in google protocol buffer parsing");
215
213
  }
216
214
}
238
236
  google::protobuf::SetLogHandler(&GoogleProtoErrorThrower);
239
237
 
240
238
  /* Function generates error messages before abort */
241
 
  error_handler_hook= my_message_sql;
242
239
  /* init_common_variables must get basic settings such as data_home_dir
243
240
     and plugin_load_list. */
244
 
  if (init_common_variables(argc, argv, modules))
 
241
  if (init_common_variables(argc, argv))
245
242
    unireg_abort(1);                            // Will do exit
246
243
 
247
 
  /*
248
 
    init signals & alarm
249
 
    After this we can't quit by a simple unireg_abort
250
 
  */
251
244
  init_signals();
252
245
 
253
246
 
256
249
 
257
250
  if (not opt_help)
258
251
  {
259
 
    if (chdir(getDataHome().file_string().c_str()))
 
252
    if (chdir(getDataHome().c_str()))
260
253
    {
261
254
      errmsg_printf(ERRMSG_LVL_ERROR,
262
255
                    _("Data directory %s does not exist\n"),
263
 
                    getDataHome().file_string().c_str());
 
256
                    getDataHome().c_str());
264
257
      unireg_abort(1);
265
258
    }
266
259
    if (mkdir("local", 0700))
271
264
    {
272
265
      errmsg_printf(ERRMSG_LVL_ERROR,
273
266
                    _("Local catalog %s/local does not exist\n"),
274
 
                    getDataHome().file_string().c_str());
 
267
                    getDataHome().c_str());
275
268
      unireg_abort(1);
276
269
    }
277
 
 
278
 
    full_data_home= fs::system_complete(getDataHome());
 
270
    /* TODO: This is a hack until we can properly support std::string in sys_var*/
 
271
    char **data_home_ptr= getDatadirPtr();
 
272
    *data_home_ptr= new char[getDataHome().size()+1] ();
 
273
    fs::path full_data_home_path(fs::system_complete(fs::path(getDataHome())));
 
274
    std::string full_data_home(full_data_home_path.file_string());
 
275
    memcpy(*data_home_ptr, full_data_home.c_str(), full_data_home.size());
279
276
    getDataHomeCatalog()= "./";
280
277
    getDataHome()= "../";
281
278
  }
307
304
  if (plugin::Listen::setup())
308
305
    unireg_abort(1);
309
306
 
 
307
  /*
 
308
    init signals & alarm
 
309
    After this we can't quit by a simple unireg_abort
 
310
  */
 
311
  error_handler_hook= my_message_sql;
310
312
 
311
313
  assert(plugin::num_trx_monitored_objects > 0);
312
314
  if (drizzle_rm_tmp_tables() ||
316
318
    select_thread_in_use=0;
317
319
    (void) pthread_kill(signal_thread, SIGTERM);
318
320
 
319
 
    (void) unlink(pid_file.file_string().c_str());      // Not needed anymore
 
321
    (void) unlink(pidfile_name);        // Not needed anymore
320
322
 
321
323
    exit(1);
322
324
  }
325
327
                PANDORA_RELEASE_VERSION, COMPILATION_COMMENT);
326
328
 
327
329
 
328
 
  TransactionServices &transaction_services= TransactionServices::singleton();
329
 
 
330
 
  /* Send server startup event */
331
 
  if ((session= new Session(plugin::Listen::getNullClient())))
332
 
  {
333
 
    transaction_services.sendStartupEvent(session);
334
 
    session->lockForDelete();
335
 
    delete session;
336
 
  }
337
 
 
338
 
 
339
330
  /* Listen for new connections and start new session for each connection
340
331
     accepted. The listen.getClient() method will return NULL when the server
341
332
     should be shutdown. */
352
343
      Session::unlink(session);
353
344
  }
354
345
 
355
 
  /* Send server shutdown event */
356
 
  if ((session= new Session(plugin::Listen::getNullClient())))
357
 
  {
358
 
    transaction_services.sendShutdownEvent(session);
359
 
    session->lockForDelete();
360
 
    delete session;
361
 
  }
362
 
 
363
346
  LOCK_thread_count.lock();
364
347
  select_thread_in_use=0;                       // For close_connections
365
348
  LOCK_thread_count.unlock();