~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/drizzled.cc

  • Committer: Patrick Galbraith
  • Date: 2008-08-22 02:02:51 UTC
  • Revision ID: patg@radha.local-20080822020251-850a6pusulhjk3ho
UlongĀ conversion

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
#endif
51
51
 
52
52
#if SIZEOF_CHARP == 4
53
 
#define MAX_MEM_TABLE_SIZE ~(ulong) 0
 
53
#define MAX_MEM_TABLE_SIZE ~(uint32_t) 0
54
54
#else
55
55
#define MAX_MEM_TABLE_SIZE ~(uint64_t) 0
56
56
#endif
224
224
static bool volatile ready_to_exit;
225
225
static bool opt_debugging= 0, opt_console= 0;
226
226
static uint kill_cached_threads, wake_thread;
227
 
static ulong killed_threads, thread_created;
228
 
static ulong max_used_connections;
229
 
static volatile ulong cached_thread_count= 0;
 
227
static uint32_t killed_threads, thread_created;
 
228
static uint32_t max_used_connections;
 
229
static volatile uint32_t cached_thread_count= 0;
230
230
static char *mysqld_user, *mysqld_chroot, *log_error_file_ptr;
231
231
static char *opt_init_slave, *language_ptr, *opt_init_connect;
232
232
static char *default_character_set_name;
296
296
TYPELIB binlog_format_typelib=
297
297
  { array_elements(binlog_format_names) - 1, "",
298
298
    binlog_format_names, NULL };
299
 
ulong opt_binlog_format_id= (ulong) BINLOG_FORMAT_UNSPEC;
 
299
uint32_t opt_binlog_format_id= (uint32_t) BINLOG_FORMAT_UNSPEC;
300
300
const char *opt_binlog_format= binlog_format_names[opt_binlog_format_id];
301
301
#ifdef HAVE_INITGROUPS
302
302
static bool calling_initgroups= false; /**< Used in SIGSEGV handler. */
311
311
ulong back_log, connect_timeout, server_id;
312
312
ulong table_cache_size, table_def_size;
313
313
ulong what_to_log;
314
 
ulong query_buff_size, slow_launch_time, slave_open_temp_tables;
315
 
ulong open_files_limit, max_binlog_size, max_relay_log_size;
316
 
ulong slave_net_timeout, slave_trans_retries;
 
314
ulong slow_launch_time, slave_open_temp_tables;
 
315
ulong open_files_limit;
 
316
ulong max_binlog_size;
 
317
ulong max_relay_log_size;
 
318
ulong slave_net_timeout;
 
319
ulong slave_trans_retries;
317
320
bool slave_allow_batching;
318
321
ulong slave_exec_mode_options;
319
322
const char *slave_exec_mode_str= "STRICT";
320
 
ulong thread_cache_size=0, thread_pool_size= 0;
321
 
ulong binlog_cache_size=0, max_binlog_cache_size=0;
322
 
ulong refresh_version;  /* Increments on each reload */
 
323
ulong thread_cache_size= 0;
 
324
ulong thread_pool_size= 0;
 
325
ulong binlog_cache_size= 0;
 
326
ulong max_binlog_cache_size= 0;
 
327
uint32_t refresh_version;  /* Increments on each reload */
323
328
query_id_t global_query_id;
324
 
ulong aborted_threads, aborted_connects;
325
 
ulong specialflag=0;
326
 
ulong binlog_cache_use= 0, binlog_cache_disk_use= 0;
327
 
ulong max_connections, max_connect_errors;
 
329
ulong aborted_threads;
 
330
ulong aborted_connects;
 
331
ulong specialflag= 0;
 
332
ulong binlog_cache_use= 0;
 
333
ulong binlog_cache_disk_use= 0;
 
334
ulong max_connections;
 
335
ulong max_connect_errors;
328
336
uint  max_user_connections= 0;
329
 
ulong thread_id=1L,current_pid;
330
 
ulong slow_launch_threads = 0, sync_binlog_period;
 
337
ulong thread_id=1L;
 
338
ulong current_pid;
 
339
ulong slow_launch_threads = 0;
 
