From 9a5dafba83c9135656727ab9e3236703fe49361d Mon Sep 17 00:00:00 2001 From: "marko@hundin.mysql.fi" <> Date: Wed, 26 May 2004 10:45:37 +0300 Subject: [PATCH 1/4] InnoDB cleanup: Remove unused code for online backup --- innobase/include/log0log.h | 35 ------- innobase/include/log0log.ic | 36 +------ innobase/include/mtr0mtr.h | 12 +-- innobase/log/log0log.c | 64 ------------ innobase/log/log0recv.c | 13 +-- innobase/mtr/mtr0mtr.c | 199 +----------------------------------- 6 files changed, 8 insertions(+), 351 deletions(-) diff --git a/innobase/include/log0log.h b/innobase/include/log0log.h index 6eef8144c27..c17998032ce 100644 --- a/innobase/include/log0log.h +++ b/innobase/include/log0log.h @@ -114,20 +114,6 @@ dulint log_get_lsn(void); /*=============*/ /* out: current lsn */ -/**************************************************************************** -Gets the online backup lsn. */ -UNIV_INLINE -dulint -log_get_online_backup_lsn_low(void); -/*===============================*/ -/**************************************************************************** -Gets the online backup state. */ -UNIV_INLINE -ibool -log_get_online_backup_state_low(void); -/*=================================*/ - /* out: online backup state, the caller must - own the log_sys mutex */ /********************************************************** Initializes the log. */ @@ -326,20 +312,6 @@ log_archived_file_name_gen( char* buf, /* in: buffer where to write */ ulint id, /* in: group id */ ulint file_no);/* in: file number */ -/********************************************************** -Switches the database to the online backup state. */ - -ulint -log_switch_backup_state_on(void); -/*============================*/ - /* out: DB_SUCCESS or DB_ERROR */ -/********************************************************** -Switches the online backup state off. */ - -ulint -log_switch_backup_state_off(void); -/*=============================*/ - /* out: DB_SUCCESS or DB_ERROR */ /************************************************************************ Checks that there is enough free space in the log to start a new query step. Flushes the log buffer or makes a new checkpoint if necessary. NOTE: this @@ -871,13 +843,6 @@ struct log_struct{ os_event_t archiving_on; /* if archiving has been stopped, a thread can wait for this event to become signaled */ - /* Fields involved in online backups */ - ibool online_backup_state; - /* TRUE if the database is in the - online backup state */ - dulint online_backup_lsn; - /* lsn when the state was changed to - the online backup state */ }; #define LOG_ARCH_ON 71 diff --git a/innobase/include/log0log.ic b/innobase/include/log0log.ic index 6e32a45cdc5..c38e5fe2b9c 100644 --- a/innobase/include/log0log.ic +++ b/innobase/include/log0log.ic @@ -318,8 +318,7 @@ log_reserve_and_write_fast( data_len = len + log->buf_free % OS_FILE_LOG_BLOCK_SIZE; - if (log->online_backup_state - || (data_len >= OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE)) { + if (data_len >= OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE) { /* The string does not fit within the current log block or the log block would become full */ @@ -403,36 +402,3 @@ log_free_check(void) log_check_margins(); } } - -/**************************************************************************** -Gets the online backup lsn. */ -UNIV_INLINE -dulint -log_get_online_backup_lsn_low(void) -/*===============================*/ - /* out: online_backup_lsn, the caller must - own the log_sys mutex */ -{ -#ifdef UNIV_SYNC_DEBUG - ut_ad(mutex_own(&(log_sys->mutex))); -#endif /* UNIV_SYNC_DEBUG */ - ut_ad(log_sys->online_backup_state); - - return(log_sys->online_backup_lsn); -} - -/**************************************************************************** -Gets the online backup state. */ -UNIV_INLINE -ibool -log_get_online_backup_state_low(void) -/*=================================*/ - /* out: online backup state, the caller must - own the log_sys mutex */ -{ -#ifdef UNIV_SYNC_DEBUG - ut_ad(mutex_own(&(log_sys->mutex))); -#endif /* UNIV_SYNC_DEBUG */ - - return(log_sys->online_backup_state); -} diff --git a/innobase/include/mtr0mtr.h b/innobase/include/mtr0mtr.h index 6117927504f..e693b88680e 100644 --- a/innobase/include/mtr0mtr.h +++ b/innobase/include/mtr0mtr.h @@ -82,7 +82,7 @@ flag value must give the length also! */ predefined minimum record */ #define MLOG_IBUF_BITMAP_INIT ((byte)27) /* initialize an ibuf bitmap page */ -#define MLOG_FULL_PAGE ((byte)28) /* full contents of a page */ +/*#define MLOG_FULL_PAGE ((byte)28) full contents of a page */ #define MLOG_INIT_FILE_PAGE ((byte)29) /* this means that a file page is taken into use and the prior contents of the page should be @@ -230,16 +230,6 @@ mtr_memo_release( mtr_t* mtr, /* in: mtr */ void* object, /* in: object */ ulint type); /* in: object type: MTR_MEMO_S_LOCK, ... */ -/**************************************************************** -Parses a log record which contains the full contents of a page. */ - -byte* -mtr_log_parse_full_page( -/*====================*/ - /* out: end of log record or NULL */ - byte* ptr, /* in: buffer */ - byte* end_ptr,/* in: buffer end */ - page_t* page); /* in: page or NULL */ /************************************************************** Checks if memo contains the given item. */ UNIV_INLINE diff --git a/innobase/log/log0log.c b/innobase/log/log0log.c index b058a65ce6e..a6c4ed598a4 100644 --- a/innobase/log/log0log.c +++ b/innobase/log/log0log.c @@ -793,11 +793,7 @@ log_init(void) log_sys->archiving_on = os_event_create(NULL); /*----------------------------*/ - - log_sys->online_backup_state = FALSE; - /*----------------------------*/ - log_block_init(log_sys->buf, log_sys->lsn); log_block_set_first_rec_group(log_sys->buf, LOG_BLOCK_HDR_SIZE); @@ -2973,66 +2969,6 @@ loop: mutex_exit(&(log_sys->mutex)); } -/********************************************************** -Switches the database to the online backup state. */ - -ulint -log_switch_backup_state_on(void) -/*============================*/ - /* out: DB_SUCCESS or DB_ERROR */ -{ - dulint backup_lsn; - - mutex_enter(&(log_sys->mutex)); - - if (log_sys->online_backup_state) { - - /* The database is already in that state */ - - mutex_exit(&(log_sys->mutex)); - - return(DB_ERROR); - } - - log_sys->online_backup_state = TRUE; - - backup_lsn = log_sys->lsn; - - log_sys->online_backup_lsn = backup_lsn; - - mutex_exit(&(log_sys->mutex)); - - /* log_checkpoint_and_mark_file_spaces(); */ - - return(DB_SUCCESS); -} - -/********************************************************** -Switches the online backup state off. */ - -ulint -log_switch_backup_state_off(void) -/*=============================*/ - /* out: DB_SUCCESS or DB_ERROR */ -{ - mutex_enter(&(log_sys->mutex)); - - if (!log_sys->online_backup_state) { - - /* The database is already in that state */ - - mutex_exit(&(log_sys->mutex)); - - return(DB_ERROR); - } - - log_sys->online_backup_state = FALSE; - - mutex_exit(&(log_sys->mutex)); - - return(DB_SUCCESS); -} - /******************************************************************** Makes a checkpoint at the latest lsn and writes it to first page of each data file in the database, so that we know that the file spaces contain diff --git a/innobase/log/log0recv.c b/innobase/log/log0recv.c index 33321376929..ba2e2064ec6 100644 --- a/innobase/log/log0recv.c +++ b/innobase/log/log0recv.c @@ -790,9 +790,6 @@ recv_parse_or_apply_log_rec_body( } else if (type == MLOG_IBUF_BITMAP_INIT) { new_ptr = ibuf_parse_bitmap_init(ptr, end_ptr, page, mtr); - } else if (type == MLOG_FULL_PAGE) { - new_ptr = mtr_log_parse_full_page(ptr, end_ptr, page); - } else if (type == MLOG_INIT_FILE_PAGE) { new_ptr = fsp_parse_init_file_page(ptr, end_ptr, page); @@ -1093,15 +1090,7 @@ recv_recover_page( buf = ((byte*)(recv->data)) + sizeof(recv_data_t); } - if (recv->type == MLOG_INIT_FILE_PAGE - || recv->type == MLOG_FULL_PAGE) { - /* A new file page may have been taken into use, - or we have stored the full contents of the page: - in this case it may be that the original log record - type was MLOG_INIT_FILE_PAGE, and we replaced it - with MLOG_FULL_PAGE, thus we have to apply - any record of type MLOG_FULL_PAGE */ - + if (recv->type == MLOG_INIT_FILE_PAGE) { page_lsn = page_newest_lsn; mach_write_to_8(page + UNIV_PAGE_SIZE diff --git a/innobase/mtr/mtr0mtr.c b/innobase/mtr/mtr0mtr.c index 46473cb3ffe..5a5fab61827 100644 --- a/innobase/mtr/mtr0mtr.c +++ b/innobase/mtr/mtr0mtr.c @@ -105,179 +105,6 @@ mtr_memo_pop_all( } } -/**************************************************************** -Writes to the log the contents of a full page. This is called when the -database is in the online backup state. */ -static -void -mtr_log_write_full_page( -/*====================*/ - page_t* page, /* in: page to write */ - ulint i, /* in: i'th page for mtr */ - ulint n_pages,/* in: total number of pages for mtr */ - mtr_t* mtr) /* in: mtr */ -{ - byte* buf; - byte* ptr; - ulint len; - - buf = mem_alloc(UNIV_PAGE_SIZE + 50); - - ptr = mlog_write_initial_log_record_fast(page, MLOG_FULL_PAGE, buf, - mtr); - ut_memcpy(ptr, page, UNIV_PAGE_SIZE); - - len = (ptr - buf) + UNIV_PAGE_SIZE; - - if (i == n_pages - 1) { - if (n_pages > 1) { - *(buf + len) = MLOG_MULTI_REC_END; - len++; - } else { - *buf = (byte)((ulint)*buf | MLOG_SINGLE_REC_FLAG); - } - } - - ut_ad(len < UNIV_PAGE_SIZE + 50); - - log_write_low(buf, len); - - mem_free(buf); -} - -/**************************************************************** -Parses a log record which contains the full contents of a page. */ - -byte* -mtr_log_parse_full_page( -/*====================*/ - /* out: end of log record or NULL */ - byte* ptr, /* in: buffer */ - byte* end_ptr,/* in: buffer end */ - page_t* page) /* in: page or NULL */ -{ - if (end_ptr < ptr + UNIV_PAGE_SIZE) { - - return(NULL); - } - - if (page) { - ut_memcpy(page, ptr, UNIV_PAGE_SIZE); - } - - return(ptr + UNIV_PAGE_SIZE); -} - -/**************************************************************** -Writes to the database log the full contents of the pages that this mtr has -modified. */ -static -void -mtr_log_write_backup_full_pages( -/*============================*/ - mtr_t* mtr, /* in: mini-transaction */ - ulint n_pages)/* in: number of pages modified by mtr */ -{ - mtr_memo_slot_t* slot; - dyn_array_t* memo; - buf_block_t* block; - ulint offset; - ulint type; - ulint i; - - ut_ad(mtr); - ut_ad(mtr->magic_n == MTR_MAGIC_N); - ut_ad(mtr->state == MTR_COMMITTING); - - /* Open the database log for log_write_low */ - mtr->start_lsn = log_reserve_and_open(n_pages * (UNIV_PAGE_SIZE + 50)); - - memo = &(mtr->memo); - - offset = dyn_array_get_data_size(memo); - - i = 0; - - while (offset > 0) { - offset -= sizeof(mtr_memo_slot_t); - slot = dyn_array_get_element(memo, offset); - - block = slot->object; - type = slot->type; - - if ((block != NULL) && (type == MTR_MEMO_PAGE_X_FIX)) { - - mtr_log_write_full_page(block->frame, i, n_pages, mtr); - - i++; - } - } - - ut_ad(i == n_pages); -} - -/**************************************************************** -Checks if mtr is the first to modify any page after online_backup_lsn. */ -static -ibool -mtr_first_to_modify_page_after_backup( -/*==================================*/ - /* out: TRUE if first for a page */ - mtr_t* mtr, /* in: mini-transaction */ - ulint* n_pages) /* out: number of modified pages (all modified - pages, backup_lsn does not matter here) */ -{ - mtr_memo_slot_t* slot; - dyn_array_t* memo; - ulint offset; - buf_block_t* block; - ulint type; - dulint backup_lsn; - ibool ret = FALSE; - - ut_ad(mtr); - ut_ad(mtr->magic_n == MTR_MAGIC_N); - ut_ad(mtr->state == MTR_COMMITTING); - - backup_lsn = log_get_online_backup_lsn_low(); - - memo = &(mtr->memo); - - offset = dyn_array_get_data_size(memo); - - *n_pages = 0; - - while (offset > 0) { - offset -= sizeof(mtr_memo_slot_t); - slot = dyn_array_get_element(memo, offset); - - block = slot->object; - type = slot->type; - - if ((block != NULL) && (type == MTR_MEMO_PAGE_X_FIX)) { - - *n_pages = *n_pages + 1; - - if (ut_dulint_cmp(buf_frame_get_newest_modification( - block->frame), - backup_lsn) <= 0) { - - fprintf(stderr, - "Page %lu newest %lu backup %lu\n", - block->offset, - ut_dulint_get_low( - buf_frame_get_newest_modification( - block->frame)), - ut_dulint_get_low(backup_lsn)); - - ret = TRUE; - } - } - } - - return(ret); -} - /**************************************************************** Writes the contents of a mini-transaction log, if any, to the database log. */ static @@ -291,7 +118,6 @@ mtr_log_reserve_and_write( ulint data_size; ibool success; byte* first_data; - ulint n_modified_pages; ut_ad(mtr); @@ -322,27 +148,12 @@ mtr_log_reserve_and_write( if (mtr->log_mode == MTR_LOG_ALL) { - if (log_get_online_backup_state_low() - && mtr_first_to_modify_page_after_backup(mtr, - &n_modified_pages)) { - - /* The database is in the online backup state: write - to the log the full contents of all the pages if this - mtr is the first to modify any page in the buffer pool - after online_backup_lsn */ + block = mlog; - log_close(); - log_release(); - - mtr_log_write_backup_full_pages(mtr, n_modified_pages); - } else { - block = mlog; - - while (block != NULL) { - log_write_low(dyn_block_get_data(block), - dyn_block_get_used(block)); - block = dyn_array_get_next_block(mlog, block); - } + while (block != NULL) { + log_write_low(dyn_block_get_data(block), + dyn_block_get_used(block)); + block = dyn_array_get_next_block(mlog, block); } } else { ut_ad(mtr->log_mode == MTR_LOG_NONE); From 78f58ff38494c6483fd63e9f9d8824b34ebdbc44 Mon Sep 17 00:00:00 2001 From: "hf@deer.(none)" <> Date: Wed, 26 May 2004 21:40:27 +0500 Subject: [PATCH 2/4] Fix to make Windows compilation smoother --- VC++Files/innobase/innobase.dsp | 4 ---- client/mysql.cc | 16 ++++++++++++---- client/mysqldump.c | 13 ++++++++++--- include/mysql.h | 13 +++++++++++++ include/mysql_com.h | 9 --------- libmysql/libmysql.c | 8 ++++++++ libmysql/libmysql.def | 19 +------------------ libmysql_r/Makefile.am | 2 +- libmysqld/lib_sql.cc | 6 +++++- libmysqld/libmysqld.c | 12 ++++++++++++ libmysqld/libmysqld.def | 3 +-- sql/log_event.cc | 1 + tools/mysqlmanager.c | 2 +- 13 files changed, 65 insertions(+), 43 deletions(-) diff --git a/VC++Files/innobase/innobase.dsp b/VC++Files/innobase/innobase.dsp index 25e9d5d75b8..ea0aaeb3b83 100644 --- a/VC++Files/innobase/innobase.dsp +++ b/VC++Files/innobase/innobase.dsp @@ -368,10 +368,6 @@ SOURCE=.\row\row0vers.c # End Source File # Begin Source File -SOURCE=.\srv\srv0que.c -# End Source File -# Begin Source File - SOURCE=.\srv\srv0srv.c # End Source File # Begin Source File diff --git a/client/mysql.cc b/client/mysql.cc index 1fd909a397e..66a99bbdf75 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -129,6 +129,7 @@ static my_bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0, vertical=0, line_numbers=1, column_names=1,opt_html=0, opt_xml=0,opt_nopager=1, opt_outfile=0, named_cmds= 0, tty_password= 0, opt_nobeep=0; +static ulong opt_max_allowed_packet, opt_net_buffer_length; static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0; static my_string opt_mysql_unix_port=0; static int connect_flag=CLIENT_INTERACTIVE; @@ -330,7 +331,7 @@ int main(int argc,char *argv[]) exit(1); } if (status.batch && !status.line_buff && - !(status.line_buff=batch_readline_init(max_allowed_packet+512,stdin))) + !(status.line_buff=batch_readline_init(opt_max_allowed_packet+512,stdin))) { free_defaults(defaults_argv); exit(1); @@ -573,11 +574,11 @@ static struct my_option my_long_options[] = (gptr*) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 3600*12, 0, 0, 1}, {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, "", - (gptr*) &max_allowed_packet, (gptr*) &max_allowed_packet, 0, GET_ULONG, + (gptr*) &opt_max_allowed_packet, (gptr*) &opt_max_allowed_packet, 0, GET_ULONG, REQUIRED_ARG, 16 *1024L*1024L, 4096, (longlong) 2*1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0}, {"net_buffer_length", OPT_NET_BUFFER_LENGTH, "", - (gptr*) &net_buffer_length, (gptr*) &net_buffer_length, 0, GET_ULONG, + (gptr*) &opt_net_buffer_length, (gptr*) &opt_net_buffer_length, 0, GET_ULONG, REQUIRED_ARG, 16384, 1024, 512*1024*1024L, MALLOC_OVERHEAD, 1024, 0}, {"select_limit", OPT_SELECT_LIMIT, "", (gptr*) &select_limit, (gptr*) &select_limit, 0, GET_ULONG, REQUIRED_ARG, 1000L, 1, ~0L, 0, 1, 0}, @@ -738,6 +739,7 @@ static int get_options(int argc, char **argv) { char *tmp, *pagpoint; int ho_error; + MYSQL_PARAMETERS *mysql_params= mysql_get_parameters(); tmp= (char *) getenv("MYSQL_HOST"); if (tmp) @@ -753,9 +755,15 @@ static int get_options(int argc, char **argv) strmov(pager, pagpoint); strmov(default_pager, pager); + opt_max_allowed_packet= *mysql_params->p_max_allowed_packet; + opt_net_buffer_length= *mysql_params->p_net_buffer_length; + if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) exit(ho_error); + *mysql_params->p_max_allowed_packet= opt_max_allowed_packet; + *mysql_params->p_net_buffer_length= opt_net_buffer_length; + if (status.batch) /* disable pager and outfile in this case */ { strmov(default_pager, "stdout"); @@ -2164,7 +2172,7 @@ static int com_source(String *buffer, char *line) return put_info(buff, INFO_ERROR, 0); } - if (!(line_buff=batch_readline_init(max_allowed_packet+512,sql_file))) + if (!(line_buff=batch_readline_init(opt_max_allowed_packet+512,sql_file))) { my_fclose(sql_file,MYF(0)); return put_info("Can't initialize batch_readline", INFO_ERROR, 0); diff --git a/client/mysqldump.c b/client/mysqldump.c index 3f3746f2963..82c3ee53e33 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -79,6 +79,7 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick=0, extended_insert = 0, opt_autocommit=0,opt_master_data,opt_disable_keys=0,opt_xml=0, opt_delete_master_logs=0, tty_password=0, opt_single_transaction=0, opt_comments= 0; +static ulong opt_max_allowed_packet, opt_net_buffer_length; static MYSQL mysql_connection,*sock=0; static char insert_pat[12 * 1024],*opt_password=0,*current_user=0, *current_host=0,*path=0,*fields_terminated=0, @@ -87,7 +88,6 @@ static char insert_pat[12 * 1024],*opt_password=0,*current_user=0, static uint opt_mysql_port=0; static my_string opt_mysql_unix_port=0; static int first_error=0; -extern ulong net_buffer_length; static DYNAMIC_STRING extended_row; #include FILE *md_result_file; @@ -238,11 +238,11 @@ static struct my_option my_long_options[] = {"xml", 'X', "Dump a database as well formed XML.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, "", - (gptr*) &max_allowed_packet, (gptr*) &max_allowed_packet, 0, + (gptr*) &opt_max_allowed_packet, (gptr*) &opt_max_allowed_packet, 0, GET_ULONG, REQUIRED_ARG, 24*1024*1024, 4096, (longlong) 2L*1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0}, {"net_buffer_length", OPT_NET_BUFFER_LENGTH, "", - (gptr*) &net_buffer_length, (gptr*) &net_buffer_length, 0, + (gptr*) &opt_net_buffer_length, (gptr*) &opt_net_buffer_length, 0, GET_ULONG, REQUIRED_ARG, 1024*1024L-1025, 4096, 16*1024L*1024L, MALLOC_OVERHEAD-1024, 1024, 0}, {"comments", 'i', "Write additional information.", @@ -405,6 +405,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), static int get_options(int *argc, char ***argv) { int ho_error; + MYSQL_PARAMETERS *mysql_params= mysql_get_parameters(); + + opt_max_allowed_packet= *mysql_params->p_max_allowed_packet; + opt_net_buffer_length= *mysql_params->p_net_buffer_length; md_result_file= stdout; load_defaults("my",load_default_groups,argc,argv); @@ -412,6 +416,9 @@ static int get_options(int *argc, char ***argv) if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) exit(ho_error); + *mysql_params->p_max_allowed_packet= opt_max_allowed_packet; + *mysql_params->p_net_buffer_length= opt_net_buffer_length; + if (opt_delayed) opt_lock=0; /* Can't have lock with delayed */ if (!path && (enclosed || opt_enclosed || escaped || lines_terminated || diff --git a/include/mysql.h b/include/mysql.h index 3ffc014c449..1665dd5027e 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -244,6 +244,17 @@ typedef struct st_mysql_manager char last_error[MAX_MYSQL_MANAGER_ERR]; } MYSQL_MANAGER; +typedef struct st_mysql_parameters +{ + unsigned long *p_max_allowed_packet; + unsigned long *p_net_buffer_length; +} MYSQL_PARAMETERS; + +#if !defined(MYSQL_CLIENT) && !defined(MYSQL_SERVER) && !defined(EMBEDDED_LIBRARY) +#define max_allowed_packet (*mysql_get_parameters()->p_max_allowed_packet) +#define net_buffer_length (*mysql_get_parameters()->p_net_buffer_length) +#endif + /* Set up and bring down the server; to ensure that applications will work when linked against either the standard client library or the @@ -252,6 +263,8 @@ typedef struct st_mysql_manager int STDCALL mysql_server_init(int argc, char **argv, char **groups); void STDCALL mysql_server_end(void); +MYSQL_PARAMETERS *STDCALL mysql_get_parameters(); + /* Set up and bring down a thread; these function should be called for each thread in an application which opens at least one MySQL diff --git a/include/mysql_com.h b/include/mysql_com.h index c81c90dec22..94b864375ba 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -34,12 +34,6 @@ #define MYSQL_SERVICENAME "MySQL" #endif /* __WIN__ */ -#if defined(__WIN__) && !defined(MYSQL_SERVER) && !defined(MYSQL_CLIENT) && !defined(EMBEDDED_LIBRARY) -#define dll_import_spec __declspec( dllimport ) -#else -#define dll_import_spec -#endif - enum enum_server_command { COM_SLEEP, COM_QUIT, COM_INIT_DB, COM_QUERY, COM_FIELD_LIST, COM_CREATE_DB, COM_DROP_DB, COM_REFRESH, COM_SHUTDOWN, COM_STATISTICS, @@ -229,9 +223,6 @@ typedef struct st_udf_init extern "C" { #endif -dll_import_spec extern unsigned long max_allowed_packet; -dll_import_spec extern unsigned long net_buffer_length; - void randominit(struct rand_struct *,unsigned long seed1, unsigned long seed2); double my_rnd(struct rand_struct *); diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index dba9c83b339..0a23954ae67 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -121,6 +121,14 @@ void STDCALL mysql_server_end() mysql_client_init= org_my_init_done= 0; } +static MYSQL_PARAMETERS mysql_internal_parameters= +{&max_allowed_packet, &net_buffer_length}; + +MYSQL_PARAMETERS *STDCALL mysql_get_parameters() +{ + return &mysql_internal_parameters; +} + my_bool STDCALL mysql_thread_init() { #ifdef THREAD diff --git a/libmysql/libmysql.def b/libmysql/libmysql.def index 721097905a8..b0433a34cb3 100644 --- a/libmysql/libmysql.def +++ b/libmysql/libmysql.def @@ -59,7 +59,6 @@ EXPORTS is_prefix list_add list_delete - max_allowed_packet my_casecmp my_init my_end @@ -70,7 +69,6 @@ EXPORTS my_realloc mysql_thread_end mysql_thread_init - net_buffer_length set_dynamic strcend strdup_root @@ -111,19 +109,4 @@ EXPORTS load_defaults free_defaults my_path - - - - - - - - - - - - - - - - + mysql_get_parameters diff --git a/libmysql_r/Makefile.am b/libmysql_r/Makefile.am index ae091d86a88..04b6f3b6c6c 100644 --- a/libmysql_r/Makefile.am +++ b/libmysql_r/Makefile.am @@ -18,7 +18,7 @@ target = libmysqlclient_r.la -target_defs = -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@ +target_defs = -DDONT_USE_RAID -DMYSQL_CLIENT @LIB_EXTRA_CCFLAGS@ LIBS = @LIBS@ @openssl_libs@ INCLUDES = @MT_INCLUDES@ -I$(srcdir)/../include -I../include \ diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 4a96cb64ce4..0ec7d161f24 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -23,6 +23,11 @@ #define mysql_unix_port mysql_inix_port1 #define mysql_port mysql_port1 +extern "C" +{ + unsigned long max_allowed_packet, net_buffer_length; +} + #if defined (__WIN__) #include "../sql/mysqld.cpp" #else @@ -315,7 +320,6 @@ extern "C" static my_bool org_my_init_done; my_bool server_inited; -ulong max_allowed_packet, net_buffer_length; char ** copy_arguments_ptr= 0; int STDCALL mysql_server_init(int argc, char **argv, char **groups) diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c index 2e8cd2a4861..6f60e4c4fbc 100644 --- a/libmysqld/libmysqld.c +++ b/libmysqld/libmysqld.c @@ -46,6 +46,9 @@ #define INADDR_NONE -1 #endif +extern ulong net_buffer_length; +extern ulong max_allowed_packet; + static my_bool mysql_client_init=0; uint mysql_port=0; my_string mysql_unix_port=0; @@ -722,6 +725,15 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths) return 0; } +static MYSQL_PARAMETERS mysql_internal_parameters= +{&max_allowed_packet, &net_buffer_length}; + +MYSQL_PARAMETERS *STDCALL mysql_get_parameters() +{ + return &mysql_internal_parameters; +} + + /**************************************************************************** ** Init MySQL structure or allocate one ****************************************************************************/ diff --git a/libmysqld/libmysqld.def b/libmysqld/libmysqld.def index 1c9bdea0a01..8db8a846562 100644 --- a/libmysqld/libmysqld.def +++ b/libmysqld/libmysqld.def @@ -63,6 +63,5 @@ EXPORTS mysql_refresh mysql_odbc_escape_string myodbc_remove_escape - net_buffer_length - max_allowed_packet get_tty_password + mysql_get_parameters diff --git a/sql/log_event.cc b/sql/log_event.cc index f84c8d1f579..f94056694cc 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -532,6 +532,7 @@ end: #else #define UNLOCK_MUTEX #define LOCK_MUTEX +#define max_allowed_packet (*mysql_get_parameters()->p_max_allowed_packet) #endif // allocates memory - the caller is responsible for clean-up diff --git a/tools/mysqlmanager.c b/tools/mysqlmanager.c index 27dfa18e421..ade6da895c6 100644 --- a/tools/mysqlmanager.c +++ b/tools/mysqlmanager.c @@ -355,7 +355,7 @@ LOG_MSG_FUNC(log_info,LOG_INFO) #ifndef DBUG_OFF LOG_MSG_FUNC(log_debug,LOG_DEBUG) #else -void log_debug(const char* __attribute__((unused)) fmt,...) {} +void log_debug(const char* fmt __attribute__((unused)),...) {} #endif static void handle_sigterm(int sig __attribute__((unused))) From 9e983e629ed17adbd7753aa8196a2e172d3777c4 Mon Sep 17 00:00:00 2001 From: "marko@hundin.mysql.fi" <> Date: Wed, 26 May 2004 19:41:14 +0300 Subject: [PATCH 3/4] InnoDB fixup: remove debug assertion that causes compile error when UNIV_DEBUG is defined (introduced in ChangeSet@1.1850) --- innobase/que/que0que.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/innobase/que/que0que.c b/innobase/que/que0que.c index c53a31adc6f..0a2e607807a 100644 --- a/innobase/que/que0que.c +++ b/innobase/que/que0que.c @@ -190,8 +190,6 @@ que_thr_end_wait( ut_ad(mutex_own(&kernel_mutex)); #endif /* UNIV_SYNC_DEBUG */ ut_ad(thr); - ut_ad(next_thr); - ut_ad(*next_thr == NULL); ut_ad((thr->state == QUE_THR_LOCK_WAIT) || (thr->state == QUE_THR_PROCEDURE_WAIT) || (thr->state == QUE_THR_SIG_REPLY_WAIT)); From dab0b7d4159b6af8994cdc3de8324797e092c42c Mon Sep 17 00:00:00 2001 From: "monty@mysql.com" <> Date: Wed, 26 May 2004 21:45:58 +0300 Subject: [PATCH 4/4] VC++ portability fix --- VC++Files/client/mysqlclient.dsp | 4 ++-- VC++Files/innobase/innobase.dsp | 4 ---- sql/mysqld.cc | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/VC++Files/client/mysqlclient.dsp b/VC++Files/client/mysqlclient.dsp index 9bf131f8243..b557d4cbd0f 100644 --- a/VC++Files/client/mysqlclient.dsp +++ b/VC++Files/client/mysqlclient.dsp @@ -41,7 +41,7 @@ RSC=rc.exe # PROP Intermediate_Dir "release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /D "DBUG_OFF" /D "_WINDOWS" /D "USE_TLS" /D "NDEBUG" /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /D "DBUG_OFF" /D "_WINDOWS" /D "USE_TLS" /D "MYSQL_CLIENT" /D "NDEBUG" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 # ADD RSC /l 0x409 @@ -65,7 +65,7 @@ LIB32=xilink6.exe -lib # PROP Intermediate_Dir "debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_TLS" /FD /c +# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_TLS" /D "MYSQL_CLIENT" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 # ADD RSC /l 0x409 diff --git a/VC++Files/innobase/innobase.dsp b/VC++Files/innobase/innobase.dsp index ea0aaeb3b83..03a57191270 100644 --- a/VC++Files/innobase/innobase.dsp +++ b/VC++Files/innobase/innobase.dsp @@ -312,10 +312,6 @@ SOURCE=.\pars\pars0sym.c # End Source File # Begin Source File -SOURCE=.\que\que0que.c -# End Source File -# Begin Source File - SOURCE=.\read\read0read.c # End Source File # Begin Source File diff --git a/sql/mysqld.cc b/sql/mysqld.cc index b55121b3bc6..65903d7ce8a 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1473,7 +1473,7 @@ void mysql_cb_init() } -/ *To get the name of the NetWare volume having MySQL data folder */ +/* To get the name of the NetWare volume having MySQL data folder */ void getvolumename() {