~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to sql/mysqld.cc

  • Committer: Brian Aker
  • Date: 2008-07-07 21:16:22 UTC
  • Revision ID: brian@tangent.org-20080707211622-tsk0yw2o53umgmnr
Removing bootstrap (we no longer need it... we just work).

Show diffs side-by-side

added added

removed removed

Lines of Context:
502
502
static void fix_paths(void);
503
503
void handle_connections_sockets();
504
504
pthread_handler_t kill_server_thread(void *arg);
505
 
static void bootstrap(FILE *file);
506
 
static bool read_init_file(char *file_name);
507
505
pthread_handler_t handle_slave(void *arg);
508
506
static ulong find_bit_type(const char *x, TYPELIB *bit_lib);
509
507
static ulong find_bit_type_or_exit(const char *x, TYPELIB *bit_lib,
2917
2915
    unireg_abort(1);
2918
2916
  }
2919
2917
 
2920
 
  if (opt_bootstrap)
2921
 
  {
2922
 
    select_thread_in_use= 0;                    // Allow 'kill' to work
2923
 
    bootstrap(stdin);
2924
 
    unireg_abort(bootstrap_error ? 1 : 0);
2925
 
  }
2926
 
  if (opt_init_file)
2927
 
  {
2928
 
    if (read_init_file(opt_init_file))
2929
 
      unireg_abort(1);
2930
 
  }
2931
 
 
2932
2918
  create_maintenance_thread();
2933
2919
 
2934
2920
  sql_print_information(ER(ER_STARTUP),my_progname,server_version,
2965
2951
 
2966
2952
 
2967
2953
/**
2968
 
  Execute all commands from a file. Used by the mysql_install_db script to
2969
 
  create MySQL privilege tables without having to start a full MySQL server.
2970
 
*/
2971
 
 
2972
 
static void bootstrap(FILE *file)
2973
 
{
2974
 
  DBUG_ENTER("bootstrap");
2975
 
 
2976
 
  THD *thd= new THD;
2977
 
  thd->bootstrap=1;
2978
 
  my_net_init(&thd->net,(st_vio*) 0);
2979
 
  thd->max_client_packet_length= thd->net.max_packet;
2980
 
  thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
2981
 
  thread_count++;
2982
 
 
2983
 
  bootstrap_file=file;
2984
 
  if (pthread_create(&thd->real_id,&connection_attrib,handle_bootstrap,
2985
 
                     (void*) thd))
2986
 
  {
2987
 
    sql_print_warning("Can't create thread to handle bootstrap");
2988
 
    bootstrap_error=-1;
2989
 
    DBUG_VOID_RETURN;
2990
 
  }
2991
 
  /* Wait for thread to die */
2992
 
  (void) pthread_mutex_lock(&LOCK_thread_count);
2993
 
  while (thread_count)
2994
 
  {
2995
 
    (void) pthread_cond_wait(&COND_thread_count,&LOCK_thread_count);
2996
 
    DBUG_PRINT("quit",("One thread died (count=%u)",thread_count));
2997
 
  }
2998
 
  (void) pthread_mutex_unlock(&LOCK_thread_count);
2999
 
 
3000
 
  DBUG_VOID_RETURN;
3001
 
}
3002
 
 
3003
 
 
3004
 
static bool read_init_file(char *file_name)
3005
 
{
3006
 
  FILE *file;
3007
 
  DBUG_ENTER("read_init_file");
3008
 
  DBUG_PRINT("enter",("name: %s",file_name));
3009
 
  if (!(file=my_fopen(file_name,O_RDONLY,MYF(MY_WME))))
3010
 
    return(1);
3011
 
  bootstrap(file);
3012
 
  (void) my_fclose(file,MYF(MY_WME));
3013
 
  return 0;
3014
 
}
3015
 
 
3016
 
 
3017
 
/**
3018
2954
  Create new thread to handle incoming connection.
3019
2955
 
3020
2956
    This function will create new thread to handle the incoming