340
ulong sync_binlog_period;
331
341
ulong expire_logs_days = 0;
332
342
ulong rpl_recovery_rank=0;
333
343
const char *log_output_str= "FILE";
459
469
static bool opt_do_pstack;
460
470
#endif /* HAVE_STACK_TRACE_ON_SEGV */
461
471
static int cleanup_done;
462
 
static ulong opt_myisam_block_size;
 
472
static uint32_t opt_myisam_block_size;
463
473
static char *opt_binlog_index_name;
464
474
static char *opt_tc_heuristic_recover;
465
475
static char *mysql_home_ptr, *pidfile_name_ptr;
498
508
void handle_connections_sockets();
499
509
pthread_handler_t kill_server_thread(void *arg);
500
510
pthread_handler_t handle_slave(void *arg);
501
 
static ulong find_bit_type(const char *x, TYPELIB *bit_lib);
502
 
static ulong find_bit_type_or_exit(const char *x, TYPELIB *bit_lib,
 
511
static uint32_t find_bit_type(const char *x, TYPELIB *bit_lib);
 
512
static uint32_t find_bit_type_or_exit(const char *x, TYPELIB *bit_lib,
503
513
                                   const char *option);
504
514
static void clean_up(bool print_message);
505
515
 
1446
1456
                    "will hopefully help diagnose\n"
1447
1457
                    "the problem, but since we have already crashed, "
1448
1458
                    "something is definitely wrong\nand this may fail.\n\n"));
1449
 
  fprintf(stderr, "key_buffer_size=%lu\n",
1450
 
          (ulong) dflt_key_cache->key_cache_mem_size);
 
1459
  fprintf(stderr, "key_buffer_size=%u\n",
 
1460
          (uint32_t) dflt_key_cache->key_cache_mem_size);
1451
1461
  fprintf(stderr, "read_buffer_size=%ld\n", (long) global_system_variables.read_buff_size);
1452
 
  fprintf(stderr, "max_used_connections=%lu\n", max_used_connections);
 
1462
  fprintf(stderr, "max_used_connections=%u\n", max_used_connections);
1453
1463
  fprintf(stderr, "max_threads=%u\n", thread_scheduler.max_threads);
1454
1464
  fprintf(stderr, "thread_count=%u\n", thread_count);
1455
1465
  fprintf(stderr, "connection_count=%u\n", connection_count);
1459
1469
                    "bytes of memory\n"
1460
1470
                    "Hope that's ok; if not, decrease some variables in the "
1461
1471
                    "equation.\n\n"),
1462
 
                    ((ulong) dflt_key_cache->key_cache_mem_size +
 
1472
                    ((uint32_t) dflt_key_cache->key_cache_mem_size +
1463
1473
                     (global_system_variables.read_buff_size +
1464
1474
                      global_system_variables.sortbuff_size) *
1465
1475
                     thread_scheduler.max_threads +
1503
1513
                      "Some pointers may be invalid and cause the "
1504
1514
                      "dump to abort...\n"));
1505
1515
    safe_print_str("thd->query", thd->query, 1024);
1506
 
    fprintf(stderr, "thd->thread_id=%lu\n", (ulong) thd->thread_id);
 
1516
    fprintf(stderr, "thd->thread_id=%lu\n", (uint32_t) thd->thread_id);
1507
1517
    fprintf(stderr, "thd->killed=%s\n", kreason);
1508
1518
  }
1509
1519
  fflush(stderr);
1719
1729
#ifdef HAVE_STACK_TRACE_ON_SEGV
1720
1730
  if (opt_do_pstack)
1721
1731
  {
1722
 
    sprintf(pstack_file_name,"mysqld-%lu-%%d-%%d.backtrace", (ulong)getpid());
 
1732
    sprintf(pstack_file_name,"mysqld-%lu-%%d-%%d.backtrace", (uint32_t)getpid());
1723
1733
    pstack_install_segv_action(pstack_file_name);
1724
1734
  }
1725
1735
#endif /* HAVE_STACK_TRACE_ON_SEGV */
2111
2121
      can't get max_connections*5 but still got no less than was
2112
2122
      requested (value of wanted_files).
2113
2123
    */
