~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/drizzled.cc

  • Committer: Brian Aker
  • Date: 2009-10-02 19:38:12 UTC
  • mfrom: (1152.1.7 merge)
  • Revision ID: brian@gaz-20091002193812-mpd61oecep74t6gd
Merge Monty + Brian for plugins.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
#include <drizzled/session.h>
40
40
#include <drizzled/db.h>
41
41
#include <drizzled/item/create.h>
42
 
#include <drizzled/errmsg.h>
43
42
#include <drizzled/unireg.h>
44
 
#include <drizzled/scheduling.h>
45
43
#include "drizzled/temporal_format.h" /* For init_temporal_formats() */
46
 
#include "drizzled/slot/listen.h"
 
44
#include "drizzled/plugin/listen.h"
 
45
#include "drizzled/plugin/error_message.h"
47
46
#include "drizzled/plugin/client.h"
 
47
#include "drizzled/plugin/scheduler.h"
48
48
#include "drizzled/probes.h"
49
49
 
50
50
#include <google/protobuf/stubs/common.h>
243
243
size_t my_thread_stack_size= 65536;
244
244
 
245
245
/*
246
 
  Legacy global StorageEngine. These will be removed (please do not add more).
 
246
  Legacy global plugin::StorageEngine. These will be removed (please do not add more).
247
247
*/
248
 
StorageEngine *heap_engine;
249
 
StorageEngine *myisam_engine;
 
248
plugin::StorageEngine *heap_engine;
 
249
plugin::StorageEngine *myisam_engine;
250
250
 
251
251
char* opt_secure_file_priv= 0;
252
252
 
395
395
drizzled::atomic<uint32_t> refresh_version;  /* Increments on each reload */
396
396
 
397
397
/* Function declarations */
398
 
bool drizzle_rm_tmp_tables(drizzled::slot::Listen &listen);
 
398
bool drizzle_rm_tmp_tables();
399
399
 
400
400
extern "C" pthread_handler_t signal_hand(void *arg);
401
401
static void drizzle_init_variables(void);
419
419
 
420
420
void close_connections(void)
421
421
{
422
 
  plugin::Registry &plugins= plugin::Registry::singleton();
423
 
 
424
422
  /* Abort listening to new connections */
425
 
  plugins.listen.shutdown();
 
423
  plugin::Listen::shutdown();
426
424
 
427
425
  /* kill connection thread */
428
426
  (void) pthread_mutex_lock(&LOCK_thread_count);
1391
1389
    scheduler_name= opt_scheduler_default;
1392
1390
  }
1393
1391
 
1394
 
  if (set_scheduler_factory(scheduler_name))
 
1392
  if (plugin::Scheduler::setPlugin(scheduler_name))
1395
1393
  {
1396
1394
      errmsg_printf(ERRMSG_LVL_ERROR,
1397
1395
                   _("No scheduler found, cannot continue!\n"));
1411
1409
  */
1412
1410
  const std::string myisam_engine_name("MyISAM");
1413
1411
  const std::string heap_engine_name("MEMORY");
1414
 
  myisam_engine= ha_resolve_by_name(NULL, myisam_engine_name);
1415
 
  heap_engine= ha_resolve_by_name(NULL, heap_engine_name);
 
1412
  myisam_engine= plugin::StorageEngine::findByName(NULL, myisam_engine_name);
 
1413
  heap_engine= plugin::StorageEngine::findByName(NULL, heap_engine_name);
1416
1414
 
1417
1415
  /*
1418
1416
    Check that the default storage engine is actually available.
1420
1418
  if (default_storage_engine_str)
1421
1419
  {
1422
1420
    const std::string name(default_storage_engine_str);
1423
 
    StorageEngine *engine;
 
1421
    plugin::StorageEngine *engine;
1424
1422
 
1425
 
    engine= ha_resolve_by_name(0, name);
 
1423
    engine= plugin::StorageEngine::findByName(0, name);
1426
1424
    if (engine == NULL)
1427
1425
    {
1428
1426
      errmsg_printf(ERRMSG_LVL_ERROR, _("Unknown/unsupported table type: %s"),
1446
1444
    }
1447
1445
  }
1448
1446
 
1449
 
  if (ha_recover(0))
 
1447
  if (plugin::StorageEngine::recover(0))
1450
1448
  {
1451
1449
    unireg_abort(1);
1452
1450
  }
1539
1537
 
1540
1538
  set_default_port();
1541
1539
 
1542
 
  if (plugins.listen.setup())
 
1540
  if (plugin::Listen::setup())
1543
1541
    unireg_abort(1);
1544
1542
 
1545
1543
  /*
1548
1546
  */
1549
1547
  error_handler_hook= my_message_sql;
1550
1548
 
1551
 
  if (drizzle_rm_tmp_tables(plugins.listen) ||
 
1549
  if (drizzle_rm_tmp_tables() ||
1552
1550
      my_tz_init((Session *)0, default_tz_name))
1553
1551
  {
1554
1552
    abort_loop= true;
1569
1567
  /* Listen for new connections and start new session for each connection
1570
1568
     accepted. The listen.getClient() method will return NULL when the server
1571
1569
     should be shutdown. */
1572
 
  while ((client= plugins.listen.getClient()) != NULL)
 
1570
  while ((client= plugin::Listen::getClient()) != NULL)
1573
1571
  {
1574
1572
    if (!(session= new Session(client)))
1575
1573
    {
2409
2407
  /* Don't print warnings for --loose options during bootstrap */
2410
2408
  if (level == ERROR_LEVEL || global_system_variables.log_warnings)
2411
2409
  {
2412
 
    errmsg_vprintf (current_session, ERROR_LEVEL, format, args);
 
2410
    plugin::ErrorMessage::vprintf(current_session, ERROR_LEVEL, format, args);
2413
2411
  }
2414
2412
  va_end(args);
2415
2413
}