~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/drizzled.cc

Merged trunk, fixed gearman_udf plugin to use new plugin system.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 */
19
19
 
20
20
 
 
21
#include <drizzled/server_includes.h>
21
22
#include <drizzled/configmake.h>
22
 
#include <drizzled/server_includes.h>
23
23
#include <drizzled/atomics.h>
24
24
 
25
25
#include <netdb.h>
57
57
# endif
58
58
#endif
59
59
 
60
 
#include <storage/myisam/ha_myisam.h>
 
60
#include <plugin/myisam/ha_myisam.h>
61
61
 
62
62
#ifdef HAVE_SYS_PRCTL_H
63
63
#include <sys/prctl.h>
222
222
 
223
223
/* static variables */
224
224
 
 
225
extern TYPELIB optimizer_use_mrr_typelib;
 
226
 
225
227
/* the default log output is log tables */
226
228
static bool volatile select_thread_in_use;
227
229
static bool volatile ready_to_exit;
249
251
int abort_pipe[2];
250
252
bool volatile shutdown_in_progress;
251
253
uint32_t max_used_connections;
252
 
const char *opt_scheduler= "multi_thread";
 
254
const string opt_scheduler_default("multi_thread");
 
255
char *opt_scheduler= NULL;
 
256
 
253
257
const char *opt_protocol= "oldlibdrizzle";
254
258
 
255
259
size_t my_thread_stack_size= 65536;
327
331
time_t server_start_time;
328
332
time_t flush_status_time;
329
333
 
330
 
/* FRM Junk */
331
 
const char *reg_ext= ".frm";
332
 
uint32_t reg_ext_length= 4;
333
 
 
334
334
char drizzle_home[FN_REFLEN], pidfile_name[FN_REFLEN], system_time_zone[30];
335
335
char *default_tz_name;
336
336
char glob_hostname[FN_REFLEN];
448
448
void close_connections(void)
449
449
{
450
450
  /* Abort listening to new connections */
451
 
  assert(write(abort_pipe[1], "\0", 1) == 1);
 
451
  ssize_t ret= write(abort_pipe[1], "\0", 1);
 
452
  assert(ret);
452
453
 
453
454
  /* kill connection thread */
454
455
  (void) pthread_mutex_lock(&LOCK_thread_count);
796
797
  struct addrinfo *next;
797
798
  struct addrinfo hints;
798
799
  int error;
799
 
  int ip_sock;
 
800
  int ip_sock= -1;
800
801
 
801
802
  set_ports();
802
803
 
1597
1598
    }
1598
1599
  }
1599
1600
 
 
1601
  string scheduler_name;
 
1602
  if (opt_scheduler)
 
1603
  {
 
1604
    scheduler_name= opt_scheduler;
 
1605
  }
 
1606
  else
 
1607
  {
 
1608
    scheduler_name= opt_scheduler_default;
 
1609
  }
 
1610
 
 
1611
  if (set_scheduler_factory(scheduler_name))
 
1612
  {
 
1613
      errmsg_printf(ERRMSG_LVL_ERROR,
 
1614
                   _("No scheduler found, cannot continue!\n"));
 
1615
      unireg_abort(1);
 
1616
  }
 
1617
 
1600
1618
  /* We have to initialize the storage engines before CSV logging */
1601
1619
  if (ha_init())
1602
1620
  {
2059
2077
  OPT_DEFAULT_TIME_ZONE,
2060
2078
  OPT_OPTIMIZER_SEARCH_DEPTH,
2061
2079
  OPT_SCHEDULER,
 
2080
  OPT_PROTOCOL,
2062
2081
  OPT_OPTIMIZER_PRUNE_LEVEL,
2063
2082
  OPT_AUTO_INCREMENT, OPT_AUTO_INCREMENT_OFFSET,
2064
2083
  OPT_ENABLE_LARGE_PAGES,
2069
2088
  OPT_PORT_OPEN_TIMEOUT,
2070
2089
  OPT_KEEP_FILES_ON_CREATE,
2071
2090
  OPT_SECURE_FILE_PRIV,
2072
 
  OPT_MIN_EXAMINED_ROW_LIMIT
 
2091
  OPT_MIN_EXAMINED_ROW_LIMIT,
 
2092
  OPT_OPTIMIZER_USE_MRR
2073
2093
};
2074
2094
 
2075
2095
 
2193
2213
      "DEFAULT, BACKUP, FORCE or QUICK."),
2194
2214
   (char**) &myisam_recover_options_str, (char**) &myisam_recover_options_str, 0,
2195
2215
   GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
2196
 
  {"old-alter-table", OPT_OLD_ALTER_TABLE,
2197
 
   N_("Use old, non-optimized alter table."),
2198
 
   (char**) &global_system_variables.old_alter_table,
2199
 
   (char**) &max_system_variables.old_alter_table, 0, GET_BOOL, NO_ARG,
2200
 
   0, 0, 0, 0, 0, 0},