2114
 
    max_open_files= max(max((ulong)wanted_files, max_connections*5),
 
2124
    max_open_files= max(max((uint32_t)wanted_files, max_connections*5),
2115
2125
                        open_files_limit);
2116
2126
    files= my_set_max_open_files(max_open_files);
2117
2127
 
2123
2133
          If we have requested too much file handles than we bring
2124
2134
          max_connections in supported bounds.
2125
2135
        */
2126
 
        max_connections= (ulong) min((ulong)files-10-TABLE_OPEN_CACHE_MIN*2,
 
2136
        max_connections= (uint32_t) min((uint32_t)files-10-TABLE_OPEN_CACHE_MIN*2,
2127
2137
                                     max_connections);
2128
2138
        /*
2129
2139
          Decrease table_cache_size according to max_connections, but
2131
2141
          never increase table_cache_size automatically (that could
2132
2142
          happen if max_connections is decreased above).
2133
2143
        */
2134
 
        table_cache_size= (ulong) min(max((files-10-max_connections)/2,
2135
 
                                          (ulong)TABLE_OPEN_CACHE_MIN),
 
2144
        table_cache_size= (uint32_t) min(max((files-10-max_connections)/2,
 
2145
                                          (uint32_t)TABLE_OPEN_CACHE_MIN),
2136
2146
                                      table_cache_size);
2137
2147
        if (global_system_variables.log_warnings)
2138
2148
          sql_print_warning(_("Changed limits: max_open_files: %u  "
2332
2342
  if (table_cache_init() | table_def_init())
2333
2343
    unireg_abort(1);
2334
2344
 
2335
 
  randominit(&sql_rand,(ulong) server_start_time,(ulong) server_start_time/2);
 
2345
  randominit(&sql_rand,(uint32_t) server_start_time,(uint32_t) server_start_time/2);
2336
2346
  setup_fpu();
2337
2347
  init_thr_lock();
2338
2348
  init_slave_list();
3097
3107
};
3098
3108
 
3099
3109
 
3100
 
#define LONG_TIMEOUT ((ulong) 3600L*24L*365L)
 
3110
#define LONG_TIMEOUT ((uint32_t) 3600L*24L*365L)
3101
3111
 
3102
3112
struct my_option my_long_options[] =
3103
3113
{
4801
4811
    break;
4802
4812
  case OPT_MYISAM_STATS_METHOD:
4803
4813
    {
4804
 
      ulong method_conv;
 
4814
      uint32_t method_conv;
4805
4815
      int method;
4806
4816
 
4807
4817
      myisam_stats_method_str= argument;
5074
5084
}
5075
5085
 
5076
5086
 
5077
 
static ulong find_bit_type_or_exit(const char *x, TYPELIB *bit_lib,
 
5087
static uint32_t find_bit_type_or_exit(const char *x, TYPELIB *bit_lib,
5078
5088
                                   const char *option)
5079
5089
{
5080
 
  ulong res;
 
5090
  uint32_t res;
5081
5091
 
5082
5092
  const char **ptr;
5083
5093
 
5084
 
  if ((res= find_bit_type(x, bit_lib)) == ~(ulong) 0)
 
5094
  if ((res= find_bit_type(x, bit_lib)) == ~(uint32_t) 0)
5085
5095
  {
5086
5096
    ptr= bit_lib->type_names;
5087
5097
    if (!*x)
5103
5113
  @return
5104
5114
    a bitfield from a string of substrings separated by ','
5105
5115
    or
5106
 
    ~(ulong) 0 on error.
 
5116
    ~(uint32_t) 0 on error.
5107
5117
*/
5108
5118
 
5109
 
static ulong find_bit_type(const char *x, TYPELIB *bit_lib)
 
5119
static uint32_t find_bit_type(const char *x, TYPELIB *bit_lib)
5110
5120
{
5111
5121
  bool found_end;
5112
5122
  int  found_count;
5113
5123
  const char *end,*i,*j;
5114
5124
  const char **array, *pos;
5115
 
  ulong found,found_int,bit;
 
5125
  uint32_t found,found_int,bit;
5116
5126
 
5117
5127
  found=0;
5118
5128
  found_end= 0;
5155
5165
skip: ;
5156
5166
    }
5157
5167
    if (found_count != 1)
5158
 
      return(~(ulong) 0);                               // No unique value
 
5168
      return(~(uint32_t) 0);                            // No unique value
5159
5169
    found|=found_int;
5160
5170
    pos=end+1;
5161
5171
  }