diff options
-rw-r--r-- | Docs/internals.texi | 21 | ||||
-rw-r--r-- | sql/sql_db.cc | 2 | ||||
-rw-r--r-- | sql/sql_parse.cc | 22 | ||||
-rw-r--r-- | sql/table.cc | 2 | ||||
-rw-r--r-- | tools/mysqlmanager.c | 28 |
5 files changed, 55 insertions, 20 deletions
diff --git a/Docs/internals.texi b/Docs/internals.texi index 2195b42d9a0..f255a7ab6a6 100644 --- a/Docs/internals.texi +++ b/Docs/internals.texi @@ -481,6 +481,27 @@ Functions i mysys: (For flags se my_sys.h) void end_key_cache _A((void)); - End key-cacheing. +@node DBUG,,, +@chapter The DBUG tags to use: + +Here is some of the tags we now use: +(We should probably add a couple of new ones) + +"enter" Arguments to the function. +"exit" Results from the function. +"info" is something that may be interesting. +"warning" is when something doesn't go the usual route or may be wrong. +"error" when something went wrong. +"loop" write in a loop, that is probably only useful when debugging + the loop. These should normally be deleted when on is + satisfied with the code and it has been in real use for a while. + +Some specific to mysqld, because we want to watch these carefully: + +"trans" Starting/stopping transactions. +"quit" 'info' when mysqld is preparing to die. +"query" Print query + @node protocol,,, @chapter MySQL client/server protocol diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 2e836dc48d0..64ad205803e 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -334,7 +334,7 @@ bool mysql_change_db(THD *thd,const char *name) x_free(dbname); DBUG_RETURN(1); } - DBUG_PRINT("general",("Use database: %s", dbname)); + DBUG_PRINT("info",("Use database: %s", dbname)); if (test_all_bits(thd->master_access,DB_ACLS)) db_access=DB_ACLS; else diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 7104e41fc46..b83a50aec16 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -120,7 +120,7 @@ static bool check_user(THD *thd,enum_server_command command, const char *user, protocol_version == 9 || !(thd->client_capabilities & CLIENT_LONG_PASSWORD)); - DBUG_PRINT("general", + DBUG_PRINT("info", ("Capabilities: %d packet_length: %d Host: '%s' User: '%s' Using password: %s Access: %u db: '%s'", thd->client_capabilities, thd->max_packet_length, thd->host_or_ip, thd->priv_user, @@ -323,7 +323,7 @@ check_connections(THD *thd) */ DBUG_PRINT("info", (("check_connections called by thread %d"), thd->thread_id)); - DBUG_PRINT("general",("New connection received on %s", + DBUG_PRINT("info",("New connection received on %s", vio_description(net->vio))); if (!thd->host) // If TCP/IP connection { @@ -347,15 +347,15 @@ check_connections(THD *thd) if (connect_errors > max_connect_errors) return(ER_HOST_IS_BLOCKED); } - DBUG_PRINT("general",("Host: %s ip: %s", - thd->host ? thd->host : "unknown host", - thd->ip ? thd->ip : "unknown ip")); + DBUG_PRINT("info",("Host: %s ip: %s", + thd->host ? thd->host : "unknown host", + thd->ip ? thd->ip : "unknown ip")); if (acl_check_host(thd->host,thd->ip)) return(ER_HOST_NOT_PRIVILEGED); } else /* Hostname given means that the connection was on a socket */ { - DBUG_PRINT("general",("Host: %s",thd->host)); + DBUG_PRINT("info",("Host: %s",thd->host)); thd->host_or_ip=thd->host; thd->ip=0; bzero((char*) &thd->remote,sizeof(struct sockaddr)); @@ -731,17 +731,17 @@ bool do_command(THD *thd) net_new_transaction(net); if ((packet_length=my_net_read(net)) == packet_error) { - DBUG_PRINT("general",("Got error reading command from socket %s", - vio_description(net->vio) )); + DBUG_PRINT("info",("Got error reading command from socket %s", + vio_description(net->vio) )); return TRUE; } else { packet=(char*) net->read_pos; command = (enum enum_server_command) (uchar) packet[0]; - DBUG_PRINT("general",("Command on %s = %d (%s)", - vio_description(net->vio), command, - command_name[command])); + DBUG_PRINT("info",("Command on %s = %d (%s)", + vio_description(net->vio), command, + command_name[command])); } net->timeout=old_timeout; // Timeout for writing DBUG_RETURN(dispatch_command(command,thd, packet+1, packet_length)); diff --git a/sql/table.cc b/sql/table.cc index 1ed856f7854..927119f45de 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -261,7 +261,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, outparam->comment=strdup_root(&outparam->mem_root, (char*) head+47); - DBUG_PRINT("form",("i_count: %d i_parts: %d index: %d n_length: %d int_length: %d", interval_count,interval_parts, outparam->keys,n_length,int_length)); + DBUG_PRINT("info",("i_count: %d i_parts: %d index: %d n_length: %d int_length: %d", interval_count,interval_parts, outparam->keys,n_length,int_length)); if (!(field_ptr = (Field **) alloc_root(&outparam->mem_root, diff --git a/tools/mysqlmanager.c b/tools/mysqlmanager.c index 92f76ac4218..f2f89c6bc07 100644 --- a/tools/mysqlmanager.c +++ b/tools/mysqlmanager.c @@ -297,9 +297,8 @@ static int authenticate(struct manager_thd* thd); static char* read_line(struct manager_thd* thd); /* returns pointer to end of line */ -static pthread_handler_decl(process_connection,arg); -static pthread_handler_decl(process_launcher_messages, - __attribute__((unused)) arg); +static pthread_handler_decl(process_connection, arg); +static pthread_handler_decl(process_launcher_messages, arg); static int exec_line(struct manager_thd* thd,char* buf,char* buf_end); #ifdef DO_STACKTRACE @@ -1024,7 +1023,8 @@ static void log_msg(const char* fmt, int msg_type, va_list args) pthread_mutex_unlock(&lock_log); } -#define LOG_MSG_FUNC(type,TYPE) inline static void type \ +/* No 'inline' here becasue functions with ... can't do that portable */ +#define LOG_MSG_FUNC(type,TYPE) static void type \ (const char* fmt,...) { \ va_list args; \ va_start(args,fmt); \ @@ -1038,7 +1038,7 @@ LOG_MSG_FUNC(log_info,LOG_INFO) #ifndef DBUG_OFF LOG_MSG_FUNC(log_debug,LOG_DEBUG) #else -inline void log_debug(const char* __attribute__((unused)) fmt,...) {} +void log_debug(const char* __attribute__((unused)) fmt,...) {} #endif static pthread_handler_decl(process_launcher_messages, @@ -1367,6 +1367,12 @@ static int run_server_loop() int client_sock; uint len; Vio* vio; + pthread_attr_t thr_attr; + (void) pthread_attr_init(&thr_attr); +#if !defined(HAVE_DEC_3_2_THREADS) + pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_SYSTEM); + (void) pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED); +#endif for (;!shutdown_requested;) { @@ -1412,7 +1418,7 @@ static int run_server_loop() manager_thd_free(thd); continue; } - else if (pthread_create(&th,0,process_connection,(void*)thd)) + else if (pthread_create(&th,&thr_attr,process_connection,(void*)thd)) { client_msg(vio,MANAGER_INTERNAL_ERR,"Could not create thread, errno=%d", errno); @@ -1420,6 +1426,7 @@ static int run_server_loop() continue; } } + (void) pthread_attr_destroy(&thr_attr); return 0; } @@ -1659,13 +1666,20 @@ static void init_user_hash() static void init_globals() { + pthread_attr_t thr_attr; if (hash_init(&exec_hash,1024,0,0,get_exec_key,manager_exec_free,MYF(0))) die("Exec hash initialization failed"); if (!one_thread) { + (void) pthread_attr_init(&thr_attr); +#if !defined(HAVE_DEC_3_2_THREADS) + pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_SYSTEM); + (void) pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED); +#endif fork_launcher(); - if (pthread_create(&launch_msg_th,0,process_launcher_messages,0)) + if (pthread_create(&launch_msg_th,&thr_attr,process_launcher_messages,0)) die("Could not start launcher message handler thread"); + /* (void) pthread_attr_destroy(&thr_attr); */ } init_user_hash(); loop_th=pthread_self(); |