2201
2216
  {"pid-file", OPT_PID_FILE,
2202
2217
   N_("Pid file used by safe_mysqld."),
2203
2218
   (char**) &pidfile_name_ptr, (char**) &pidfile_name_ptr, 0, GET_STR,
2440
2455
   (char**) &global_system_variables.optimizer_search_depth,
2441
2456
   (char**) &max_system_variables.optimizer_search_depth,
2442
2457
   0, GET_UINT, OPT_ARG, MAX_TABLES+1, 0, MAX_TABLES+2, 0, 1, 0},
 
2458
  {"optimizer_use_mrr", OPT_OPTIMIZER_USE_MRR,
 
2459
   N_("Should the Optmizer use MRR or not. "
 
2460
      "Valid values are auto, force and disable"),
 
2461
   0, 0, 0, GET_STR, REQUIRED_ARG, 0,
 
2462
   0, 0, 0, 0, 0},
2443
2463
  {"plugin_dir", OPT_PLUGIN_DIR,
2444
2464
   N_("Directory for plugins."),
2445
2465
   (char**) &opt_plugin_dir_ptr, (char**) &opt_plugin_dir_ptr, 0,
2446
2466
   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
2447
2467
  {"plugin_load", OPT_PLUGIN_LOAD,
2448
 
   N_("Optional colon (or semicolon) separated list of plugins to load,"
2449
 
      "where each plugin is identified by the name of the shared library. "
2450
 
      "[for example: --plugin_load=libmd5udf.so:libauth_pam.so]"),
 
2468
   N_("Optional comma separated list of plugins to load at starup."
 
2469
      "[for example: --plugin_load=crc32,logger_gearman]"),
2451
2470
   (char**) &opt_plugin_load, (char**) &opt_plugin_load, 0,
2452
2471
   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
2453
2472
  {"preload_buffer_size", OPT_PRELOAD_BUFFER_SIZE,
2455
2474
   (char**) &global_system_variables.preload_buff_size,
2456
2475
   (char**) &max_system_variables.preload_buff_size, 0, GET_ULL,
2457
2476
   REQUIRED_ARG, 32*1024L, 1024, 1024*1024*1024L, 0, 1, 0},
2458
 
  {"protocol", OPT_SCHEDULER,
 
2477
  {"protocol", OPT_PROTOCOL,
2459
2478
   N_("Select protocol to be used (by default oldlibdrizzle)."),
2460
2479
   (char**) &opt_protocol, (char**) &opt_protocol, 0,
2461
2480
   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
2493
2512
   GET_UINT, REQUIRED_ARG, 256*1024L, 64 /*IO_SIZE*2+MALLOC_OVERHEAD*/ ,
2494
2513
   UINT32_MAX, MALLOC_OVERHEAD, 1 /* Small lower limit to be able to test MRR */, 0},
2495
2514
  {"scheduler", OPT_SCHEDULER,
2496
 
   N_("Select scheduler to be used (by default pool-of-threads)."),
2497
 
   (char**) &opt_scheduler, (char**) &opt_scheduler, 0,
2498
 
   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 
2515
   N_("Select scheduler to be used (by default multi-thread)."),
 
2516
   (char**)&opt_scheduler, (char**)&opt_scheduler,
 
2517
   0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
2499
2518
  {"sort_buffer_size", OPT_SORT_BUFFER,
2500
2519
   N_("Each thread that needs to do a sort allocates a buffer of this size."),
2501
2520
   (char**) &global_system_variables.sortbuff_size,
2748
2767
  drizzled_user= drizzled_chroot= 0;
2749
2768
  my_bind_addr_str= NULL;
2750
2769
  memset(&global_status_var, 0, sizeof(global_status_var));
2751
 
  key_map_full.set_all();
 
2770
  key_map_full.set();
2752
2771
 
2753
2772
  /* Character sets */
2754
2773
  system_charset_info= &my_charset_utf8_general_ci;
2931
2950
      global_system_variables.tx_isolation= (type-1);
2932
2951
      break;
2933
2952
    }
 
2953
  case OPT_OPTIMIZER_USE_MRR:
 
2954
    {
 
2955
      int type;
 
2956
      type= find_type_or_exit(argument, &optimizer_use_mrr_typelib, opt->name);
 
2957
      global_system_variables.optimizer_use_mrr= (type-1);
 
2958
      break;
 
2959
    }
2934
2960
  case OPT_MYISAM_RECOVER:
2935
2961
    {
2936
2962
      if (!argument)
3037
3063
 
3038
3064
/**
3039
3065
  @todo
3040
 
  - FIXME add EXIT_TOO_MANY_ARGUMENTS to "mysys_err.h" and return that code?
 
3066
  - FIXME add EXIT_TOO_MANY_ARGUMENTS to "mysys/mysys_err.h" and return that code?
3041
3067
*/
3042
3068
static void get_options(int *argc,char **argv)
3043
3069
{