From 9d68ccdeb8692b05d9cc0479d8d3757edbc49368 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Sun, 7 Nov 2010 14:25:29 +0200 Subject: [PATCH 1/7] Added option BACKUP_ALL to mysqld --myisam-recover to also get a backup of the index file before it's repaired. Removed wrong call to translog_buffer_unlock() that caused 'unlocking not locked mutex' failure in Aria log handler. extra/replace.c: Updated call to my_redel() include/maria.h: Updated prototype for maria_change_to_newfile include/my_sys.h: Updated prototypes Added my_create_backup_name include/myisam.h: Updated prototypes include/myisamchk.h: Added 'backup_time' to st_handler_check_param to be able to generate same name for backuped data and index file mysys/my_redel.c: Added time_t option to my_redel() to be able to generate same backup extensions for many files sql/handler.cc: Added start_time to st_ha_check_opt sql/handler.h: Added start_time to HA_CHECK_OPT sql/mysqld.cc: Added option BACKUP_ALL to --myisam-recover storage/maria/ha_maria.cc: Remember start time for repair storage/maria/ma_check.c: Use remembered start time for backup file names Removed some dead code storage/maria/ma_loghandler.c: Removed wrong call to translog_buffer_unlock() that caused 'unlocking not locked mutex' failure in log handler. storage/maria/maria_chk.c: Removed dead code (O_NEW_INDEX was never set) Report if table was 'crashed on repair' storage/maria/maria_pack.c: Updated parameters to my_redel() storage/myisam/ha_myisam.cc: Added recover option BACKUP_ALL to get a backup of the index file before it's repaired. Print information to log if we make a backup of data as part of repair. storage/myisam/ha_myisam.h: Added HA_RECOVER_FULL_BACKUP storage/myisam/mi_check.c: Use remembered start time for backup file names Added mi_make_backup_of_index() storage/myisam/myisamchk.c: Removed dead code (O_NEW_INDEX was never set) Report if table was 'crashed on repair' storage/myisam/myisampack.c: Updated call to my_redel() --- extra/replace.c | 2 +- include/maria.h | 3 ++- include/my_sys.h | 8 +++++++- include/myisam.h | 5 ++++- include/myisamchk.h | 3 ++- mysys/my_redel.c | 33 +++++++++++++++++++++++++-------- sql/handler.cc | 1 + sql/handler.h | 1 + sql/mysqld.cc | 8 ++++++-- storage/maria/ha_maria.cc | 1 + storage/maria/ma_check.c | 19 +++++++------------ storage/maria/ma_loghandler.c | 3 --- storage/maria/maria_chk.c | 9 ++++----- storage/maria/maria_pack.c | 2 +- storage/myisam/ha_myisam.cc | 15 +++++++++++++-- storage/myisam/ha_myisam.h | 1 + storage/myisam/mi_check.c | 24 ++++++++++++++++++------ storage/myisam/myisamchk.c | 10 ++++------ storage/myisam/myisampack.c | 2 +- 19 files changed, 99 insertions(+), 51 deletions(-) diff --git a/extra/replace.c b/extra/replace.c index 40bddf6d8fb..47993857a43 100644 --- a/extra/replace.c +++ b/extra/replace.c @@ -1085,7 +1085,7 @@ static int convert_file(REPLACE *rep, char * name) my_fclose(in,MYF(0)); my_fclose(out,MYF(0)); if (updated && ! error) - my_redel(org_name,tempname,MYF(MY_WME | MY_LINK_WARNING)); + my_redel(org_name, tempname, 0, MYF(MY_WME | MY_LINK_WARNING)); else my_delete(tempname,MYF(MY_WME)); if (!silent && ! error) diff --git a/include/maria.h b/include/maria.h index 106aa61ddbb..fb09116a24c 100644 --- a/include/maria.h +++ b/include/maria.h @@ -430,7 +430,8 @@ int maria_repair_by_sort(HA_CHECK *param, MARIA_HA *info, int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info, const char *name, my_bool rep_quick); int maria_change_to_newfile(const char *filename, const char *old_ext, - const char *new_ext, myf myflags); + const char *new_ext, time_t backup_time, + myf myflags); void maria_lock_memory(HA_CHECK *param); int maria_update_state_info(HA_CHECK *param, MARIA_HA *info, uint update); void maria_update_key_parts(MARIA_KEYDEF *keyinfo, double *rec_per_key_part, diff --git a/include/my_sys.h b/include/my_sys.h index 2f8a44fedc0..6f5e0328fe9 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -135,6 +135,9 @@ extern int NEAR my_errno; /* Last error in mysys */ #define GETDATE_GMT 8 #define GETDATE_FIXEDLENGTH 16 +/* Extra length needed for filename if one calls my_create_backup_name */ +#define MY_BACKUP_NAME_EXTRA_LENGTH 17 + /* defines when allocating data */ #ifdef SAFEMALLOC #define my_malloc(SZ,FLAG) _mymalloc((SZ), __FILE__, __LINE__, FLAG ) @@ -685,7 +688,10 @@ extern int my_message_no_curses(uint my_err, const char *str,myf MyFlags); extern int my_message_curses(uint my_err, const char *str,myf MyFlags); extern my_bool my_init(void); extern void my_end(int infoflag); -extern int my_redel(const char *from, const char *to, int MyFlags); +extern int my_redel(const char *from, const char *to, time_t backup_time_stamp, + myf MyFlags); +void my_create_backup_name(char *to, const char *from, + time_t backup_time_stamp); extern int my_copystat(const char *from, const char *to, int MyFlags); extern char * my_filename(File fd); diff --git a/include/myisam.h b/include/myisam.h index 8413b7936e3..bf31a96b792 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -295,6 +295,8 @@ extern int mi_is_changed(struct st_myisam_info *info); extern int mi_delete_all_rows(struct st_myisam_info *info); extern ulong _mi_calc_blob_length(uint length , const uchar *pos); extern uint mi_get_pointer_length(ulonglong file_length, uint def); +extern int mi_make_backup_of_index(struct st_myisam_info *info, + time_t backup_time, myf flags); #define MEMMAP_EXTRA_MARGIN 7 /* Write this as a suffix for mmap file */ /* this is used to pass to mysql_myisamchk_table */ @@ -390,7 +392,8 @@ int mi_repair_by_sort(HA_CHECK *param, register MI_INFO *info, int mi_repair_parallel(HA_CHECK *param, register MI_INFO *info, const char * name, int rep_quick); int change_to_newfile(const char * filename, const char * old_ext, - const char * new_ext, uint raid_chunks, + const char * new_ext, time_t backup_time, + uint raid_chunks, myf myflags); int lock_file(HA_CHECK *param, File file, my_off_t start, int lock_type, const char *filetype, const char *filename); diff --git a/include/myisamchk.h b/include/myisamchk.h index 057c06652a1..7d7100bdd71 100644 --- a/include/myisamchk.h +++ b/include/myisamchk.h @@ -74,7 +74,7 @@ #define TT_USEFRM 1 #define TT_FOR_UPGRADE 2 -#define O_NEW_INDEX 1 /* Bits set in out_flag */ +/* Bits set in out_flag */ #define O_NEW_DATA 2 #define O_DATA_LOST 4 @@ -141,6 +141,7 @@ typedef struct st_handler_check_param ulonglong use_buffers; /* Used as param to getopt() */ size_t read_buffer_length, write_buffer_length; size_t sort_buffer_length, sort_key_blocks; + time_t backup_time; /* To sign backup files */ ulong rec_per_key_part[HA_MAX_KEY_SEG * HA_MAX_POSSIBLE_KEY]; double new_rec_per_key_part[HA_MAX_KEY_SEG * HA_MAX_POSSIBLE_KEY]; uint out_flag, warning_printed, error_printed, verbose; diff --git a/mysys/my_redel.c b/mysys/my_redel.c index cf0986a7821..2de989a2854 100644 --- a/mysys/my_redel.c +++ b/mysys/my_redel.c @@ -40,7 +40,8 @@ struct utimbuf { #define REDEL_EXT ".BAK" -int my_redel(const char *org_name, const char *tmp_name, myf MyFlags) +int my_redel(const char *org_name, const char *tmp_name, + time_t backup_time_stamp, myf MyFlags) { int error=1; DBUG_ENTER("my_redel"); @@ -51,13 +52,9 @@ int my_redel(const char *org_name, const char *tmp_name, myf MyFlags) goto end; if (MyFlags & MY_REDEL_MAKE_BACKUP) { - char name_buff[FN_REFLEN+20]; - char ext[20]; - ext[0]='-'; - get_date(ext+1,2+4,(time_t) 0); - strmov(strend(ext),REDEL_EXT); - if (my_rename(org_name, fn_format(name_buff, org_name, "", ext, 2), - MyFlags)) + char name_buff[FN_REFLEN + MY_BACKUP_NAME_EXTRA_LENGTH]; + my_create_backup_name(name_buff, org_name, backup_time_stamp); + if (my_rename(org_name, name_buff, MyFlags)) goto end; } else if (my_delete_allow_opened(org_name, MyFlags)) @@ -149,3 +146,23 @@ int my_copystat(const char *from, const char *to, int MyFlags) #endif return 0; } /* my_copystat */ + + +/** + Create a backup file name. + @fn my_create_backup_name() + @param to Store new file name here + @param from Original name + + @info + The backup name is made by adding -YYMMDDHHMMSS.BAK to the file name +*/ + +void my_create_backup_name(char *to, const char *from, time_t backup_start) +{ + char ext[MY_BACKUP_NAME_EXTRA_LENGTH+1]; + ext[0]='-'; + get_date(ext+1, GETDATE_SHORT_DATE | GETDATE_HHMMSSTIME, backup_start); + strmov(strend(ext),REDEL_EXT); + strmov(strmov(to, from), ext); +} diff --git a/sql/handler.cc b/sql/handler.cc index b849cfafc19..d45692e8465 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -3732,6 +3732,7 @@ int ha_create_table_from_engine(THD* thd, const char *db, const char *name) void st_ha_check_opt::init() { flags= sql_flags= 0; + start_time= my_time(0); } diff --git a/sql/handler.h b/sql/handler.h index e5972aa8a8c..862da3d2ca7 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1021,6 +1021,7 @@ typedef struct st_ha_check_opt st_ha_check_opt() {} /* Remove gcc warning */ uint flags; /* isam layer flags (e.g. for myisamchk) */ uint sql_flags; /* sql layer flags - for something myisamchk cannot do */ + time_t start_time; /* When check/repair starts */ KEY_CACHE *key_cache; /* new key cache when changing key cache */ void init(); } HA_CHECK_OPT; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 9e7b88dc170..c2670308b8a 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -6456,7 +6456,7 @@ each time the SQL thread starts.", 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, #endif {"myisam-recover", OPT_MYISAM_RECOVER, - "Syntax: myisam-recover=OFF or myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP, FORCE or QUICK.", + "Syntax: myisam-recover=OFF or myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP, BACKUP_ALL, FORCE or QUICK.", &myisam_recover_options_str, &myisam_recover_options_str, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE @@ -7503,7 +7503,11 @@ thread is in the relay logs.", 1024, 0}, {"thread_handling", OPT_THREAD_HANDLING, "Define threads usage for handling queries: " - "one-thread-per-connection or no-threads.", + "one-thread-per-connection" +#if HAVE_POOL_OF_THREADS == 1 + ", pool-of-threads" +#endif + "or no-threads.", &opt_thread_handling, &opt_thread_handling, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"updatable_views_with_limit", OPT_UPDATABLE_VIEWS_WITH_LIMIT, diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 2b26de17875..6852e84fc65 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -1316,6 +1316,7 @@ int ha_maria::repair(THD * thd, HA_CHECK_OPT *check_opt) T_SILENT | T_FORCE_CREATE | T_CALC_CHECKSUM | (check_opt->flags & T_EXTEND ? T_REP : T_REP_BY_SORT)); param.sort_buffer_length= THDVAR(thd, sort_buffer_size); + param.backup_time= check_opt->start_time; start_records= file->state->records; while ((error= repair(thd, ¶m, 0)) && param.retry_repair) { diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index f0702d95554..fcf01385e97 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -2743,7 +2743,7 @@ int maria_repair(HA_CHECK *param, register MARIA_HA *info, new_file= -1; change_data_file_descriptor(info, -1); if (maria_change_to_newfile(share->data_file_name.str, MARIA_NAME_DEXT, - DATA_TMP_EXT, + DATA_TMP_EXT, param->backup_time, (param->testflag & T_BACKUP_DATA ? MYF(MY_REDEL_MAKE_BACKUP): MYF(0)) | sync_dir) || @@ -3059,7 +3059,7 @@ int maria_sort_index(HA_CHECK *param, register MARIA_HA *info, char *name) pthread_mutex_unlock(&share->intern_lock); VOID(my_close(new_file,MYF(MY_WME))); if (maria_change_to_newfile(share->index_file_name.str, MARIA_NAME_IEXT, - INDEX_TMP_EXT, sync_dir) || + INDEX_TMP_EXT, 0, sync_dir) || _ma_open_keyfile(share)) goto err2; info->lock_type= F_UNLCK; /* Force maria_readinfo to lock */ @@ -3492,20 +3492,15 @@ int maria_zerofill(HA_CHECK *param, MARIA_HA *info, const char *name) */ int maria_change_to_newfile(const char * filename, const char * old_ext, - const char * new_ext, myf MyFlags) + const char * new_ext, time_t backup_time, + myf MyFlags) { char old_filename[FN_REFLEN],new_filename[FN_REFLEN]; -#ifdef USE_RAID - if (raid_chunks) - return my_raid_redel(fn_format(old_filename,filename,"",old_ext,2+4), - fn_format(new_filename,filename,"",new_ext,2+4), - raid_chunks, - MYF(MY_WME | MY_LINK_WARNING | MyFlags)); -#endif /* Get real path to filename */ (void) fn_format(old_filename,filename,"",old_ext,2+4+32); return my_redel(old_filename, fn_format(new_filename,old_filename,"",new_ext,2+4), + backup_time, MYF(MY_WME | MY_LINK_WARNING | MyFlags)); } /* maria_change_to_newfile */ @@ -3875,7 +3870,7 @@ int maria_repair_by_sort(HA_CHECK *param, register MARIA_HA *info, } change_data_file_descriptor(info, -1); if (maria_change_to_newfile(share->data_file_name.str, MARIA_NAME_DEXT, - DATA_TMP_EXT, + DATA_TMP_EXT, param->backup_time, (param->testflag & T_BACKUP_DATA ? MYF(MY_REDEL_MAKE_BACKUP): MYF(0)) | sync_dir) || @@ -4500,7 +4495,7 @@ err: my_close(new_file,MYF(0)); info->dfile.file= new_file= -1; if (maria_change_to_newfile(share->data_file_name.str, MARIA_NAME_DEXT, - DATA_TMP_EXT, + DATA_TMP_EXT, param->backup_time, MYF((param->testflag & T_BACKUP_DATA ? MY_REDEL_MAKE_BACKUP : 0) | sync_dir)) || diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index be86740d822..1cc4140081a 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -2500,10 +2500,7 @@ my_bool translog_prev_buffer_flush_wait(struct st_translog_buffer *buffer) pthread_cond_wait(&buffer->prev_sent_to_disk_cond, &buffer->mutex); if (buffer->file != file || buffer->offset != offset || buffer->ver != ver) - { - translog_buffer_unlock(buffer); DBUG_RETURN(1); /* some the thread flushed the buffer already */ - } } while(buffer->prev_buffer_offset != buffer->prev_sent_to_disk); } DBUG_RETURN(0); diff --git a/storage/maria/maria_chk.c b/storage/maria/maria_chk.c index 9efdcb24abf..d065070693f 100644 --- a/storage/maria/maria_chk.c +++ b/storage/maria/maria_chk.c @@ -1211,7 +1211,7 @@ static int maria_chk(HA_CHECK *param, char *filename) { /* Change temp file to org file */ VOID(my_close(info->dfile.file, MYF(MY_WME))); /* Close new file */ error|=maria_change_to_newfile(filename,MARIA_NAME_DEXT,DATA_TMP_EXT, - MYF(0)); + 0, MYF(0)); if (_ma_open_datafile(info,info->s, NullS, -1)) error=1; param->out_flag&= ~O_NEW_DATA; /* We are using new datafile */ @@ -1349,11 +1349,9 @@ end2: { if (param->out_flag & O_NEW_DATA) error|=maria_change_to_newfile(filename,MARIA_NAME_DEXT,DATA_TMP_EXT, + param->backup_time, ((param->testflag & T_BACKUP_DATA) ? MYF(MY_REDEL_MAKE_BACKUP) : MYF(0))); - if (param->out_flag & O_NEW_INDEX) - error|=maria_change_to_newfile(filename,MARIA_NAME_IEXT,INDEX_TMP_EXT, - MYF(0)); } if (opt_transaction_logging && share->base.born_transactional && !error && @@ -1457,7 +1455,8 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, char *name) printf("UUID: %s\n", buff); pos=buff; if (share->state.changed & STATE_CRASHED) - strmov(buff,"crashed"); + strmov(buff, share->state.changed & STATE_CRASHED_ON_REPAIR ? + "crashed on repair" : "crashed"); else { if (share->state.open_count) diff --git a/storage/maria/maria_pack.c b/storage/maria/maria_pack.c index 167d0af3078..3e0ea3d571c 100644 --- a/storage/maria/maria_pack.c +++ b/storage/maria/maria_pack.c @@ -736,7 +736,7 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table) VOID(my_delete(new_name,MYF(MY_WME))); } else - error=my_redel(org_name,new_name,MYF(MY_WME | MY_COPYTIME)); + error=my_redel(org_name, new_name, 0, MYF(MY_WME | MY_COPYTIME)); } if (! error) error=save_state(isam_file,mrg,new_length,glob_crc); diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index ae4c9131c42..1a9c80316f4 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -33,7 +33,7 @@ ulong myisam_recover_options= HA_RECOVER_NONE; /* bits in myisam_recover_options */ const char *myisam_recover_names[] = -{ "DEFAULT", "BACKUP", "FORCE", "QUICK", NullS}; +{ "DEFAULT", "BACKUP", "FORCE", "QUICK", "BACKUP_ALL", NullS}; TYPELIB myisam_recover_typelib= {array_elements(myisam_recover_names)-1,"", myisam_recover_names, NULL}; @@ -1057,6 +1057,7 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt) T_SILENT | T_FORCE_CREATE | T_CALC_CHECKSUM | (check_opt->flags & T_EXTEND ? T_REP : T_REP_BY_SORT)); param.sort_buffer_length= thd->variables.myisam_sort_buff_size; + param.backup_time= check_opt->start_time; start_records=file->state->records; while ((error=repair(thd,param,0)) && param.retry_repair) { @@ -1661,8 +1662,18 @@ bool ha_myisam::check_and_repair(THD *thd) if ((marked_crashed= mi_is_crashed(file)) || check(thd, &check_opt)) { sql_print_warning("Recovering table: '%s'",table->s->path.str); + if (myisam_recover_options & (HA_RECOVER_FULL_BACKUP | HA_RECOVER_BACKUP)) + { + char buff[MY_BACKUP_NAME_EXTRA_LENGTH+1]; + my_create_backup_name(buff, "", check_opt.start_time); + sql_print_information("Making backup of data with extension '%s'", buff); + } + if (myisam_recover_options & HA_RECOVER_FULL_BACKUP) + mi_make_backup_of_index(file, check_opt.start_time, + MYF(MY_WME | ME_JUST_WARNING)); check_opt.flags= - ((myisam_recover_options & HA_RECOVER_BACKUP ? T_BACKUP_DATA : 0) | + (((myisam_recover_options & + (HA_RECOVER_BACKUP | HA_RECOVER_FULL_BACKUP)) ? T_BACKUP_DATA : 0) | (marked_crashed ? 0 : T_QUICK) | (myisam_recover_options & HA_RECOVER_FORCE ? 0 : T_SAFE_REPAIR) | T_AUTO_REPAIR); diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h index b7d15a6e8b7..0e53bc58c81 100644 --- a/storage/myisam/ha_myisam.h +++ b/storage/myisam/ha_myisam.h @@ -29,6 +29,7 @@ #define HA_RECOVER_BACKUP 2 /* Make a backupfile on recover */ #define HA_RECOVER_FORCE 4 /* Recover even if we loose rows */ #define HA_RECOVER_QUICK 8 /* Don't check rows in data file */ +#define HA_RECOVER_FULL_BACKUP 16 /* Make a copy of index file too */ extern ulong myisam_sort_buffer_size; extern TYPELIB myisam_recover_typelib; diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index 8f732db234c..68565777b43 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -1733,7 +1733,9 @@ err: my_close(new_file,MYF(0)); info->dfile=new_file= -1; if (change_to_newfile(share->data_file_name,MI_NAME_DEXT, - DATA_TMP_EXT, share->base.raid_chunks, + DATA_TMP_EXT, + param->backup_time, + share->base.raid_chunks, (param->testflag & T_BACKUP_DATA ? MYF(MY_REDEL_MAKE_BACKUP): MYF(0))) || mi_open_datafile(info,share,name,-1)) @@ -1991,8 +1993,8 @@ int mi_sort_index(HA_CHECK *param, register MI_INFO *info, char * name) VOID(my_close(share->kfile,MYF(MY_WME))); share->kfile = -1; VOID(my_close(new_file,MYF(MY_WME))); - if (change_to_newfile(share->index_file_name,MI_NAME_IEXT,INDEX_TMP_EXT,0, - MYF(0)) || + if (change_to_newfile(share->index_file_name,MI_NAME_IEXT,INDEX_TMP_EXT, + 0, 0, MYF(0)) || mi_open_keyfile(share)) goto err2; info->lock_type= F_UNLCK; /* Force mi_readinfo to lock */ @@ -2121,6 +2123,7 @@ err: int change_to_newfile(const char * filename, const char * old_ext, const char * new_ext, + time_t backup_time, uint raid_chunks __attribute__((unused)), myf MyFlags) { @@ -2136,7 +2139,7 @@ int change_to_newfile(const char * filename, const char * old_ext, (void) fn_format(old_filename,filename,"",old_ext,2+4+32); return my_redel(old_filename, fn_format(new_filename,old_filename,"",new_ext,2+4), - MYF(MY_WME | MY_LINK_WARNING | MyFlags)); + backup_time, MYF(MY_WME | MY_LINK_WARNING | MyFlags)); } /* change_to_newfile */ @@ -2544,7 +2547,8 @@ err: my_close(new_file,MYF(0)); info->dfile=new_file= -1; if (change_to_newfile(share->data_file_name,MI_NAME_DEXT, - DATA_TMP_EXT, share->base.raid_chunks, + DATA_TMP_EXT, param->backup_time, + share->base.raid_chunks, (param->testflag & T_BACKUP_DATA ? MYF(MY_REDEL_MAKE_BACKUP): MYF(0))) || mi_open_datafile(info,share,name,-1)) @@ -3081,7 +3085,8 @@ err: my_close(new_file,MYF(0)); info->dfile=new_file= -1; if (change_to_newfile(share->data_file_name,MI_NAME_DEXT, - DATA_TMP_EXT, share->base.raid_chunks, + DATA_TMP_EXT, param->backup_time, + share->base.raid_chunks, (param->testflag & T_BACKUP_DATA ? MYF(MY_REDEL_MAKE_BACKUP): MYF(0))) || mi_open_datafile(info,share,name,-1)) @@ -4743,3 +4748,10 @@ set_data_file_type(MI_SORT_INFO *sort_info, MYISAM_SHARE *share) share->delete_record=tmp.delete_record; } } + +int mi_make_backup_of_index(MI_INFO *info, time_t backup_time, myf flags) +{ + char backup_name[FN_REFLEN + MY_BACKUP_NAME_EXTRA_LENGTH]; + my_create_backup_name(backup_name, info->s->index_file_name, backup_time); + return my_copy(info->s->index_file_name, backup_name, flags); +} diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index 9ecbe76369f..b2344b3be7f 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -1032,7 +1032,7 @@ static int myisamchk(HA_CHECK *param, char * filename) { /* Change temp file to org file */ VOID(my_close(info->dfile,MYF(MY_WME))); /* Close new file */ error|=change_to_newfile(filename,MI_NAME_DEXT,DATA_TMP_EXT, - raid_chunks, + 0, raid_chunks, MYF(0)); if (mi_open_datafile(info,info->s, NULL, -1)) error=1; @@ -1164,12 +1164,9 @@ end2: { if (param->out_flag & O_NEW_DATA) error|=change_to_newfile(filename,MI_NAME_DEXT,DATA_TMP_EXT, - raid_chunks, + param->backup_time, raid_chunks, ((param->testflag & T_BACKUP_DATA) ? MYF(MY_REDEL_MAKE_BACKUP) : MYF(0))); - if (param->out_flag & O_NEW_INDEX) - error|=change_to_newfile(filename,MI_NAME_IEXT,INDEX_TMP_EXT,0, - MYF(0)); } VOID(fflush(stdout)); VOID(fflush(stderr)); if (param->error_printed) @@ -1241,7 +1238,8 @@ static void descript(HA_CHECK *param, register MI_INFO *info, char * name) } pos=buff; if (share->state.changed & STATE_CRASHED) - strmov(buff,"crashed"); + strmov(buff, share->state.changed & STATE_CRASHED_ON_REPAIR ? + "crashed on repair" : "crashed"); else { if (share->state.open_count) diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c index f2b28a008fc..ba3ff3cdf0d 100644 --- a/storage/myisam/myisampack.c +++ b/storage/myisam/myisampack.c @@ -720,7 +720,7 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table) VOID(my_delete(new_name,MYF(MY_WME))); } else - error=my_redel(org_name,new_name,MYF(MY_WME | MY_COPYTIME)); + error=my_redel(org_name, new_name, 0, MYF(MY_WME | MY_COPYTIME)); } if (! error) error=save_state(isam_file,mrg,new_length,glob_crc); From d95cbe369c2a5d617884f795936ccbeb3c06ce6c Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Mon, 15 Nov 2010 22:44:41 +0200 Subject: [PATCH 2/7] Fixed bug discovered by testcase for LP#618558 (original bug seams to be fixed): - Fixed bug in pagecache_delete_internal() when deleting block that was flushed by another thread (fixed bug when block->next_used was unexpectedly null) Fixed some using uninitialized memory warnings found by valgrind. mysql-test/t/information_schema_all_engines-master.opt: Added options to make slow test run faster sql/sp.cc: Fixed valgrind warning. sql/sql_show.cc: Fixed valgrind warning. storage/maria/ma_bitmap.c: Fixed wrong call parameter to pagecache_unlock_by_link() that caused assert crash in pagecache storage/maria/ma_pagecache.c: Fixed possible error in pagecache_wait_lock() when hash_link was not set. (We never hit this issue, but could be possible when two threads updates the same page. Fixed bug in pagecache_delete_internal() when deleting block that was flushed by another thread (fixed bug when block->next_used was unexpectedly null) Cleanup: moved pagecache_pthread_mutex_unlock() over comments and asserts to be just before pagecache_fwrite() --- .../information_schema_all_engines-master.opt | 1 + sql/sp.cc | 2 +- sql/sql_show.cc | 2 +- storage/maria/ma_bitmap.c | 2 +- storage/maria/ma_pagecache.c | 50 +++++++++++++++---- 5 files changed, 45 insertions(+), 12 deletions(-) create mode 100644 mysql-test/t/information_schema_all_engines-master.opt diff --git a/mysql-test/t/information_schema_all_engines-master.opt b/mysql-test/t/information_schema_all_engines-master.opt new file mode 100644 index 00000000000..d630799e4bd --- /dev/null +++ b/mysql-test/t/information_schema_all_engines-master.opt @@ -0,0 +1 @@ +--skip-safemalloc --mutex-deadlock-detector=0 diff --git a/sql/sp.cc b/sql/sp.cc index bcfcb0c4f36..98667f31b80 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -783,7 +783,7 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp, { Parser_state parser_state; - if (parser_state.init(thd, defstr.c_ptr(), defstr.length())) + if (parser_state.init(thd, defstr.c_ptr_safe(), defstr.length())) { ret= SP_INTERNAL_ERROR; goto end; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 8266594081c..653428fa793 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -3944,7 +3944,7 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables, base_type [(dimension)] [unsigned] [zerofill]. For DATA_TYPE column we extract only base type. */ - tmp_buff= strchr(type.ptr(), '('); + tmp_buff= strchr(type.c_ptr_safe(), '('); if (!tmp_buff) /* if there is no dimention part then check the presence of diff --git a/storage/maria/ma_bitmap.c b/storage/maria/ma_bitmap.c index c0763b0612d..7e68437de2b 100644 --- a/storage/maria/ma_bitmap.c +++ b/storage/maria/ma_bitmap.c @@ -492,7 +492,7 @@ static void _ma_bitmap_unpin_all(MARIA_SHARE *share) while (pinned_page-- != page_link) pagecache_unlock_by_link(share->pagecache, pinned_page->link, pinned_page->unlock, PAGECACHE_UNPIN, - LSN_IMPOSSIBLE, LSN_IMPOSSIBLE, TRUE, TRUE); + LSN_IMPOSSIBLE, LSN_IMPOSSIBLE, FALSE, TRUE); bitmap->pinned_pages.elements= 0; DBUG_VOID_RETURN; } diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c index 441310a60ea..f79b1f53022 100644 --- a/storage/maria/ma_pagecache.c +++ b/storage/maria/ma_pagecache.c @@ -2037,12 +2037,12 @@ restart: KEYCACHE_DBUG_PRINT("find_block", ("block is dirty")); - pagecache_pthread_mutex_unlock(&pagecache->cache_lock); /* The call is thread safe because only the current thread might change the block->hash_link value */ DBUG_ASSERT(block->pins == 0); + pagecache_pthread_mutex_unlock(&pagecache->cache_lock); error= pagecache_fwrite(pagecache, &block->hash_link->file, block->buffer, @@ -2255,14 +2255,17 @@ static my_bool pagecache_wait_lock(PAGECACHE *pagecache, #endif PCBLOCK_INFO(block); if ((block->status & (PCBLOCK_REASSIGNED | PCBLOCK_IN_SWITCH)) || + !block->hash_link || file.file != block->hash_link->file.file || pageno != block->hash_link->pageno) { DBUG_PRINT("info", ("the block 0x%lx changed => need retry " "status: %x files %d != %d or pages %lu != %lu", (ulong)block, block->status, - file.file, block->hash_link->file.file, - (ulong) pageno, (ulong) block->hash_link->pageno)); + file.file, + block->hash_link ? block->hash_link->file.file : -1, + (ulong) pageno, + (ulong) (block->hash_link ? block->hash_link->pageno : 0))); DBUG_RETURN(1); } DBUG_RETURN(0); @@ -2611,12 +2614,12 @@ static void read_block(PAGECACHE *pagecache, */ pagecache->global_cache_read++; - /* Page is not in buffer yet, is to be read from disk */ - pagecache_pthread_mutex_unlock(&pagecache->cache_lock); /* + Page is not in buffer yet, is to be read from disk Here other threads may step in and register as secondary readers. They will register in block->wqueue[COND_FOR_REQUESTED]. */ + pagecache_pthread_mutex_unlock(&pagecache->cache_lock); error= pagecache_fread(pagecache, &block->hash_link->file, block->buffer, block->hash_link->pageno, @@ -3450,6 +3453,14 @@ static my_bool pagecache_delete_internal(PAGECACHE *pagecache, my_bool flush) { my_bool error= 0; + if (block->status & PCBLOCK_IN_FLUSH) + { + /* + this call is just 'hint' for the cache to free the page so we will + not interferes with flushing process but gust return success + */ + goto out; + } if (block->status & PCBLOCK_CHANGED) { if (flush) @@ -3458,12 +3469,12 @@ static my_bool pagecache_delete_internal(PAGECACHE *pagecache, KEYCACHE_DBUG_PRINT("find_block", ("block is dirty")); - pagecache_pthread_mutex_unlock(&pagecache->cache_lock); /* The call is thread safe because only the current thread might change the block->hash_link value */ DBUG_ASSERT(block->pins == 1); + pagecache_pthread_mutex_unlock(&pagecache->cache_lock); error= pagecache_fwrite(pagecache, &block->hash_link->file, block->buffer, @@ -3478,7 +3489,25 @@ static my_bool pagecache_delete_internal(PAGECACHE *pagecache, block->status|= PCBLOCK_ERROR; block->error= (int16) my_errno; my_debug_put_break_here(); - goto err; + goto out; + } + } + else + { + PAGECACHE_FILE *filedesc= &block->hash_link->file; + /* We are not going to write the page but have to call callbacks */ + DBUG_PRINT("info", ("flush_callback :0x%lx data: 0x%lx" + "write_callback: 0x%lx data: 0x%lx", + (ulong) filedesc->write_callback, + (ulong) filedesc->callback_data)); + if ((*filedesc->flush_log_callback) + (block->buffer, block->hash_link->pageno, filedesc->callback_data) || + (*filedesc->write_callback) + (block->buffer, block->hash_link->pageno, filedesc->callback_data)) + { + DBUG_PRINT("error", ("flush or write callback problem")); + error= 1; + goto out; } } pagecache->blocks_changed--; @@ -3498,7 +3527,7 @@ static my_bool pagecache_delete_internal(PAGECACHE *pagecache, /* See NOTE for pagecache_unlock about registering requests. */ free_block(pagecache, block); -err: +out: dec_counter_for_resize_op(pagecache); return error; } @@ -4087,6 +4116,7 @@ static void free_block(PAGECACHE *pagecache, PAGECACHE_BLOCK_LINK *block) ("block: %u hash_link 0x%lx", PCBLOCK_NUMBER(pagecache, block), (long) block->hash_link)); + safe_mutex_assert_owner(&pagecache->cache_lock); if (block->hash_link) { /* @@ -4114,6 +4144,8 @@ static void free_block(PAGECACHE *pagecache, PAGECACHE_BLOCK_LINK *block) KEYCACHE_DBUG_PRINT("free_block", ("block is freed")); unreg_request(pagecache, block, 0); + DBUG_ASSERT(block->requests == 0); + DBUG_ASSERT(block->next_used != 0); block->hash_link= NULL; /* Remove the free block from the LRU ring. */ @@ -4223,7 +4255,6 @@ static int flush_cached_blocks(PAGECACHE *pagecache, DBUG_PRINT("info", ("block: %u (0x%lx) to be flushed", PCBLOCK_NUMBER(pagecache, block), (ulong)block)); PCBLOCK_INFO(block); - pagecache_pthread_mutex_unlock(&pagecache->cache_lock); DBUG_PRINT("info", ("block: %u (0x%lx) pins: %u", PCBLOCK_NUMBER(pagecache, block), (ulong)block, block->pins)); @@ -4237,6 +4268,7 @@ static int flush_cached_blocks(PAGECACHE *pagecache, content (see StaleFilePointersInFlush in ma_checkpoint.c). @todo change argument of functions to be File. */ + pagecache_pthread_mutex_unlock(&pagecache->cache_lock); error= pagecache_fwrite(pagecache, &block->hash_link->file, block->buffer, block->hash_link->pageno, From 769f6dea9d5619e08e52532969aac164533b1f73 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 16 Nov 2010 12:32:36 +0200 Subject: [PATCH 3/7] Fixed mess in the types. --- sql/item.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sql/item.h b/sql/item.h index d923fb932cb..474316ed25f 100644 --- a/sql/item.h +++ b/sql/item.h @@ -488,8 +488,7 @@ public: FIELD_VARIANCE_ITEM, INSERT_VALUE_ITEM, SUBSELECT_ITEM, ROW_ITEM, CACHE_ITEM, TYPE_HOLDER, PARAM_ITEM, TRIGGER_FIELD_ITEM, DECIMAL_ITEM, - XPATH_NODESET, XPATH_NODESET_CMP, - VIEW_FIXER_ITEM}; + XPATH_NODESET, XPATH_NODESET_CMP}; enum cond_result { COND_UNDEF,COND_OK,COND_TRUE,COND_FALSE }; @@ -2908,7 +2907,8 @@ public: { return Item_field::save_in_field(field_arg, no_conversions); } - /* + enum Type type() const { return INSERT_VALUE_ITEM; } + /* We use RAND_TABLE_BIT to prevent Item_insert_value from being treated as a constant and precalculated before execution */ From 7a80bf165b1907acbdccf8dd46681df365dd2156 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 16 Nov 2010 14:16:19 +0200 Subject: [PATCH 4/7] Fix flags for non-debug builds --- mysql-test/t/information_schema_all_engines-master.opt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/t/information_schema_all_engines-master.opt b/mysql-test/t/information_schema_all_engines-master.opt index d630799e4bd..9104e73e554 100644 --- a/mysql-test/t/information_schema_all_engines-master.opt +++ b/mysql-test/t/information_schema_all_engines-master.opt @@ -1 +1 @@ ---skip-safemalloc --mutex-deadlock-detector=0 +--loose-skip-safemalloc --loose-mutex-deadlock-detector=0 From 7a28f61ded763f4778b5f595115a0b1fde2372a8 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 9 Nov 2010 15:03:57 +0100 Subject: [PATCH 5/7] MBug#643463: Slow XtraDB shutdown: Fix more sleeps delaying shutdown. This patch removes most remaining delays due to uninteruptible sleep() during shutdown, as found using PMP. This makes standard test run very close in speed to with --loose-innodb-fast-shutdown=2, and greatly speeds up running the test suite. sql/mysqld.cc: Poll for threads to die every 20 msec during shutdown, rather than force a wait for 2 full seconds should one thread be a little slow to exit (this was seen occasionally in mysql-test-run). storage/xtradb/include/srv0srv.h: Rename the event, as we now use it to wakeup more threads during shutdown. storage/xtradb/log/log0log.c: Rename the event, as we now use it to wakeup more threads during shutdown. storage/xtradb/srv/srv0srv.c: Replace some hardcoded sleep()s with os_wait_event_time() that can be interrupted early during server shutdown to avoid unnecessary delays. --- sql/mysqld.cc | 5 +++-- storage/xtradb/include/srv0srv.h | 4 ++-- storage/xtradb/log/log0log.c | 2 +- storage/xtradb/srv/srv0srv.c | 18 +++++++++--------- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index c2670308b8a..ebdf9dd7b38 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1032,8 +1032,9 @@ static void close_connections(void) Events::deinit(); end_slave(); - if (thread_count) - sleep(2); // Give threads time to die + /* Give threads time to die. */ + for (int i= 0; thread_count && i < 100; i++) + my_sleep(20000); /* Force remaining threads to die by closing the connection to the client diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h index 8c64d5cee71..f4c9704741c 100644 --- a/storage/xtradb/include/srv0srv.h +++ b/storage/xtradb/include/srv0srv.h @@ -57,8 +57,8 @@ extern const char srv_mysql50_table_name_prefix[9]; thread starts running */ extern os_event_t srv_lock_timeout_thread_event; -/* This event is set to tell the purge thread to shut down */ -extern os_event_t srv_purge_thread_event; +/* This event is set at shutdown to wakeup threads from sleep */ +extern os_event_t srv_shutdown_event; /* If the last data file is auto-extended, we add this many pages to it at a time */ diff --git a/storage/xtradb/log/log0log.c b/storage/xtradb/log/log0log.c index b9f19aeff31..3f14d84ac72 100644 --- a/storage/xtradb/log/log0log.c +++ b/storage/xtradb/log/log0log.c @@ -3102,7 +3102,7 @@ logs_empty_and_mark_files_at_shutdown(void) algorithm only works if the server is idle at shutdown */ srv_shutdown_state = SRV_SHUTDOWN_CLEANUP; - os_event_set(srv_purge_thread_event); + os_event_set(srv_shutdown_event); loop: os_thread_sleep(100000); diff --git a/storage/xtradb/srv/srv0srv.c b/storage/xtradb/srv/srv0srv.c index 43799aab196..35745072445 100644 --- a/storage/xtradb/srv/srv0srv.c +++ b/storage/xtradb/srv/srv0srv.c @@ -704,7 +704,7 @@ UNIV_INTERN srv_slot_t* srv_mysql_table = NULL; UNIV_INTERN os_event_t srv_lock_timeout_thread_event; -UNIV_INTERN os_event_t srv_purge_thread_event; +UNIV_INTERN os_event_t srv_shutdown_event; UNIV_INTERN srv_sys_t* srv_sys = NULL; @@ -1011,7 +1011,7 @@ srv_init(void) } srv_lock_timeout_thread_event = os_event_create(NULL); - srv_purge_thread_event = os_event_create(NULL); + srv_shutdown_event = os_event_create(NULL); for (i = 0; i < SRV_MASTER + 1; i++) { srv_n_threads_active[i] = 0; @@ -2239,7 +2239,7 @@ loop: /* Wake up every 5 seconds to see if we need to print monitor information. */ - os_thread_sleep(5000000); + os_event_wait_time(srv_shutdown_event, 5000000); current_time = time(NULL); @@ -2381,7 +2381,7 @@ loop: /* When someone is waiting for a lock, we wake up every second and check if a timeout has passed for a lock wait */ - os_thread_sleep(1000000); + os_event_wait_time(srv_shutdown_event, 1000000); srv_lock_timeout_active = TRUE; @@ -2546,7 +2546,7 @@ loop: fflush(stderr); - os_thread_sleep(1000000); + os_event_wait_time(srv_shutdown_event, 1000000); if (srv_shutdown_state < SRV_SHUTDOWN_CLEANUP) { @@ -2590,7 +2590,7 @@ srv_LRU_dump_restore_thread( last_dump_time = time(NULL); loop: - os_thread_sleep(5000000); + os_event_wait_time(srv_shutdown_event, 5000000); if (srv_shutdown_state >= SRV_SHUTDOWN_CLEANUP) { goto exit_func; @@ -2754,7 +2754,7 @@ loop: if (!skip_sleep) { - os_thread_sleep(1000000); + os_event_wait_time(srv_shutdown_event, 1000000); srv_main_sleeps++; /* @@ -3340,10 +3340,10 @@ loop: mutex_exit(&kernel_mutex); sleep_ms = 10; - os_event_reset(srv_purge_thread_event); + os_event_reset(srv_shutdown_event); } - os_event_wait_time(srv_purge_thread_event, sleep_ms * 1000); + os_event_wait_time(srv_shutdown_event, sleep_ms * 1000); history_len = trx_sys->rseg_history_len; if (history_len > 1000) From 0de9a4ababac1e7f510558dfd0bece894cf7e69c Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 17 Nov 2010 13:24:20 +0100 Subject: [PATCH 6/7] MWL#74: Shared libmysqld.so library. Switch makefiles to use libtool to build libmysqld.so, as well as all its dependencies. The previous MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS() declaration is removed, as it does not work well with a libtool build. Instead, plugins that need it can specify an alternate object in MYSQL_PLUGIN_STATIC() that will be used for embedded library. The plugin must then take care itself of compiling the special object for embedded, rebuilding the source files previously listed in MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS() with @plugin_embedded_defs@ in CFLAGS/CXXFLAGS. The extra target @XXX_embedded_static_target@ is available for the special object, this will be empty when --without-embedded-server. All in-tree plugins are changed to build their static targets with libtool. Additional plugins that want to work with libmysqld.so will need to be similarly modified to build with libtool (or otherwise provide an -fPIC object). Dynamically loaded plugins are not affected. The old libraries like libmysys.a, libmyisam.a and similar libraries, which were installed by `make install` though this is of little use, are still built and installed to not break package scripts etc. that expect them. These libraries are kept static to avoid introducing new .so dependencies. The patch also fixes a handfull of duplicate symbol linker errors, where we included some object twice during linking; these for one reason or another did not produce errors before but caused problems on some platforms with this patch (eg. Mac OS X linker is more strict for shared objects). This patch only does what is necessary to build libmysqld.so. There are some more cleanups that are possible now that we are using libtool more fully, which could done in subsequent patches (though we may not bother as we are switching from autotools to CMake anyway): - In libmysql_r/, we should be able to just link libmysys.la etc, instead of symlinking and re-compiling sources into the directory. - In libmysql/, we can similarly avoid symlinking and recompiling sources if we instead build a libmysys_nothread.la library with appropriate CFLAGS and link that. - In sql/, we can build a separate target libmysql_int.la with appropriate CFLAGS for embedded and use that in libmysqld/ instead of symlinking sources. - libmysys.a, libmyisam.a and similar libraries could be installed as .so also to save on code size; or alternatively could be not installed at all. client/Makefile.am: Updated for using libtool config/ac-macros/plugins.m4: Replace MUSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS with mechanism for plugins to specify alternate object for embedded. configure.in: Fix linking duplicate objects related to THREAD_LOBJECTS. dbug/Makefile.am: Updated for using libtool extra/Makefile.am: Fix relative paths. libmysqld/Makefile.am: Build libmysqld.la using libtool libmysqld/examples/Makefile.am: Updated to use libtool mysys/Makefile.am: Updated to use libtool. Fix linking duplicate objects related to THREAD_LOBJECTS. mysys/my_uuid.c: Fix conflicting global mutex name by making it static. regex/Makefile.am: Updated to use libtool sql/Makefile.am: Updated to use libtool sql/item_func.cc: Fix conflicting mutex name. sql/mysql_priv.h: Fix conflicting mutex name sql/mysqld.cc: Fix conflicting mutex name. Add missing call of my_uuid_end(). storage/archive/Makefile.am: Updated to use libtool storage/archive/plug.in: Updated to use libtool storage/blackhole/Makefile.am: Updated to use libtool storage/blackhole/plug.in: Updated to use libtool storage/csv/Makefile.am: Updated to use libtool storage/csv/plug.in: Updated to use libtool storage/example/Makefile.am: Updated to use libtool storage/federated/Makefile.am: Updated to use libtool storage/federated/plug.in: Updated to use libtool storage/federatedx/Makefile.am: Updated to use libtool storage/federatedx/plug.in: Updated to use libtool storage/heap/Makefile.am: Updated to use libtool storage/heap/plug.in: Updated to use libtool storage/innobase/Makefile.am: Updated to use libtool storage/innobase/plug.in.disabled: Updated to use libtool storage/innodb_plugin/Makefile.am: Updated to use libtool storage/maria/CMakeLists.txt: Fix linking duplicate object in maria_dump_log, causes failure on Mac OS X storage/maria/Makefile.am: Updated to use libtool Fix linking duplicate object in maria_dump_log, causes link failure on Mac OS X storage/maria/ma_loghandler.c: Move maria_dump_log code to separate file to fix duplicate object link failures. storage/maria/ma_loghandler.h: Move maria_dump_log code to separate file to fix duplicate object link failures. storage/maria/maria_dump_log.c: Move maria_dump_log code to separate file to fix duplicate object link failures. storage/maria/plug.in: Updated to use libtool storage/myisam/Makefile.am: Updated to use libtool storage/myisam/plug.in: Updated to use libtool storage/myisammrg/Makefile.am: Updated to use libtool storage/myisammrg/plug.in: Updated to use libtool storage/pbxt/plug.in: Updated to use libtool storage/pbxt/src/Makefile.am: Updated to use libtool storage/xtradb/Makefile.am: Updated to use libtool storage/xtradb/plug.in: Updated to use libtool strings/Makefile.am: Updated to use libtool unittest/unit.pl: Don't attempt to run libtool internal files as unit tests. vio/Makefile.am: Updated to use libtool --- client/Makefile.am | 10 +- config/ac-macros/plugins.m4 | 100 ++++++----- configure.in | 9 +- dbug/Makefile.am | 9 +- extra/Makefile.am | 6 +- libmysqld/Makefile.am | 124 ++------------ libmysqld/examples/Makefile.am | 7 +- mysys/Makefile.am | 16 +- mysys/my_uuid.c | 2 +- regex/Makefile.am | 6 +- sql/Makefile.am | 2 +- sql/item_func.cc | 4 +- sql/mysql_priv.h | 2 +- sql/mysqld.cc | 7 +- storage/archive/Makefile.am | 11 +- storage/archive/plug.in | 2 +- storage/blackhole/Makefile.am | 9 +- storage/blackhole/plug.in | 2 +- storage/csv/Makefile.am | 9 +- storage/csv/plug.in | 2 +- storage/example/Makefile.am | 10 +- storage/federated/Makefile.am | 13 +- storage/federated/plug.in | 3 +- storage/federatedx/Makefile.am | 21 ++- storage/federatedx/plug.in | 3 +- storage/heap/Makefile.am | 20 ++- storage/heap/plug.in | 3 +- storage/innobase/Makefile.am | 11 +- storage/innobase/plug.in.disabled | 2 +- storage/innodb_plugin/Makefile.am | 13 +- storage/maria/CMakeLists.txt | 3 +- storage/maria/Makefile.am | 26 ++- storage/maria/ma_loghandler.c | 268 ++++-------------------------- storage/maria/ma_loghandler.h | 24 +++ storage/maria/maria_dump_log.c | 190 +++++++++++++++++++++ storage/maria/plug.in | 3 +- storage/myisam/Makefile.am | 20 ++- storage/myisam/plug.in | 3 +- storage/myisammrg/Makefile.am | 16 +- storage/myisammrg/plug.in | 3 +- storage/pbxt/plug.in | 3 +- storage/pbxt/src/Makefile.am | 28 ++-- storage/xtradb/Makefile.am | 13 +- storage/xtradb/plug.in | 2 +- strings/Makefile.am | 12 +- unittest/unit.pl | 2 +- vio/Makefile.am | 8 +- 47 files changed, 541 insertions(+), 521 deletions(-) create mode 100644 storage/maria/maria_dump_log.c diff --git a/client/Makefile.am b/client/Makefile.am index ad32117ac35..a491ce364b6 100644 --- a/client/Makefile.am +++ b/client/Makefile.am @@ -74,8 +74,7 @@ mysqlimport_SOURCES= mysqlimport.c mysqlimport_CFLAGS= -DTHREAD -UUNDEF_THREADS_HACK mysqlimport_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \ @CLIENT_EXTRA_LDFLAGS@ \ - $(LIBMYSQLCLIENT_LA) \ - $(top_builddir)/mysys/libmysys.a + $(LIBMYSQLCLIENT_LA) mysqlshow_SOURCES= mysqlshow.c @@ -83,16 +82,15 @@ mysqlslap_SOURCES= mysqlslap.c mysqlslap_CFLAGS= -DTHREAD -UMYSQL_CLIENT_NO_THREADS mysqlslap_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \ @CLIENT_EXTRA_LDFLAGS@ \ - $(LIBMYSQLCLIENT_LA) \ - $(top_builddir)/mysys/libmysys.a + $(LIBMYSQLCLIENT_LA) mysqltest_SOURCES= mysqltest.cc mysqltest_CXXFLAGS= -DTHREAD -UMYSQL_CLIENT_NO_THREADS mysqltest_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \ @CLIENT_EXTRA_LDFLAGS@ \ - $(LIBMYSQLCLIENT_LA) \ $(top_builddir)/mysys/libmysys.a \ - $(top_builddir)/regex/libregex.a \ + $(LIBMYSQLCLIENT_LA) \ + $(top_builddir)/regex/libregex.la $(CLIENT_THREAD_LIBS) mysql_upgrade_SOURCES= mysql_upgrade.c \ diff --git a/config/ac-macros/plugins.m4 b/config/ac-macros/plugins.m4 index 86481cd0aa9..8af9cacbb6d 100644 --- a/config/ac-macros/plugins.m4 +++ b/config/ac-macros/plugins.m4 @@ -115,18 +115,32 @@ dnl --------------------------------------------------------------------------- dnl Macro: MYSQL_PLUGIN_STATIC dnl dnl SYNOPSIS -dnl MYSQL_PLUGIN_STATIC([name],[libmyplugin.a]) +dnl MYSQL_PLUGIN_STATIC([name],[libmyplugin.a],[libmyplugin_embedded.a]) dnl dnl DESCRIPTION -dnl Declare the name for the static library +dnl Declare the name for the static library +dnl +dnl Third argument is optional, only needed for special plugins that depend +dnl on server internals and have source files that must be compiled specially +dnl with -DEMBEDDED_LIBRARY for embedded server. If specified, the third +dnl argument is used to link embedded server instead of the second. dnl dnl --------------------------------------------------------------------------- AC_DEFUN([MYSQL_PLUGIN_STATIC],[ MYSQL_REQUIRE_PLUGIN([$1]) m4_define([MYSQL_PLUGIN_STATIC_]AS_TR_CPP([$1]), [$2]) + ifelse($#, 3, [ + m4_define([MYSQL_PLUGIN_EMBEDDED_]AS_TR_CPP([$1]), [$3]) + ]) ]) +dnl --------------------------------------------------------------------------- +dnl Substitution variable to use to compile source files specially for +dnl embedded server. +dnl To be used by plugins that have sources that depend on server internals. +dnl --------------------------------------------------------------------------- +AC_SUBST([plugin_embedded_defs], ["-DEMBEDDED_LIBRARY -DMYSQL_SERVER"]) dnl --------------------------------------------------------------------------- dnl Macro: MYSQL_PLUGIN_DYNAMIC @@ -253,28 +267,6 @@ AC_DEFUN([MYSQL_PLUGIN_ACTIONS],[ ]) ]) -dnl --------------------------------------------------------------------------- -dnl Macro: MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS -dnl -dnl SYNOPSIS -dnl MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS([name],[file name]) -dnl -dnl DESCRIPTION -dnl Some modules in plugins keep dependance on structures -dnl declared in sql/ (THD class usually) -dnl That has to be fixed in the future, but until then -dnl we have to recompile these modules when we want to -dnl to compile server parts with the different #defines -dnl Normally it happens when we compile the embedded server -dnl Thus one should mark such files in his handler using this macro -dnl -dnl --------------------------------------------------------------------------- - -AC_DEFUN([MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS],[ - MYSQL_REQUIRE_PLUGIN([$1]) - m4_define([MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS_]AS_TR_CPP([$1]), [$2]) -]) - dnl --------------------------------------------------------------------------- dnl Macro: MYSQL_CONFIGURE_PLUGINS dnl @@ -335,11 +327,25 @@ AC_DEFUN([_MYSQL_EMIT_CHECK_PLUGIN],[ [MYSQL_PLUGIN_DYNAMIC_]AS_TR_CPP([$1]), [MYSQL_PLUGIN_MANDATORY_]AS_TR_CPP([$1]), [MYSQL_PLUGIN_DISABLED_]AS_TR_CPP([$1]), - [MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS_]AS_TR_CPP([$1]), + [MYSQL_PLUGIN_EMBEDDED_]AS_TR_CPP([$1]), [MYSQL_PLUGIN_ACTIONS_]AS_TR_CPP([$1]) ) ]) +dnl __MYSQL_EMIT_CHECK_PLUGIN arguments: +dnl +dnl 1 - plugin identifying name +dnl 2 - plugin identifying name, with `-' replaced by `_' +dnl 3 - plugin long name +dnl 4 - plugin description +dnl 5 - mysql_plugin_define (eg. WITH_xxx_STORAGE_ENGINE) +dnl 6 - directory +dnl 7 - static target (if supports static build) +dnl 8 - dynamic target (if supports dynamic build) +dnl 9 - mandatory flag +dnl 10 - disabled flag +dnl 11 - static target for libmysqld (if different from $7) +dnl 12 - actions AC_DEFUN([__MYSQL_EMIT_CHECK_PLUGIN],[ m4_ifdef([$5],[ AH_TEMPLATE($5, [Include ]$4[ into mysqld]) @@ -414,6 +420,7 @@ AC_DEFUN([__MYSQL_EMIT_CHECK_PLUGIN],[ ]) AC_SUBST([plugin_]$2[_shared_target], "$8") AC_SUBST([plugin_]$2[_static_target], [""]) + AC_SUBST([plugin_]$2[_embedded_static_target], [""]) [with_plugin_]$2=yes AC_MSG_RESULT([plugin]) m4_ifdef([$6],[ @@ -428,32 +435,47 @@ AC_DEFUN([__MYSQL_EMIT_CHECK_PLUGIN],[ ]) else m4_ifdef([$7],[ - ifelse(m4_bregexp($7, [^lib[^.]+\.a$]), -2, [ -dnl change above "-2" to "0" to enable this section -dnl Although this is "pretty", it breaks libmysqld build - m4_ifdef([$6],[ - mysql_use_plugin_dir="$6" - mysql_plugin_libs="$mysql_plugin_libs -L[\$(top_builddir)]/$6" - ]) - mysql_plugin_libs="$mysql_plugin_libs dnl -[-l]m4_bregexp($7, [^lib\([^.]+\)], [\1])" - ], m4_bregexp($7, [^\\\$]), 0, [ + ifelse(m4_bregexp($7, [^\\\$]), 0, [ m4_ifdef([$6],[ mysql_use_plugin_dir="$6" ]) mysql_plugin_libs="$mysql_plugin_libs $7" + m4_ifdef([$11],[ + mysql_embedded_plugin_libs="$mysql_embedded_plugin_libs $11" + ],[ + mysql_embedded_plugin_libs="$mysql_embedded_plugin_libs $7" + ]) ], [ m4_ifdef([$6],[ mysql_use_plugin_dir="$6" mysql_plugin_libs="$mysql_plugin_libs \$(top_builddir)/$6/$7" + m4_ifdef([$11],[ + mysql_embedded_plugin_libs="$mysql_embedded_plugin_libs \$(top_builddir)/$6/$11" + ],[ + mysql_embedded_plugin_libs="$mysql_embedded_plugin_libs \$(top_builddir)/$6/$7" + ]) ],[ mysql_plugin_libs="$mysql_plugin_libs $7" + m4_ifdef([$11],[ + mysql_embedded_plugin_libs="$mysql_embedded_plugin_libs $11" + ],[ + mysql_embedded_plugin_libs="$mysql_embedded_plugin_libs $7" + ]) ]) ]) m4_ifdef([$5],[ AC_DEFINE($5) ]) AC_SUBST([plugin_]$2[_static_target], "$7") + m4_ifdef([$11], [ + if test "$with_embedded_server" = "yes"; then + AC_SUBST([plugin_]$2[_embedded_static_target], "$11") + else + AC_SUBST([plugin_]$2[_embedded_static_target], [""]) + fi + ], [ + AC_SUBST([plugin_]$2[_embedded_static_target], [""]) + ]) AC_SUBST([plugin_]$2[_shared_target], [""]) ],[ m4_ifdef([$6],[ @@ -470,14 +492,6 @@ dnl Although this is "pretty", it breaks libmysqld build mysql_plugin_defs="$mysql_plugin_defs, [builtin_]$2[_plugin]" [with_plugin_]$2=yes AC_MSG_RESULT([yes]) - m4_ifdef([$11], [ - m4_foreach([plugin], [$11], [ - condition_dependent_plugin_modules="$condition_dependent_plugin_modules m4_bregexp(plugin, [[^/]+$], [\&])" - condition_dependent_plugin_objects="$condition_dependent_plugin_objects m4_bregexp(plugin, [[^/]+\.], [\&o])" - condition_dependent_plugin_links="$condition_dependent_plugin_links $6/plugin" - condition_dependent_plugin_includes="$condition_dependent_plugin_includes -I[\$(top_srcdir)]/$6/m4_bregexp(plugin, [^.+[/$]], [\&])" - ]) - ]) fi fi diff --git a/configure.in b/configure.in index 785c7b1ca24..9a2309fc869 100644 --- a/configure.in +++ b/configure.in @@ -250,7 +250,7 @@ AC_PROG_LIBTOOL # Ensure that we have --preserve-dup-deps defines, otherwise we get link # problems of 'mysql' with CXX=g++ -LIBTOOL="$LIBTOOL --preserve-dup-deps" +#LIBTOOL="$LIBTOOL --preserve-dup-deps" AC_SUBST(LIBTOOL)dnl AC_SUBST(NM)dnl @@ -2521,9 +2521,8 @@ MYSQL_CHECK_LIBEVENT MYSQL_STORAGE_ENGINE(myisam,no, [MyISAM Storage Engine], [Traditional non-transactional MySQL tables]) MYSQL_PLUGIN_DIRECTORY(myisam, [storage/myisam]) -MYSQL_PLUGIN_STATIC(myisam, [libmyisam.a]) +MYSQL_PLUGIN_STATIC(myisam, [libmyisam_s.la], [libmyisam_embedded.la]) MYSQL_PLUGIN_MANDATORY(myisam) dnl Default -MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(myisam, [ha_myisam.cc]) MYSQL_STORAGE_ENGINE(partition, partition, [Partition Support], [MySQL Partitioning Support], [max,max-no-ndb]) @@ -2846,9 +2845,6 @@ if test "$with_server" != "no" -o "$THREAD_SAFE_CLIENT" != "no" then AC_DEFINE([THREAD], [1], [Define if you want to have threaded code. This may be undef on client code]) - # Avoid _PROGRAMS names - THREAD_LOBJECTS="thr_alarm.o thr_lock.o thr_mutex.o thr_rwlock.o my_pthread.o my_thr_init.o mf_keycache.o mf_keycaches.o waiting_threads.o" - AC_SUBST(THREAD_LOBJECTS) fi AM_CONDITIONAL(NEED_THREAD, test "$with_server" != "no" -o "$THREAD_SAFE_CLIENT" != "no") @@ -2877,6 +2873,7 @@ AC_SUBST(server_scripts) AC_SUBST(mysql_plugin_dirs) AC_SUBST(mysql_plugin_libs) +AC_SUBST(mysql_embedded_plugin_libs) AC_SUBST(mysql_plugin_defs) diff --git a/dbug/Makefile.am b/dbug/Makefile.am index 528a6a02fbf..e8acb0ca2c0 100644 --- a/dbug/Makefile.am +++ b/dbug/Makefile.am @@ -16,10 +16,11 @@ # MA 02111-1307, USA INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -LDADD = libdbug.a ../mysys/libmysys.a ../strings/libmystrings.a +LDADD = libdbug.a $(top_builddir)/mysys/libmysys.a $(top_builddir)/strings/libmystrings.a pkglib_LIBRARIES = libdbug.a +noinst_LTLIBRARIES = libdbug.la noinst_HEADERS = dbug_long.h -libdbug_a_SOURCES = dbug.c sanity.c +libdbug_la_SOURCES = dbug.c sanity.c EXTRA_DIST = CMakeLists.txt example1.c example2.c example3.c \ user.r monty.doc dbug_add_tags.pl \ my_main.c main.c factorial.c dbug_analyze.c \ @@ -65,3 +66,7 @@ output5.r: factorial # a hack to have executable in builddir, not in srcdir tests-t: tests-t.pl cp -f $(srcdir)/tests-t.pl ./tests-t + +libdbug_a_SOURCES= +libdbug.a: libdbug.la + $(CP) .libs/libdbug.a $@ diff --git a/extra/Makefile.am b/extra/Makefile.am index 8d6d18f0031..9c66cedc013 100644 --- a/extra/Makefile.am +++ b/extra/Makefile.am @@ -15,8 +15,10 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_srcdir)/sql -LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \ - ../dbug/libdbug.a ../strings/libmystrings.a \ +LDADD = @CLIENT_EXTRA_LDFLAGS@ \ + $(top_builddir)/mysys/libmysys.a \ + $(top_builddir)/strings/libmystrings.a \ + $(top_builddir)/dbug/libdbug.a \ $(ZLIB_LIBS) BUILT_SOURCES= $(top_builddir)/include/mysqld_error.h \ $(top_builddir)/include/sql_state.h \ diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am index 83af96c7b89..fdde891c81d 100644 --- a/libmysqld/Makefile.am +++ b/libmysqld/Makefile.am @@ -34,10 +34,10 @@ INCLUDES= -I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_srcdir)/sql/examples \ -I$(top_srcdir)/regex \ $(openssl_includes) @ZLIB_INCLUDES@ \ - @condition_dependent_plugin_includes@ + @condition_dependent_plugin_includes@ \ + @ndbcluster_includes@ -noinst_LIBRARIES = libmysqld_int.a -pkglib_LIBRARIES = libmysqld.a +pkglib_LTLIBRARIES = libmysqld.la SUBDIRS = . examples libmysqld_sources= libmysqld.c lib_sql.cc emb_qcache.cc libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c \ @@ -79,104 +79,28 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \ rpl_injector.cc my_user.c partition_info.cc \ sql_servers.cc event_parse_data.cc opt_table_elimination.cc -libmysqld_int_a_SOURCES= $(libmysqld_sources) -nodist_libmysqld_int_a_SOURCES= $(libmysqlsources) $(sqlsources) -libmysqld_a_SOURCES= - -sqlstoragesources = $(EXTRA_libmysqld_a_SOURCES) -storagesources = @condition_dependent_plugin_modules@ -storageobjects = @condition_dependent_plugin_objects@ -storagesourceslinks = @condition_dependent_plugin_links@ - # automake misses these sql_yacc.cc sql_yacc.h: $(top_srcdir)/sql/sql_yacc.yy # The following libraries should be included in libmysqld.a -INC_LIB= $(top_builddir)/regex/libregex.a \ - $(top_builddir)/mysys/libmysys.a \ - $(top_builddir)/strings/libmystrings.a \ - $(top_builddir)/dbug/libdbug.a \ - $(top_builddir)/vio/libvio.a \ - @NDB_SCI_LIBS@ \ - @mysql_plugin_libs@ \ +INC_LIB= $(top_builddir)/regex/libregex.la \ + $(top_builddir)/mysys/libmysys.la \ + $(top_builddir)/strings/libmystrings.la \ + $(top_builddir)/dbug/libdbug.la \ + $(top_builddir)/vio/libvio.la \ + @ndbcluster_libs@ @NDB_SCI_LIBS@ \ + @mysql_embedded_plugin_libs@ \ $(libevent_inc_libs) \ $(yassl_inc_libs) if HAVE_YASSL -yassl_inc_libs= $(top_builddir)/extra/yassl/src/.libs/libyassl.a \ - $(top_builddir)/extra/yassl/taocrypt/src/.libs/libtaocrypt.a +yassl_inc_libs= $(top_builddir)/extra/yassl/src/libyassl.la \ + $(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la endif -# Storage engine specific compilation options -ha_ndbcluster.o:ha_ndbcluster.cc - $(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $< - -ha_ndbcluster_cond.o:ha_ndbcluster_cond.cc - $(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $< - -ha_ndbcluster_binlog.o: ha_ndbcluster_binlog.cc - $(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $< - -# Until we can remove dependency on ha_ndbcluster.h -handler.o: handler.cc - $(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $< - -# We need rules to compile these as no good way -# found to append fileslists that collected by configure -# to the sources list - -ha_federatedx.o:ha_federatedx.cc - $(CXXCOMPILE) $(LM_CFLAGS) -c $< - -ha_heap.o:ha_heap.cc - $(CXXCOMPILE) $(LM_CFLAGS) -c $< - -ha_innodb.o:ha_innodb.cc - $(CXXCOMPILE) $(LM_CFLAGS) -c $< - -ha_myisam.o:ha_myisam.cc - $(CXXCOMPILE) $(LM_CFLAGS) -c $< - -ha_myisammrg.o:ha_myisammrg.cc - $(CXXCOMPILE) $(LM_CFLAGS) -c $< - -# -# To make it easy for the end user to use the embedded library we -# generate a total libmysqld.a from all library files, - -# note - InnoDB libraries have circular dependencies, so in INC_LIB -# few libraries are present two times. Metrowerks linker doesn't like -# it at all. Traditional ar has no problems with it, but still there's no -# need to add the same file twice to the library, so 'sort -u' save us -# some time and spares unnecessary work. - -libmysqld.a: libmysqld_int.a $(INC_LIB) $(libmysqld_a_DEPENDENCIES) $(storageobjects) -if DARWIN_MWCC - mwld -lib -o $@ libmysqld_int.a `echo $(INC_LIB) | sort -u` $(storageobjects) -else - -rm -f libmysqld.a - if test "$(host_os)" = "netware" ; \ - then \ - $(libmysqld_a_AR) libmysqld.a $(INC_LIB) libmysqld_int.a $(storageobjects); \ - else \ - current_dir=`pwd`; \ - rm -rf tmp; mkdir tmp; \ - (for arc in $(INC_LIB) ./libmysqld_int.a; do \ - arpath=`echo $$arc|sed 's|[^/]*$$||'|sed 's|\.libs/$$||'`; \ - artmp=`echo $$arc|sed 's|^.*/|tmp/lib-|'`; \ - for F in `$(AR) t $$arc | grep -v SYMDEF`; do \ - if test -e "$$arpath/$$F" ; then echo "$$arpath/$$F"; else \ - mkdir $$artmp; cd $$artmp > /dev/null; \ - $(AR) x ../../$$arc; \ - cd $$current_dir > /dev/null; \ - ls $$artmp/* | grep -v SYMDEF; \ - continue 2; fi; done; \ - done; echo $(libmysqld_a_DEPENDENCIES) ) | sort -u | xargs $(AR) cq libmysqld.a ; \ - $(AR) r libmysqld.a $(storageobjects); \ - $(RANLIB) libmysqld.a ; \ - rm -rf tmp; \ - fi -endif +libmysqld_la_SOURCES= $(libmysqld_sources) +nodist_libmysqld_la_SOURCES= $(libmysqlsources) $(sqlsources) +libmysqld_la_LIBADD = $(INC_LIB) ## XXX: any time the client interface changes, we'll need to bump ## the version info for libmysqld; however, it's possible for the @@ -184,7 +108,7 @@ endif ## libmysqlclient interface. Should we make a separate version ## string for the two? #libmysqld_la_LDFLAGS = -version-info @SHARED_LIB_VERSION@ -#CLEANFILES = $(libmysqld_la_LIBADD) libmysqld.la +#CLEANFILES = libmysqld.la BUILT_SOURCES = link_sources @@ -209,20 +133,6 @@ link_sources: @LN_CP_F@ $(top_builddir)/libmysql/$$f $$f; \ fi ; \ done; \ - if test -n "$(sqlstoragesources)" ; \ - then \ - for f in "$(sqlstoragesources)"; do \ - rm -f "$$f"; \ - @LN_CP_F@ `find $(srcdir)/../sql -name "$$f"` "$$f"; \ - done; \ - fi; \ - if test -n "$(storagesources)" ; \ - then \ - rm -f $(storagesources); \ - for f in $(storagesourceslinks); do \ - @LN_CP_F@ $(top_srcdir)/$$f . ; \ - done; \ - fi; \ rm -f client_settings.h; \ @LN_CP_F@ $(top_srcdir)/libmysql/client_settings.h \ client_settings.h; \ @@ -230,5 +140,5 @@ link_sources: clean-local: - rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlstoragesources) $(storagesources) | sed "s;\.lo;.c;g"`; \ + rm -f `echo $(sqlsources) $(libmysqlsources) | sed "s;\.lo;.c;g"`; \ rm -f client_settings.h diff --git a/libmysqld/examples/Makefile.am b/libmysqld/examples/Makefile.am index fd37f362960..1ef216b286d 100644 --- a/libmysqld/examples/Makefile.am +++ b/libmysqld/examples/Makefile.am @@ -37,12 +37,13 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir) \ -I$(top_srcdir) -I$(top_srcdir)/client -I$(top_srcdir)/regex \ $(openssl_includes) LIBS = @LIBS@ @WRAPLIBS@ @CLIENT_LIBS@ $(yassl_libs) -LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @LIBDL@ $(CXXLDFLAGS) \ - @NDB_SCI_LIBS@ +LDADD = @CLIENT_EXTRA_LDFLAGS@ \ + $(top_builddir)/libmysqld/libmysqld.la @LIBDL@ $(CXXLDFLAGS) \ + @ndbcluster_libs@ @NDB_SCI_LIBS@ mysqltest_embedded_LINK = $(CXXLINK) nodist_mysqltest_embedded_SOURCES = mysqltest.cc -mysqltest_embedded_LDADD = $(LDADD) $(top_builddir)/regex/libregex.a \ +mysqltest_embedded_LDADD = $(LDADD) $(top_builddir)/regex/libregex.la \ @MYSQLD_EXTRA_LDFLAGS@ nodist_mysql_SOURCES = mysql.cc readline.cc completion_hash.cc \ diff --git a/mysys/Makefile.am b/mysys/Makefile.am index dc0b2bfb84b..7d1c1ff062c 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -19,10 +19,11 @@ MYSQLBASEdir= $(prefix) INCLUDES = @ZLIB_INCLUDES@ -I$(top_builddir)/include \ -I$(top_srcdir)/include -I$(srcdir) pkglib_LIBRARIES = libmysys.a +noinst_LTLIBRARIES = libmysys.la LDADD = libmysys.a $(top_builddir)/strings/libmystrings.a $(top_builddir)/dbug/libdbug.a noinst_HEADERS = mysys_priv.h my_static.h my_handler_errors.h \ my_safehash.h -libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \ +libmysys_la_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \ mf_path.c mf_loadpath.c my_file.c \ my_open.c my_create.c my_dup.c my_seek.c my_read.c \ my_pread.c my_write.c my_getpagesize.c \ @@ -57,19 +58,22 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \ my_memmem.c stacktrace.c \ my_windac.c my_access.c base64.c my_libwrap.c \ wqueue.c +libmysys_la_LDFLAGS = $(AM_LDFLAGS) @WRAPLIBS@ +libmysys_la_LIBADD = $(ZLIB_LIBS) if NEED_THREAD # mf_keycache is used only in the server, so it is safe to leave the file # out of the non-threaded library. # In fact, it will currently not compile without thread support. -libmysys_a_SOURCES += mf_keycache.c mf_keycaches.c +libmysys_la_SOURCES += thr_alarm.c thr_lock.c thr_mutex.c thr_rwlock.c \ + my_pthread.c my_thr_init.c waiting_threads.c \ + mf_keycache.c mf_keycaches.c endif EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \ thr_mutex.c thr_rwlock.c waiting_threads.c \ CMakeLists.txt mf_soundex.c \ my_conio.c my_wincond.c my_winthread.c -libmysys_a_LIBADD = @THREAD_LOBJECTS@ # test_dir_DEPENDENCIES= $(LIBRARIES) # testhash_DEPENDENCIES= $(LIBRARIES) # test_charset_DEPENDENCIES= $(LIBRARIES) @@ -83,8 +87,6 @@ DEFS = -DDEFAULT_BASEDIR=\"$(prefix)\" \ -DDEFAULT_SYSCONFDIR="\"$(sysconfdir)\"" \ @DEFS@ -libmysys_a_DEPENDENCIES= @THREAD_LOBJECTS@ - # I hope this always does the right thing. Otherwise this is only test programs FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@ @@ -95,6 +97,10 @@ CLEANFILES = test_bitmap$(EXEEXT) test_priority_queue$(EXEEXT) \ testhash$(EXEEXT) test_gethwaddr$(EXEEXT) \ test_base64$(EXEEXT) test_thr_mutex$(EXEEXT) +libmysys_a_SOURCES= +libmysys.a: libmysys.la + $(CP) .libs/libmysys.a $@ + # # The CP .. RM stuff is to avoid problems with some compilers (like alpha ccc) # which automaticly removes the object files you use to compile a final program diff --git a/mysys/my_uuid.c b/mysys/my_uuid.c index f115806b4e9..e2372391b06 100644 --- a/mysys/my_uuid.c +++ b/mysys/my_uuid.c @@ -50,7 +50,7 @@ static ulonglong uuid_time= 0; static uchar uuid_suffix[2+6]; /* clock_seq and node */ #ifdef THREAD -pthread_mutex_t LOCK_uuid_generator; +static pthread_mutex_t LOCK_uuid_generator; #endif /* diff --git a/regex/Makefile.am b/regex/Makefile.am index 0fd62a777f6..6e46e537c4b 100644 --- a/regex/Makefile.am +++ b/regex/Makefile.am @@ -16,10 +16,10 @@ # MA 02111-1307, USA INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -noinst_LIBRARIES = libregex.a -LDADD= libregex.a $(top_builddir)/strings/libmystrings.a +noinst_LTLIBRARIES = libregex.la +LDADD= libregex.la $(top_builddir)/strings/libmystrings.la noinst_HEADERS = cclass.h cname.h regex2.h utils.h engine.c my_regex.h -libregex_a_SOURCES = regerror.c regcomp.c regexec.c regfree.c reginit.c +libregex_la_SOURCES = regerror.c regcomp.c regexec.c regfree.c reginit.c noinst_PROGRAMS = re re_SOURCES = split.c debug.c main.c re_LDFLAGS= @NOINST_LDFLAGS@ diff --git a/sql/Makefile.am b/sql/Makefile.am index 5dcbbb9815a..20eef1bb7d7 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -36,7 +36,7 @@ noinst_LTLIBRARIES= libndb.la \ SUPPORTING_LIBS = $(top_builddir)/vio/libvio.a \ $(top_builddir)/mysys/libmysys.a \ $(top_builddir)/dbug/libdbug.a \ - $(top_builddir)/regex/libregex.a \ + $(top_builddir)/regex/libregex.la \ $(top_builddir)/strings/libmystrings.a mysqld_DEPENDENCIES= @mysql_plugin_libs@ $(SUPPORTING_LIBS) libndb.la LDADD = $(SUPPORTING_LIBS) @ZLIB_LIBS@ @NDB_SCI_LIBS@ diff --git a/sql/item_func.cc b/sql/item_func.cc index bc0dc60accf..65023e64313 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -6125,8 +6125,8 @@ void uuid_short_init() longlong Item_func_uuid_short::val_int() { ulonglong val; - pthread_mutex_lock(&LOCK_uuid_generator); + pthread_mutex_lock(&LOCK_short_uuid_generator); val= uuid_value++; - pthread_mutex_unlock(&LOCK_uuid_generator); + pthread_mutex_unlock(&LOCK_short_uuid_generator); return (longlong) val; } diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 8b2cba4f9e6..5dedbfc3007 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -2016,7 +2016,7 @@ extern FILE *stderror_file; extern pthread_key(MEM_ROOT**,THR_MALLOC); extern pthread_mutex_t LOCK_mysql_create_db,LOCK_Acl,LOCK_open, LOCK_lock_db, LOCK_mapped_file,LOCK_user_locks, LOCK_status, - LOCK_error_log, LOCK_delayed_insert, LOCK_uuid_generator, + LOCK_error_log, LOCK_delayed_insert, LOCK_short_uuid_generator, LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone, LOCK_slave_list, LOCK_active_mi, LOCK_manager, LOCK_global_read_lock, LOCK_global_system_variables, LOCK_user_conn, diff --git a/sql/mysqld.cc b/sql/mysqld.cc index ebdf9dd7b38..c3d58349ad5 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -693,7 +693,7 @@ pthread_mutex_t LOCK_mysql_create_db, LOCK_Acl, LOCK_open, LOCK_thread_count, LOCK_crypt, LOCK_bytes_sent, LOCK_bytes_received, LOCK_global_system_variables, LOCK_user_conn, LOCK_slave_list, LOCK_active_mi, - LOCK_connection_count, LOCK_uuid_generator; + LOCK_connection_count, LOCK_short_uuid_generator; /** The below lock protects access to two global server variables: max_prepared_stmt_count and prepared_stmt_count. These variables @@ -1406,6 +1406,7 @@ void clean_up(bool print_message) #ifdef HAVE_REPLICATION end_slave_list(); #endif + my_uuid_end(); delete binlog_filter; delete rpl_filter; #ifndef EMBEDDED_LIBRARY @@ -1512,7 +1513,7 @@ static void clean_up_mutexes() (void) rwlock_destroy(&LOCK_sys_init_connect); (void) rwlock_destroy(&LOCK_sys_init_slave); (void) pthread_mutex_destroy(&LOCK_global_system_variables); - (void) pthread_mutex_destroy(&LOCK_uuid_generator); + (void) pthread_mutex_destroy(&LOCK_short_uuid_generator); (void) rwlock_destroy(&LOCK_system_variables_hash); (void) pthread_mutex_destroy(&LOCK_global_read_lock); (void) pthread_mutex_destroy(&LOCK_prepared_stmt_count); @@ -3756,7 +3757,7 @@ static int init_thread_environment() (void) my_rwlock_init(&LOCK_system_variables_hash, NULL); (void) pthread_mutex_init(&LOCK_global_read_lock, MY_MUTEX_INIT_FAST); (void) pthread_mutex_init(&LOCK_prepared_stmt_count, MY_MUTEX_INIT_FAST); - (void) pthread_mutex_init(&LOCK_uuid_generator, MY_MUTEX_INIT_FAST); + (void) pthread_mutex_init(&LOCK_short_uuid_generator, MY_MUTEX_INIT_FAST); (void) pthread_mutex_init(&LOCK_connection_count, MY_MUTEX_INIT_FAST); #ifdef HAVE_OPENSSL (void) pthread_mutex_init(&LOCK_des_key_file,MY_MUTEX_INIT_FAST); diff --git a/storage/archive/Makefile.am b/storage/archive/Makefile.am index 254c95bf68b..1dbe101c2d6 100644 --- a/storage/archive/Makefile.am +++ b/storage/archive/Makefile.am @@ -33,7 +33,7 @@ DEFS = @DEFS@ noinst_HEADERS = ha_archive.h azlib.h noinst_PROGRAMS = archive_test archive_reader -EXTRA_LTLIBRARIES = ha_archive.la +EXTRA_LTLIBRARIES = libarchive.la ha_archive.la pkgplugin_LTLIBRARIES = @plugin_archive_shared_target@ ha_archive_la_LDFLAGS = -module -rpath $(pkgplugindir) ha_archive_la_CXXFLAGS= -shared $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN @@ -41,11 +41,10 @@ ha_archive_la_CFLAGS = -shared $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_archive_la_SOURCES = ha_archive.cc azio.c -EXTRA_LIBRARIES = libarchive.a -noinst_LIBRARIES = @plugin_archive_static_target@ -libarchive_a_CXXFLAGS = $(AM_CXXFLAGS) -libarchive_a_CFLAGS = $(AM_CFLAGS) -libarchive_a_SOURCES = ha_archive.cc azio.c +noinst_LTLIBRARIES = @plugin_archive_static_target@ +libarchive_la_CXXFLAGS = $(AM_CXXFLAGS) +libarchive_la_CFLAGS = $(AM_CFLAGS) +libarchive_la_SOURCES = ha_archive.cc azio.c archive_test_SOURCES = archive_test.c azio.c diff --git a/storage/archive/plug.in b/storage/archive/plug.in index 52131b12e6b..d19c29414e3 100644 --- a/storage/archive/plug.in +++ b/storage/archive/plug.in @@ -1,4 +1,4 @@ MYSQL_STORAGE_ENGINE(archive,, [Archive Storage Engine], [Archive Storage Engine], [max,max-no-ndb]) -MYSQL_PLUGIN_STATIC(archive, [libarchive.a]) +MYSQL_PLUGIN_STATIC(archive, [libarchive.la]) MYSQL_PLUGIN_DYNAMIC(archive, [ha_archive.la]) diff --git a/storage/blackhole/Makefile.am b/storage/blackhole/Makefile.am index 148746a9336..6665898cae7 100644 --- a/storage/blackhole/Makefile.am +++ b/storage/blackhole/Makefile.am @@ -32,17 +32,16 @@ DEFS = @DEFS@ noinst_HEADERS = ha_blackhole.h -EXTRA_LTLIBRARIES = ha_blackhole.la +EXTRA_LTLIBRARIES = libblackhole.la ha_blackhole.la pkgplugin_LTLIBRARIES = @plugin_blackhole_shared_target@ ha_blackhole_la_LDFLAGS=-module -rpath $(pkgplugindir) ha_blackhole_la_CXXFLAGS=-shared $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_blackhole_la_SOURCES=ha_blackhole.cc -EXTRA_LIBRARIES = libblackhole.a -noinst_LIBRARIES = @plugin_blackhole_static_target@ -libblackhole_a_CXXFLAGS=$(AM_CXXFLAGS) -libblackhole_a_SOURCES= ha_blackhole.cc +noinst_LTLIBRARIES = @plugin_blackhole_static_target@ +libblackhole_la_CXXFLAGS=$(AM_CXXFLAGS) +libblackhole_la_SOURCES= ha_blackhole.cc EXTRA_DIST = CMakeLists.txt plug.in diff --git a/storage/blackhole/plug.in b/storage/blackhole/plug.in index 725db0facba..2f3b120fa5d 100644 --- a/storage/blackhole/plug.in +++ b/storage/blackhole/plug.in @@ -1,6 +1,6 @@ MYSQL_STORAGE_ENGINE(blackhole,,[Blackhole Storage Engine], [Basic Write-only Read-never tables], [max,max-no-ndb]) MYSQL_PLUGIN_DIRECTORY(blackhole, [storage/blackhole]) -MYSQL_PLUGIN_STATIC(blackhole, [libblackhole.a]) +MYSQL_PLUGIN_STATIC(blackhole, [libblackhole.la]) MYSQL_PLUGIN_DYNAMIC(blackhole, [ha_blackhole.la]) diff --git a/storage/csv/Makefile.am b/storage/csv/Makefile.am index 75ad9062984..c711e4020fc 100644 --- a/storage/csv/Makefile.am +++ b/storage/csv/Makefile.am @@ -29,16 +29,15 @@ LDADD = DEFS = @DEFS@ noinst_HEADERS = ha_tina.h transparent_file.h -EXTRA_LTLIBRARIES = ha_csv.la +EXTRA_LTLIBRARIES = libcsv.la ha_csv.la pkglib_LTLIBRARIES = @plugin_csv_shared_target@ ha_csv_la_LDFLAGS = -module -rpath $(MYSQLLIBdir) ha_csv_la_CXXFLAGS = -shared $(AM_CXXFLAGS) -DMYSQL_PLUGIN ha_csv_la_SOURCES = transparent_file.cc ha_tina.cc -EXTRA_LIBRARIES = libcsv.a -noinst_LIBRARIES = @plugin_csv_static_target@ -libcsv_a_CXXFLAGS = $(AM_CXXFLAGS) -libcsv_a_SOURCES = transparent_file.cc ha_tina.cc +noinst_LTLIBRARIES = @plugin_csv_static_target@ +libcsv_la_CXXFLAGS = $(AM_CXXFLAGS) +libcsv_la_SOURCES = transparent_file.cc ha_tina.cc EXTRA_DIST = CMakeLists.txt plug.in # Don't update the files from bitkeeper diff --git a/storage/csv/plug.in b/storage/csv/plug.in index bbc69680fcd..4ff32959fa2 100644 --- a/storage/csv/plug.in +++ b/storage/csv/plug.in @@ -1,5 +1,5 @@ MYSQL_STORAGE_ENGINE(csv,, [CSV Storage Engine], [Stores tables in text CSV format]) MYSQL_PLUGIN_DIRECTORY(csv, [storage/csv]) -MYSQL_PLUGIN_STATIC(csv, [libcsv.a]) +MYSQL_PLUGIN_STATIC(csv, [libcsv.la]) MYSQL_PLUGIN_MANDATORY(csv) dnl Used for logging diff --git a/storage/example/Makefile.am b/storage/example/Makefile.am index 158b58a2e4c..da80f518d13 100644 --- a/storage/example/Makefile.am +++ b/storage/example/Makefile.am @@ -32,16 +32,16 @@ DEFS = @DEFS@ noinst_HEADERS = ha_example.h -EXTRA_LTLIBRARIES = ha_example.la +EXTRA_LTLIBRARIES = libexample.la ha_example.la pkgplugin_LTLIBRARIES = @plugin_example_shared_target@ ha_example_la_LDFLAGS = -module -rpath $(pkgplugindir) ha_example_la_CXXFLAGS= -shared $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_example_la_SOURCES = ha_example.cc -EXTRA_LIBRARIES = libexample.a -noinst_LIBRARIES = @plugin_example_static_target@ -libexample_a_CXXFLAGS = $(AM_CXXFLAGS) -libexample_a_SOURCES= ha_example.cc + +noinst_LTLIBRARIES = @plugin_example_static_target@ +libexample_la_CXXFLAGS = $(AM_CXXFLAGS) +libexample_la_SOURCES= ha_example.cc EXTRA_DIST = CMakeLists.txt plug.in diff --git a/storage/federated/Makefile.am b/storage/federated/Makefile.am index 414fb5b7d5f..290fb789a82 100644 --- a/storage/federated/Makefile.am +++ b/storage/federated/Makefile.am @@ -30,7 +30,7 @@ DEFS = @DEFS@ noinst_HEADERS = ha_federated.h -EXTRA_LTLIBRARIES = ha_federated.la +EXTRA_LTLIBRARIES = libfederated.la libfederated_embedded.la ha_federated.la pkgplugin_LTLIBRARIES = @plugin_federated_shared_target@ ha_federated_la_LDFLAGS = -module -rpath $(pkgplugindir) ha_federated_la_CXXFLAGS= -shared $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN @@ -38,10 +38,13 @@ ha_federated_la_CFLAGS = -shared $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_federated_la_SOURCES = ha_federated.cc $(top_srcdir)/mysys/string.c -EXTRA_LIBRARIES = libfederated.a -noinst_LIBRARIES = @plugin_federated_static_target@ -libfederated_a_CXXFLAGS = $(AM_CXXFLAGS) -libfederated_a_SOURCES= ha_federated.cc +noinst_LTLIBRARIES = @plugin_federated_static_target@ @plugin_federated_embedded_static_target@ +libfederated_la_CXXFLAGS = $(AM_CXXFLAGS) +libfederated_la_SOURCES= ha_federated.cc + +libfederated_embedded_la_CXXFLAGS = $(AM_CXXFLAGS) @plugin_embedded_defs@ +libfederated_embedded_la_CFLAGS = $(AM_CFLAGS) @plugin_embedded_defs@ +libfederated_embedded_la_SOURCES= ha_federated.cc EXTRA_DIST = CMakeLists.txt plug.in diff --git a/storage/federated/plug.in b/storage/federated/plug.in index 714888b2ebf..3db4a35de08 100644 --- a/storage/federated/plug.in +++ b/storage/federated/plug.in @@ -1,5 +1,4 @@ MYSQL_STORAGE_ENGINE(federated,,[Federated Storage Engine], [Connects to tables on remote MySQL servers], []) -MYSQL_PLUGIN_STATIC(federated, [libfederated.a]) +MYSQL_PLUGIN_STATIC(federated, [libfederated.la], [libfederated_embedded.la]) MYSQL_PLUGIN_DYNAMIC(federated, [ha_federated.la]) -MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(federated, [ha_federated.cc]) diff --git a/storage/federatedx/Makefile.am b/storage/federatedx/Makefile.am index 1e76ac15266..d642ec2bb5d 100644 --- a/storage/federatedx/Makefile.am +++ b/storage/federatedx/Makefile.am @@ -17,20 +17,31 @@ DEFS = @DEFS@ noinst_HEADERS = ha_federatedx.h federatedx_probes.h -EXTRA_LTLIBRARIES = ha_federatedx.la +EXTRA_LTLIBRARIES = libfederatedx.la libfederatedx_common.la libfederatedx_embedded.la ha_federatedx.la pkgplugin_LTLIBRARIES = @plugin_federatedx_shared_target@ ha_federatedx_la_LDFLAGS = -module -rpath $(pkgplugindir) ha_federatedx_la_CXXFLAGS= -shared $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_federatedx_la_CFLAGS = -shared $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN -EXTRA_LIBRARIES = libfederatedx.a -noinst_LIBRARIES = @plugin_federatedx_static_target@ -libfederatedx_a_CXXFLAGS = $(AM_CXXFLAGS) -libfederatedx_a_SOURCES= ha_federatedx.cc federatedx_txn.cc \ +noinst_LTLIBRARIES = @plugin_federatedx_static_target@ @plugin_federatedx_embedded_static_target@ +libfederatedx_common_la_CXXFLAGS = $(AM_CXXFLAGS) +libfederatedx_common_la_CFLAGS = $(AM_CFLAGS) +libfederatedx_common_la_SOURCES= federatedx_txn.cc \ federatedx_io.cc federatedx_io_null.cc \ federatedx_io_mysql.cc +libfederatedx_la_CXXFLAGS = $(AM_CFLAGS) +libfederatedx_la_CFLAGS = $(AM_CFLAGS) +libfederatedx_la_LIBADD = libfederatedx_common.la +libfederatedx_la_SOURCES= ha_federatedx.cc + +libfederatedx_embedded_la_CXXFLAGS = $(AM_CFLAGS) @plugin_embedded_defs@ +libfederatedx_embedded_la_CFLAGS = $(AM_CFLAGS) @plugin_embedded_defs@ +libfederatedx_embedded_la_LDFLAGS = $(AM_LDFLAGS) +libfederatedx_embedded_la_LIBADD = libfederatedx_common.la +libfederatedx_embedded_la_SOURCES= ha_federatedx.cc + EXTRA_DIST = CMakeLists.txt plug.in ha_federatedx.h \ federatedx_probes.h diff --git a/storage/federatedx/plug.in b/storage/federatedx/plug.in index 95afe270f4c..4a8a88e7280 100644 --- a/storage/federatedx/plug.in +++ b/storage/federatedx/plug.in @@ -1,5 +1,4 @@ MYSQL_STORAGE_ENGINE(federatedx,,[FederatedX Storage Engine], [FederatedX Storage Engine], [max,max-no-ndb]) MYSQL_PLUGIN_DYNAMIC(federatedx, [ha_federatedx.la]) -MYSQL_PLUGIN_STATIC(federatedx, [libfederatedx.a]) -MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(federatedx, [ha_federatedx.cc]) +MYSQL_PLUGIN_STATIC(federatedx, [libfederatedx.la], [libfederatedx_embedded.la]) diff --git a/storage/heap/Makefile.am b/storage/heap/Makefile.am index ec1445dea67..c896442728a 100644 --- a/storage/heap/Makefile.am +++ b/storage/heap/Makefile.am @@ -27,8 +27,11 @@ LDADD = DEFS = @DEFS@ pkglib_LIBRARIES = libheap.a +noinst_LTLIBRARIES = libheap.la libheap_s.la \ + @plugin_heap_embedded_static_target@ +EXTRA_LTLIBRARIES = libheap_embedded.la + noinst_PROGRAMS = hp_test1 hp_test2 -noinst_LIBRARIES = libheap.a hp_test1_LDFLAGS = @NOINST_LDFLAGS@ hp_test1_LDADD = libheap.a \ $(top_builddir)/mysys/libmysys.a \ @@ -40,14 +43,25 @@ hp_test2_LDADD = libheap.a \ $(top_builddir)/dbug/libdbug.a \ $(top_builddir)/strings/libmystrings.a noinst_HEADERS = heapdef.h ha_heap.h -libheap_a_SOURCES = hp_open.c hp_extra.c hp_close.c hp_panic.c hp_info.c \ +libheap_la_SOURCES = hp_open.c hp_extra.c hp_close.c hp_panic.c hp_info.c \ hp_rrnd.c hp_scan.c hp_update.c hp_write.c hp_delete.c \ hp_rsame.c hp_create.c hp_rename.c hp_rfirst.c \ hp_rnext.c hp_rlast.c hp_rprev.c hp_clear.c \ hp_rkey.c hp_block.c \ - ha_heap.cc \ hp_hash.c _check.c _rectest.c hp_static.c +libheap_s_la_SOURCES = ha_heap.cc +libheap_s_la_CFLAGS = $(AM_CFLAGS) +libheap_s_la_CXXFLAGS = $(AM_CXXFLAGS) +libheap_s_la_LIBADD = libheap.la +libheap_embedded_la_SOURCES = ha_heap.cc +libheap_embedded_la_LIBADD = libheap.la +libheap_embedded_la_CXXFLAGS = @plugin_embedded_defs@ + +libheap_a_SOURCES= +libheap.a: libheap.la + $(CP) .libs/libheap.a $@ + EXTRA_DIST = CMakeLists.txt plug.in diff --git a/storage/heap/plug.in b/storage/heap/plug.in index 50f31c60f2b..92ec01d3c88 100644 --- a/storage/heap/plug.in +++ b/storage/heap/plug.in @@ -1,7 +1,6 @@ MYSQL_STORAGE_ENGINE(heap,no, [Memory Storage Engine], [Volatile memory based tables]) MYSQL_PLUGIN_DIRECTORY(heap, [storage/heap]) -MYSQL_PLUGIN_STATIC(heap, [libheap.a]) +MYSQL_PLUGIN_STATIC(heap, [libheap_s.la], [libheap_embedded.la]) MYSQL_PLUGIN_MANDATORY(heap) dnl Memory tables -MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(heap, [ha_heap.cc]) diff --git a/storage/innobase/Makefile.am b/storage/innobase/Makefile.am index 29ba83c0668..c2bbb98e73d 100644 --- a/storage/innobase/Makefile.am +++ b/storage/innobase/Makefile.am @@ -122,9 +122,8 @@ noinst_HEADERS= include/btr0btr.h include/btr0btr.ic \ include/ut0list.ic include/ut0wqueue.h \ include/ha_prototypes.h handler/ha_innodb.h -EXTRA_LIBRARIES= libinnobase.a -noinst_LIBRARIES= @plugin_innobase_static_target@ -libinnobase_a_SOURCES= btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c \ +noinst_LTLIBRARIES= @plugin_innobase_static_target@ +libinnobase_la_SOURCES= btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c \ btr/btr0sea.c buf/buf0buf.c buf/buf0flu.c \ buf/buf0lru.c buf/buf0rea.c data/data0data.c \ data/data0type.c dict/dict0boot.c \ @@ -156,10 +155,10 @@ libinnobase_a_SOURCES= btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c \ ut/ut0ut.c ut/ut0vec.c ut/ut0wqueue.c \ handler/ha_innodb.cc -libinnobase_a_CXXFLAGS= $(AM_CXXFLAGS) -libinnobase_a_CFLAGS= $(AM_CFLAGS) +libinnobase_la_CXXFLAGS= $(AM_CXXFLAGS) +libinnobase_la_CFLAGS= $(AM_CFLAGS) -EXTRA_LTLIBRARIES= ha_innodb.la +EXTRA_LTLIBRARIES= libinnobase.la ha_innodb.la pkgplugin_LTLIBRARIES= @plugin_innobase_shared_target@ ha_innodb_la_LDFLAGS= -module -rpath $(pkgplugindir) diff --git a/storage/innobase/plug.in.disabled b/storage/innobase/plug.in.disabled index de7302dd6cc..b18950b9c7a 100644 --- a/storage/innobase/plug.in.disabled +++ b/storage/innobase/plug.in.disabled @@ -1,7 +1,7 @@ MYSQL_STORAGE_ENGINE(innobase, innodb, [InnoDB Storage Engine], [Transactional Tables using InnoDB], [max,max-no-ndb]) MYSQL_PLUGIN_DIRECTORY(innobase, [storage/innobase]) -MYSQL_PLUGIN_STATIC(innobase, [libinnobase.a]) +MYSQL_PLUGIN_STATIC(innobase, [libinnobase.la]) MYSQL_PLUGIN_DYNAMIC(innobase, [ha_innodb.la]) MYSQL_PLUGIN_ACTIONS(innobase, [ AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"]) diff --git a/storage/innodb_plugin/Makefile.am b/storage/innodb_plugin/Makefile.am index 0d2c194a3f2..1b02b4eceb8 100644 --- a/storage/innodb_plugin/Makefile.am +++ b/storage/innodb_plugin/Makefile.am @@ -228,9 +228,8 @@ noinst_HEADERS= \ include/ut0wqueue.h \ mem/mem0dbg.c -EXTRA_LIBRARIES= libinnobase.a -noinst_LIBRARIES= @plugin_innodb_plugin_static_target@ -libinnobase_a_SOURCES= \ +noinst_LTLIBRARIES= @plugin_innodb_plugin_static_target@ +libinnobase_la_SOURCES= \ btr/btr0btr.c \ btr/btr0cur.c \ btr/btr0pcur.c \ @@ -325,16 +324,16 @@ libinnobase_a_SOURCES= \ ut/ut0vec.c \ ut/ut0wqueue.c -libinnobase_a_CXXFLAGS= $(AM_CXXFLAGS) -libinnobase_a_CFLAGS= $(AM_CFLAGS) +libinnobase_la_CXXFLAGS= $(AM_CXXFLAGS) +libinnobase_la_CFLAGS= $(AM_CFLAGS) -EXTRA_LTLIBRARIES= ha_innodb_plugin.la +EXTRA_LTLIBRARIES= libinnobase.la ha_innodb_plugin.la pkgplugin_LTLIBRARIES= @plugin_innodb_plugin_shared_target@ ha_innodb_plugin_la_LDFLAGS= -module -rpath $(pkgplugindir) ha_innodb_plugin_la_CXXFLAGS= -shared $(AM_CXXFLAGS) $(INNODB_DYNAMIC_CFLAGS) ha_innodb_plugin_la_CFLAGS= -shared $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS) -ha_innodb_plugin_la_SOURCES= $(libinnobase_a_SOURCES) +ha_innodb_plugin_la_SOURCES= $(libinnobase_la_SOURCES) EXTRA_DIST= CMakeLists.txt plug.in \ pars/make_bison.sh pars/make_flex.sh \ diff --git a/storage/maria/CMakeLists.txt b/storage/maria/CMakeLists.txt index 22e0211f052..fe6570d9c03 100644 --- a/storage/maria/CMakeLists.txt +++ b/storage/maria/CMakeLists.txt @@ -65,9 +65,8 @@ TARGET_LINK_LIBRARIES(maria_read_log maria myisam mysys dbug strings zlib wsock3 ADD_EXECUTABLE(maria_pack maria_pack.c) TARGET_LINK_LIBRARIES(maria_pack maria myisam mysys dbug strings zlib wsock32) -ADD_EXECUTABLE(maria_dump_log ma_loghandler.c unittest/ma_loghandler_examples.c) +ADD_EXECUTABLE(maria_dump_log maria_dump_log.c unittest/ma_loghandler_examples.c) TARGET_LINK_LIBRARIES(maria_dump_log maria myisam mysys dbug strings zlib wsock32) -SET_TARGET_PROPERTIES(maria_dump_log PROPERTIES COMPILE_FLAGS "-DMARIA_DUMP_LOG") ADD_EXECUTABLE(ma_test1 ma_test1.c) TARGET_LINK_LIBRARIES(ma_test1 maria myisam mysys dbug strings zlib wsock32) diff --git a/storage/maria/Makefile.am b/storage/maria/Makefile.am index d38abe01bdc..5e78614f0ca 100644 --- a/storage/maria/Makefile.am +++ b/storage/maria/Makefile.am @@ -34,6 +34,9 @@ EXTRA_DIST = ma_test_all.sh ma_test_all.res ma_test_big.sh \ ma_ft_stem.c CMakeLists.txt plug.in ma_test_recovery pkgdata_DATA = pkglib_LIBRARIES = libmaria.a +noinst_LTLIBRARIES = libmaria.la libmaria_s.la \ + @plugin_maria_embedded_static_target@ +EXTRA_LTLIBRARIES = libmaria_embedded.la bin_PROGRAMS = maria_chk maria_pack maria_ftdump maria_read_log \ maria_dump_log maria_chk_DEPENDENCIES= $(LIBRARIES) @@ -58,13 +61,12 @@ maria_read_log_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmaria.a \ $(top_builddir)/dbug/libdbug.a \ $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@ maria_dump_log_DEPENDENCIES=$(LIBRARIES) ma_loghandler.c -maria_dump_log_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmaria.a \ +maria_dump_log_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmaria.la \ $(top_builddir)/storage/myisam/libmyisam.a \ $(top_builddir)/mysys/libmysys.a \ $(top_builddir)/dbug/libdbug.a \ $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@ -maria_dump_log_SOURCES= ma_loghandler.c unittest/ma_loghandler_examples.c -maria_dump_log_CPPFLAGS= -DMARIA_DUMP_LOG +maria_dump_log_SOURCES= maria_dump_log.c unittest/ma_loghandler_examples.c noinst_PROGRAMS = ma_test1 ma_test2 ma_test3 ma_rt_test ma_sp_test noinst_HEADERS = maria_def.h ma_rt_index.h ma_rt_key.h ma_rt_mbr.h \ ma_sp_defs.h ma_fulltext.h ma_ftdefs.h ma_ft_test1.h \ @@ -112,7 +114,7 @@ ma_sp_test_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmaria.a \ $(top_builddir)/mysys/libmysys.a \ $(top_builddir)/dbug/libdbug.a \ $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@ -libmaria_a_SOURCES = ma_init.c ma_open.c ma_extra.c ma_info.c ma_rkey.c \ +libmaria_la_SOURCES = ma_init.c ma_open.c ma_extra.c ma_info.c ma_rkey.c \ ma_rnext.c ma_rnext_same.c \ ma_search.c ma_page.c ma_key_recover.c ma_key.c \ ma_locking.c ma_state.c \ @@ -134,8 +136,20 @@ libmaria_a_SOURCES = ma_init.c ma_open.c ma_extra.c ma_info.c ma_rkey.c \ ma_sp_key.c ma_control_file.c ma_loghandler.c \ ma_pagecache.c ma_pagecaches.c \ ma_checkpoint.c ma_recovery.c ma_commit.c \ - ma_pagecrc.c ma_recovery_util.c \ - ha_maria.cc + ma_pagecrc.c ma_recovery_util.c + +libmaria_s_la_SOURCES = ha_maria.cc +libmaria_s_la_CXXFLAGS = $(AM_CXXFLAGS) +libmaria_s_la_LIBADD = libmaria.la +libmaria_embedded_la_SOURCES = ha_maria.cc +libmaria_embedded_la_LIBADD = libmaria.la +libmaria_embedded_la_CXXFLAGS = $(AM_CXXFLAGS) @plugin_embedded_defs@ + +libmaria_a_SOURCES= +libmaria.a: libmaria.la + $(CP) .libs/libmaria.a $@ + + CLEANFILES = test?.MA? FT?.MA? isam.log ma_test_all ma_rt_test.MA? sp_test.MA? maria_log_control maria_log.0000* SUFFIXES = .sh diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index 1cc4140081a..423cd2f0dd7 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -1085,26 +1085,6 @@ static my_bool translog_max_lsn_to_header(File file, LSN lsn) } -/* - Information from transaction log file header -*/ - -typedef struct st_loghandler_file_info -{ - /* - LSN_IMPOSSIBLE for current file (not finished file). - Maximum LSN of the record which parts stored in the - file. - */ - LSN max_lsn; - ulonglong timestamp; /* Time stamp */ - ulong maria_version; /* Version of maria loghandler */ - ulong mysql_version; /* Version of mysql server */ - ulong server_id; /* Server ID */ - ulong page_size; /* Loghandler page size */ - ulong file_number; /* Number of the file (from the file header) */ -} LOGHANDLER_FILE_INFO; - /* @brief Extract hander file information from loghandler file page @@ -1112,8 +1092,8 @@ typedef struct st_loghandler_file_info @param page_buff buffer with the page content */ -static void translog_interpret_file_header(LOGHANDLER_FILE_INFO *desc, - uchar *page_buff) +void translog_interpret_file_header(LOGHANDLER_FILE_INFO *desc, + uchar *page_buff) { uchar *ptr; @@ -3400,7 +3380,7 @@ my_bool translog_walk_filenames(const char *directory, @brief Fills table of dependence length of page header from page flags */ -static void translog_fill_overhead_table() +void translog_fill_overhead_table() { uint i; for (i= 0; i < TRANSLOG_FLAGS_NUM; i++) @@ -8321,156 +8301,6 @@ void translog_set_file_size(uint32 size) } -/** - Write debug information to log if we EXTRA_DEBUG is enabled -*/ - -my_bool translog_log_debug_info(TRN *trn __attribute__((unused)), - enum translog_debug_info_type type - __attribute__((unused)), - uchar *info __attribute__((unused)), - size_t length __attribute__((unused))) -{ -#ifdef EXTRA_DEBUG - LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 2]; - uchar debug_type; - LSN lsn; - - if (!trn) - { - /* - We can't log the current transaction because we don't have - an active transaction. Use a temporary transaction object instead - */ - trn= &dummy_transaction_object; - } - debug_type= (uchar) type; - log_array[TRANSLOG_INTERNAL_PARTS + 0].str= &debug_type; - log_array[TRANSLOG_INTERNAL_PARTS + 0].length= 1; - log_array[TRANSLOG_INTERNAL_PARTS + 1].str= info; - log_array[TRANSLOG_INTERNAL_PARTS + 1].length= length; - return translog_write_record(&lsn, LOGREC_DEBUG_INFO, - trn, NULL, - (translog_size_t) (1+ length), - sizeof(log_array)/sizeof(log_array[0]), - log_array, NULL, NULL); -#else - return 0; -#endif -} - - -#ifdef MARIA_DUMP_LOG -#include -extern void translog_example_table_init(); -static const char *load_default_groups[]= { "maria_dump_log",0 }; -static void get_options(int *argc,char * * *argv); -#ifndef DBUG_OFF -#if defined(__WIN__) -const char *default_dbug_option= "d:t:i:O,\\maria_dump_log.trace"; -#else -const char *default_dbug_option= "d:t:i:o,/tmp/maria_dump_log.trace"; -#endif -#endif -static ulonglong opt_offset; -static ulong opt_pages; -static const char *opt_file= NULL; -static File handler= -1; -static my_bool opt_unit= 0; -static struct my_option my_long_options[] = -{ -#ifdef IMPLTMENTED - {"body", 'b', - "Print chunk body dump", - (uchar **) &opt_body, (uchar **) &opt_body, 0, - GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif -#ifndef DBUG_OFF - {"debug", '#', "Output debug log. Often the argument is 'd:t:o,filename'.", - 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, -#endif - {"file", 'f', "Path to file which will be read", - (uchar**) &opt_file, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"help", '?', "Display this help and exit.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - { "offset", 'o', "Start reading log from this offset", - (uchar**) &opt_offset, (uchar**) &opt_offset, - 0, GET_ULL, REQUIRED_ARG, 0, 0, ~(longlong) 0, 0, 0, 0 }, - { "pages", 'n', "Number of pages to read", - (uchar**) &opt_pages, (uchar**) &opt_pages, 0, - GET_ULONG, REQUIRED_ARG, (long) ~(ulong) 0, - (long) 1, (long) ~(ulong) 0, (long) 0, - (long) 1, 0}, - {"unit-test", 'U', - "Use unit test record table (for logs created by unittests", - (uchar **) &opt_unit, (uchar **) &opt_unit, 0, - GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"version", 'V', "Print version and exit.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} -}; - - -static void print_version(void) -{ - VOID(printf("%s Ver 1.0 for %s on %s\n", - my_progname_short, SYSTEM_TYPE, MACHINE_TYPE)); - NETWARE_SET_SCREEN_MODE(1); -} - - -static void usage(void) -{ - print_version(); - puts("Copyright (C) 2008 MySQL AB"); - puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,"); - puts("and you are welcome to modify and redistribute it under the GPL license\n"); - - puts("Dump content of maria log pages."); - VOID(printf("\nUsage: %s -f file OPTIONS\n", my_progname_short)); - my_print_help(my_long_options); - print_defaults("my", load_default_groups); - my_print_variables(my_long_options); -} - - -static my_bool -get_one_option(int optid __attribute__((unused)), - const struct my_option *opt __attribute__((unused)), - char *argument __attribute__((unused))) -{ - switch (optid) { - case '?': - usage(); - exit(0); - case 'V': - print_version(); - exit(0); -#ifndef DBUG_OFF - case '#': - DBUG_SET_INITIAL(argument ? argument : default_dbug_option); - break; -#endif - } - return 0; -} - - -static void get_options(int *argc,char ***argv) -{ - int ho_error; - - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) - exit(ho_error); - - if (opt_file == NULL) - { - usage(); - exit(1); - } -} - - /** @brief Dump information about file header page. */ @@ -8655,7 +8485,7 @@ static uchar *dump_chunk(uchar *buffer, uchar *ptr) @brief Dump information about page with data. */ -static void dump_datapage(uchar *buffer) +static void dump_datapage(uchar *buffer, File handler) { uchar *ptr; ulong offset; @@ -8736,79 +8566,51 @@ static void dump_datapage(uchar *buffer) @brief Dump information about page. */ -static void dump_page(uchar *buffer) +void dump_page(uchar *buffer, File handler) { - printf("Page by offset %llu (0x%llx)\n", opt_offset, opt_offset); if (strncmp((char*)maria_trans_file_magic, (char*)buffer, sizeof(maria_trans_file_magic)) == 0) { dump_header_page(buffer); } - dump_datapage(buffer); + dump_datapage(buffer, handler); } /** - @brief maria_dump_log main function. + Write debug information to log if we EXTRA_DEBUG is enabled */ -int main(int argc, char **argv) +my_bool translog_log_debug_info(TRN *trn __attribute__((unused)), + enum translog_debug_info_type type + __attribute__((unused)), + uchar *info __attribute__((unused)), + size_t length __attribute__((unused))) { - char **default_argv; - uchar buffer[TRANSLOG_PAGE_SIZE]; - MY_INIT(argv[0]); +#ifdef EXTRA_DEBUG + LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 2]; + uchar debug_type; + LSN lsn; - load_defaults("my", load_default_groups, &argc, &argv); - default_argv= argv; - get_options(&argc, &argv); - - if (opt_unit) - translog_example_table_init(); - else - translog_table_init(); - translog_fill_overhead_table(); - - maria_data_root= (char *)"."; - - if ((handler= my_open(opt_file, O_RDONLY, MYF(MY_WME))) < 0) + if (!trn) { - fprintf(stderr, "Can't open file: '%s' errno: %d\n", - opt_file, my_errno); - goto err; + /* + We can't log the current transaction because we don't have + an active transaction. Use a temporary transaction object instead + */ + trn= &dummy_transaction_object; } - if (my_seek(handler, opt_offset, SEEK_SET, MYF(MY_WME)) != - opt_offset) - { - fprintf(stderr, "Can't set position %lld file: '%s' errno: %d\n", - opt_offset, opt_file, my_errno); - goto err; - } - for (; - opt_pages; - opt_offset+= TRANSLOG_PAGE_SIZE, opt_pages--) - { - if (my_pread(handler, buffer, TRANSLOG_PAGE_SIZE, opt_offset, - MYF(MY_NABP))) - { - if (my_errno == HA_ERR_FILE_TOO_SHORT) - goto end; - fprintf(stderr, "Can't read page at position %lld file: '%s' " - "errno: %d\n", opt_offset, opt_file, my_errno); - goto err; - } - dump_page(buffer); - } - -end: - my_close(handler, MYF(0)); - free_defaults(default_argv); - exit(0); - return 0; /* No compiler warning */ - -err: - my_close(handler, MYF(0)); - fprintf(stderr, "%s: FAILED\n", my_progname_short); - free_defaults(default_argv); - exit(1); -} + debug_type= (uchar) type; + log_array[TRANSLOG_INTERNAL_PARTS + 0].str= &debug_type; + log_array[TRANSLOG_INTERNAL_PARTS + 0].length= 1; + log_array[TRANSLOG_INTERNAL_PARTS + 1].str= info; + log_array[TRANSLOG_INTERNAL_PARTS + 1].length= length; + return translog_write_record(&lsn, LOGREC_DEBUG_INFO, + trn, NULL, + (translog_size_t) (1+ length), + sizeof(log_array)/sizeof(log_array[0]), + log_array, NULL, NULL); +#else + return 0; #endif +} diff --git a/storage/maria/ma_loghandler.h b/storage/maria/ma_loghandler.h index 1040d07997a..c22d361d142 100644 --- a/storage/maria/ma_loghandler.h +++ b/storage/maria/ma_loghandler.h @@ -358,6 +358,7 @@ translog_assign_id_to_share_from_recovery(struct st_maria_share *share, extern my_bool translog_walk_filenames(const char *directory, my_bool (*callback)(const char *, const char *)); +extern void dump_page(uchar *buffer, File handler); extern my_bool translog_log_debug_info(TRN *trn, enum translog_debug_info_type type, uchar *info, size_t length); @@ -376,8 +377,31 @@ extern enum enum_translog_status translog_status; ma_loghandler_for_recovery.h ? */ +/* + Information from transaction log file header +*/ + +typedef struct st_loghandler_file_info +{ + /* + LSN_IMPOSSIBLE for current file (not finished file). + Maximum LSN of the record which parts stored in the + file. + */ + LSN max_lsn; + ulonglong timestamp; /* Time stamp */ + ulong maria_version; /* Version of maria loghandler */ + ulong mysql_version; /* Version of mysql server */ + ulong server_id; /* Server ID */ + ulong page_size; /* Loghandler page size */ + ulong file_number; /* Number of the file (from the file header) */ +} LOGHANDLER_FILE_INFO; + #define SHARE_ID_MAX 65535 /* array's size */ +extern void translog_fill_overhead_table(); +extern void translog_interpret_file_header(LOGHANDLER_FILE_INFO *desc, + uchar *page_buff); extern LSN translog_first_lsn_in_log(); extern LSN translog_first_theoretical_lsn(); extern LSN translog_next_LSN(TRANSLOG_ADDRESS addr, TRANSLOG_ADDRESS horizon); diff --git a/storage/maria/maria_dump_log.c b/storage/maria/maria_dump_log.c new file mode 100644 index 00000000000..bc7ec566462 --- /dev/null +++ b/storage/maria/maria_dump_log.c @@ -0,0 +1,190 @@ +/* Copyright (C) 2007 MySQL AB & Sanja Belkin + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "maria_def.h" +#include +extern void translog_example_table_init(); +static const char *load_default_groups[]= { "maria_dump_log",0 }; +static void get_options(int *argc,char * * *argv); +#ifndef DBUG_OFF +#if defined(__WIN__) +const char *default_dbug_option= "d:t:i:O,\\maria_dump_log.trace"; +#else +const char *default_dbug_option= "d:t:i:o,/tmp/maria_dump_log.trace"; +#endif +#endif +static ulonglong opt_offset; +static ulong opt_pages; +static const char *opt_file= NULL; +static File handler= -1; +static my_bool opt_unit= 0; +static struct my_option my_long_options[] = +{ +#ifdef IMPLTMENTED + {"body", 'b', + "Print chunk body dump", + (uchar **) &opt_body, (uchar **) &opt_body, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, +#endif +#ifndef DBUG_OFF + {"debug", '#', "Output debug log. Often the argument is 'd:t:o,filename'.", + 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, +#endif + {"file", 'f', "Path to file which will be read", + (uchar**) &opt_file, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"help", '?', "Display this help and exit.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + { "offset", 'o', "Start reading log from this offset", + (uchar**) &opt_offset, (uchar**) &opt_offset, + 0, GET_ULL, REQUIRED_ARG, 0, 0, ~(longlong) 0, 0, 0, 0 }, + { "pages", 'n', "Number of pages to read", + (uchar**) &opt_pages, (uchar**) &opt_pages, 0, + GET_ULONG, REQUIRED_ARG, (long) ~(ulong) 0, + (long) 1, (long) ~(ulong) 0, (long) 0, + (long) 1, 0}, + {"unit-test", 'U', + "Use unit test record table (for logs created by unittests", + (uchar **) &opt_unit, (uchar **) &opt_unit, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"version", 'V', "Print version and exit.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} +}; + + +static void print_version(void) +{ + VOID(printf("%s Ver 1.0 for %s on %s\n", + my_progname_short, SYSTEM_TYPE, MACHINE_TYPE)); + NETWARE_SET_SCREEN_MODE(1); +} + + +static void usage(void) +{ + print_version(); + puts("Copyright (C) 2008 MySQL AB"); + puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,"); + puts("and you are welcome to modify and redistribute it under the GPL license\n"); + + puts("Dump content of maria log pages."); + VOID(printf("\nUsage: %s -f file OPTIONS\n", my_progname_short)); + my_print_help(my_long_options); + print_defaults("my", load_default_groups); + my_print_variables(my_long_options); +} + + +static my_bool +get_one_option(int optid __attribute__((unused)), + const struct my_option *opt __attribute__((unused)), + char *argument __attribute__((unused))) +{ + switch (optid) { + case '?': + usage(); + exit(0); + case 'V': + print_version(); + exit(0); +#ifndef DBUG_OFF + case '#': + DBUG_SET_INITIAL(argument ? argument : default_dbug_option); + break; +#endif + } + return 0; +} + + +static void get_options(int *argc,char ***argv) +{ + int ho_error; + + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) + exit(ho_error); + + if (opt_file == NULL) + { + usage(); + exit(1); + } +} + + +/** + @brief maria_dump_log main function. +*/ + +int main(int argc, char **argv) +{ + char **default_argv; + uchar buffer[TRANSLOG_PAGE_SIZE]; + MY_INIT(argv[0]); + + load_defaults("my", load_default_groups, &argc, &argv); + default_argv= argv; + get_options(&argc, &argv); + + if (opt_unit) + translog_example_table_init(); + else + translog_table_init(); + translog_fill_overhead_table(); + + maria_data_root= (char *)"."; + + if ((handler= my_open(opt_file, O_RDONLY, MYF(MY_WME))) < 0) + { + fprintf(stderr, "Can't open file: '%s' errno: %d\n", + opt_file, my_errno); + goto err; + } + if (my_seek(handler, opt_offset, SEEK_SET, MYF(MY_WME)) != + opt_offset) + { + fprintf(stderr, "Can't set position %lld file: '%s' errno: %d\n", + opt_offset, opt_file, my_errno); + goto err; + } + for (; + opt_pages; + opt_offset+= TRANSLOG_PAGE_SIZE, opt_pages--) + { + if (my_pread(handler, buffer, TRANSLOG_PAGE_SIZE, opt_offset, + MYF(MY_NABP))) + { + if (my_errno == HA_ERR_FILE_TOO_SHORT) + goto end; + fprintf(stderr, "Can't read page at position %lld file: '%s' " + "errno: %d\n", opt_offset, opt_file, my_errno); + goto err; + } + printf("Page by offset %llu (0x%llx)\n", opt_offset, opt_offset); + dump_page(buffer, handler); + } + +end: + my_close(handler, MYF(0)); + free_defaults(default_argv); + exit(0); + return 0; /* No compiler warning */ + +err: + my_close(handler, MYF(0)); + fprintf(stderr, "%s: FAILED\n", my_progname_short); + free_defaults(default_argv); + exit(1); +} diff --git a/storage/maria/plug.in b/storage/maria/plug.in index 686c8361a87..bdf1ca7a5bf 100644 --- a/storage/maria/plug.in +++ b/storage/maria/plug.in @@ -1,10 +1,9 @@ MYSQL_STORAGE_ENGINE(maria,, [Maria Storage Engine], [Crash-safe tables with MyISAM heritage], [default,max,max-no-ndb]) MYSQL_PLUGIN_DIRECTORY(maria, [storage/maria]) -MYSQL_PLUGIN_STATIC(maria, [libmaria.a]) +MYSQL_PLUGIN_STATIC(maria, [libmaria_s.la], [libmaria_embedded.la]) # Maria will probably go first into max builds, not all builds, # so we don't declare it mandatory. -MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(maria, [ha_maria.cc]) MYSQL_PLUGIN_ACTIONS(maria, [ # AC_CONFIG_FILES(storage/maria/unittest/Makefile) diff --git a/storage/myisam/Makefile.am b/storage/myisam/Makefile.am index ea942672856..8f3d51c4886 100644 --- a/storage/myisam/Makefile.am +++ b/storage/myisam/Makefile.am @@ -31,6 +31,10 @@ EXTRA_DIST = mi_test_all.sh mi_test_all.res ft_stem.c CMakeLists.txt plug.in pkgdata_DATA = pkglib_LIBRARIES = libmyisam.a +noinst_LTLIBRARIES = libmyisam.la libmyisam_s.la \ + @plugin_myisam_embedded_static_target@ +EXTRA_LTLIBRARIES = libmyisam_embedded.la + bin_PROGRAMS = myisamchk myisamlog myisampack myisam_ftdump myisamchk_DEPENDENCIES= $(LIBRARIES) myisamchk_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \ @@ -83,7 +87,8 @@ sp_test_LDADD = @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \ $(top_builddir)/mysys/libmysys.a \ $(top_builddir)/dbug/libdbug.a \ $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@ -libmyisam_a_SOURCES = mi_open.c mi_extra.c mi_info.c mi_rkey.c \ + +libmyisam_la_SOURCES = mi_open.c mi_extra.c mi_info.c mi_rkey.c \ mi_rnext.c mi_rnext_same.c \ mi_search.c mi_page.c mi_key.c mi_locking.c \ mi_rrnd.c mi_scan.c mi_cache.c \ @@ -98,8 +103,19 @@ libmyisam_a_SOURCES = mi_open.c mi_extra.c mi_info.c mi_rkey.c \ mi_keycache.c mi_preload.c \ ft_parser.c ft_stopwords.c ft_static.c \ ft_update.c ft_boolean_search.c ft_nlq_search.c \ - sort.c ha_myisam.cc ft_myisam.c \ + sort.c ft_myisam.c \ rt_index.c rt_key.c rt_mbr.c rt_split.c sp_key.c +libmyisam_s_la_SOURCES = ha_myisam.cc +libmyisam_s_la_CXXFLAGS = $(AM_CXXFLAGS) +libmyisam_s_la_LIBADD = libmyisam.la +libmyisam_embedded_la_SOURCES = ha_myisam.cc +libmyisam_embedded_la_CXXFLAGS = $(AM_CXXFLAGS) @plugin_embedded_defs@ +libmyisam_embedded_la_LIBADD = libmyisam.la + +libmyisam_a_SOURCES= +libmyisam.a: libmyisam.la + $(CP) .libs/libmyisam.a $@ + CLEANFILES = test?.MY? FT?.MY? isam.log mi_test_all rt_test.MY? sp_test.MY? # Move to automake rules ? diff --git a/storage/myisam/plug.in b/storage/myisam/plug.in index e92b5e56d7f..95b29336493 100644 --- a/storage/myisam/plug.in +++ b/storage/myisam/plug.in @@ -1,7 +1,6 @@ dnl MYSQL_STORAGE_ENGINE(myisam,no, [MyISAM Storage Engine], dnl [Traditional non-transactional MySQL tables]) dnl MYSQL_PLUGIN_DIRECTORY(myisam, [storage/myisam]) -dnl MYSQL_PLUGIN_STATIC(myisam, [libmyisam.a]) +dnl MYSQL_PLUGIN_STATIC(myisam, [libmyisam_s.la], [libmyisam_embedded.la]) dnl MYSQL_PLUGIN_MANDATORY(myisam) dnl Default -dnl MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(myisam, [ha_myisam.cc]) diff --git a/storage/myisammrg/Makefile.am b/storage/myisammrg/Makefile.am index 1ca51bc9d03..66fd2402646 100644 --- a/storage/myisammrg/Makefile.am +++ b/storage/myisammrg/Makefile.am @@ -27,16 +27,26 @@ LDADD = DEFS = @DEFS@ pkglib_LIBRARIES = libmyisammrg.a +noinst_LTLIBRARIES = libmyisammrg.la libmyisammrg_s.la \ + @plugin_myisammrg_embedded_static_target@ +EXTRA_LTLIBRARIES = libmyisammrg_embedded.la noinst_HEADERS = myrg_def.h ha_myisammrg.h -noinst_LIBRARIES = libmyisammrg.a -libmyisammrg_a_SOURCES = myrg_open.c myrg_extra.c myrg_info.c myrg_locking.c \ +libmyisammrg_la_SOURCES = myrg_open.c myrg_extra.c myrg_info.c myrg_locking.c \ myrg_rrnd.c myrg_update.c myrg_delete.c myrg_rsame.c \ myrg_panic.c myrg_close.c myrg_create.c myrg_static.c \ myrg_rkey.c myrg_rfirst.c myrg_rlast.c myrg_rnext.c \ myrg_rprev.c myrg_queue.c myrg_write.c myrg_range.c \ - ha_myisammrg.cc \ myrg_rnext_same.c myrg_records.c +libmyisammrg_s_la_SOURCES = ha_myisammrg.cc +libmyisammrg_s_la_CXXFLAGS = $(AM_CXXFLAGS) +libmyisammrg_s_la_LIBADD = libmyisammrg.la +libmyisammrg_embedded_la_SOURCES = ha_myisammrg.cc +libmyisammrg_embedded_la_CXXFLAGS = $(AM_CXXFLAGS) @plugin_embedded_defs@ +libmyisammrg_embedded_la_LIBADD = libmyisammrg.la +libmyisammrg_a_SOURCES= +libmyisammrg.a: libmyisammrg.la + $(CP) .libs/libmyisammrg.a $@ EXTRA_DIST = CMakeLists.txt plug.in diff --git a/storage/myisammrg/plug.in b/storage/myisammrg/plug.in index 1f94e07d881..a2654373fba 100644 --- a/storage/myisammrg/plug.in +++ b/storage/myisammrg/plug.in @@ -1,6 +1,5 @@ MYSQL_STORAGE_ENGINE(myisammrg,no,[MyISAM MERGE Engine], [Merge multiple MySQL tables into one]) MYSQL_PLUGIN_DIRECTORY(myisammrg,[storage/myisammrg]) -MYSQL_PLUGIN_STATIC(myisammrg, [libmyisammrg.a]) +MYSQL_PLUGIN_STATIC(myisammrg, [libmyisammrg_s.la], [libmyisammrg_embedded.la]) MYSQL_PLUGIN_MANDATORY(myisammrg) -MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(myisammrg, [ha_myisammrg.cc]) diff --git a/storage/pbxt/plug.in b/storage/pbxt/plug.in index 02c5d8adcbe..c0dc06d9702 100644 --- a/storage/pbxt/plug.in +++ b/storage/pbxt/plug.in @@ -1,8 +1,7 @@ MYSQL_STORAGE_ENGINE(pbxt,no, [PBXT Storage Engine], [MVCC-based transactional engine], [max,max-no-ndb]) MYSQL_PLUGIN_DIRECTORY(pbxt, [storage/pbxt]) -MYSQL_PLUGIN_STATIC(pbxt, [src/libpbxt.a]) +MYSQL_PLUGIN_STATIC(pbxt, [src/libpbxt_s.la], [src/libpbxt_s_embedded.la]) MYSQL_PLUGIN_ACTIONS(pbxt, [ # AC_CONFIG_FILES(storage/pbxt/src/Makefile) ]) -MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(pbxt, [[src/ha_pbxt.cc],[src/myxt_xt.cc],[src/discover_xt.cc]]) diff --git a/storage/pbxt/src/Makefile.am b/storage/pbxt/src/Makefile.am index fc4c4ef8f1e..4c5467d24d0 100644 --- a/storage/pbxt/src/Makefile.am +++ b/storage/pbxt/src/Makefile.am @@ -26,25 +26,31 @@ noinst_HEADERS = bsearch_xt.h cache_xt.h ccutils_xt.h database_xt.h \ pbms.h xt_config.h xt_defs.h xt_errno.h locklist_xt.h EXTRA_LTLIBRARIES = libpbxt.la -libpbxt_la_SOURCES = bsearch_xt.cc cache_xt.cc ccutils_xt.cc database_xt.cc \ +non_mysql_internal_sources = bsearch_xt.cc cache_xt.cc ccutils_xt.cc database_xt.cc \ datadic_xt.cc datalog_xt.cc filesys_xt.cc hashtab_xt.cc \ - ha_pbxt.cc heap_xt.cc index_xt.cc linklist_xt.cc \ - memory_xt.cc myxt_xt.cc pthread_xt.cc restart_xt.cc \ + heap_xt.cc index_xt.cc linklist_xt.cc \ + memory_xt.cc pthread_xt.cc restart_xt.cc \ sortedlist_xt.cc strutil_xt.cc \ tabcache_xt.cc table_xt.cc trace_xt.cc thread_xt.cc \ - systab_xt.cc ha_xtsys.cc discover_xt.cc backup_xt.cc \ + systab_xt.cc ha_xtsys.cc backup_xt.cc \ util_xt.cc xaction_xt.cc xactlog_xt.cc lock_xt.cc locklist_xt.cc - -libpbxt_la_LDFLAGS = -module +mysql_internal_sources = ha_pbxt.cc myxt_xt.cc discover_xt.cc +libpbxt_la_SOURCES = $(non_mysql_internal_sources) $(mysql_internal_sources) # These are the warning Drizzle uses: # DRIZZLE_WARNINGS = -W -Wall -Wextra -pedantic -Wundef -Wredundant-decls -Wno-strict-aliasing -Wno-long-long -Wno-unused-parameter -libpbxt_la_CXXFLAGS = $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN -libpbxt_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN -std=c99 +libpbxt_la_CXXFLAGS = -shared $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN +libpbxt_la_CFLAGS = -shared $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN -std=c99 +libpbxt_la_LDFLAGS = -module -EXTRA_LIBRARIES = libpbxt.a -noinst_LIBRARIES = libpbxt.a -libpbxt_a_SOURCES = $(libpbxt_la_SOURCES) +noinst_LTLIBRARIES = libpbxt_s.la libpbxt_s_embedded.la libpbxt_s_common.la + +libpbxt_s_common_la_SOURCES = $(non_mysql_internal_sources) +libpbxt_s_la_SOURCES = $(mysql_internal_sources) +libpbxt_s_la_LIBADD = libpbxt_s_common.la +libpbxt_s_embedded_la_SOURCES = $(mysql_internal_sources) +libpbxt_s_embedded_la_CXXFLAGS = $(AM_CXXFLAGS) @plugin_embedded_defs@ +libpbxt_s_embedded_la_LIBADD = libpbxt_s_common.la EXTRA_DIST = pbms_enabled.cc win_inttypes.h diff --git a/storage/xtradb/Makefile.am b/storage/xtradb/Makefile.am index 7dffdacbcf1..abc24b0e1a4 100644 --- a/storage/xtradb/Makefile.am +++ b/storage/xtradb/Makefile.am @@ -229,9 +229,8 @@ noinst_HEADERS= \ handler/innodb_patch_info.h \ mem/mem0dbg.c -EXTRA_LIBRARIES= libxtradb.a -noinst_LIBRARIES= @plugin_xtradb_static_target@ -libxtradb_a_SOURCES= \ +noinst_LTLIBRARIES= @plugin_xtradb_static_target@ +libxtradb_la_SOURCES= \ btr/btr0btr.c \ btr/btr0cur.c \ btr/btr0pcur.c \ @@ -326,16 +325,16 @@ libxtradb_a_SOURCES= \ ut/ut0vec.c \ ut/ut0wqueue.c -libxtradb_a_CXXFLAGS= $(AM_CXXFLAGS) -libxtradb_a_CFLAGS= $(AM_CFLAGS) +libxtradb_la_CXXFLAGS= $(AM_CXXFLAGS) +libxtradb_la_CFLAGS= $(AM_CFLAGS) -EXTRA_LTLIBRARIES= ha_xtradb.la +EXTRA_LTLIBRARIES= libxtradb.la ha_xtradb.la pkgplugin_LTLIBRARIES= @plugin_xtradb_shared_target@ ha_xtradb_la_LDFLAGS= -module -rpath $(pkgplugindir) ha_xtradb_la_CXXFLAGS= -shared $(AM_CXXFLAGS) $(INNODB_DYNAMIC_CFLAGS) ha_xtradb_la_CFLAGS= -shared $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS) -ha_xtradb_la_SOURCES= $(libxtradb_a_SOURCES) +ha_xtradb_la_SOURCES= $(libxtradb_la_SOURCES) EXTRA_DIST= CMakeLists.txt plug.in \ pars/make_bison.sh pars/make_flex.sh \ diff --git a/storage/xtradb/plug.in b/storage/xtradb/plug.in index 37c895fb520..67f25755762 100644 --- a/storage/xtradb/plug.in +++ b/storage/xtradb/plug.in @@ -17,7 +17,7 @@ MYSQL_STORAGE_ENGINE(xtradb, xtradb, [XtraDB Storage Engine], [XtraDB - a drop-in replacement for InnoDB], [max,max-no-ndb]) MYSQL_PLUGIN_DIRECTORY(xtradb, [storage/xtradb]) -MYSQL_PLUGIN_STATIC(xtradb, [libxtradb.a]) +MYSQL_PLUGIN_STATIC(xtradb, [libxtradb.la]) MYSQL_PLUGIN_DYNAMIC(xtradb, [ha_xtradb.la]) MYSQL_PLUGIN_ACTIONS(xtradb, [ with_plugin_innobase=$with_plugin_xtradb # for legacy code in configure.in diff --git a/strings/Makefile.am b/strings/Makefile.am index 9b0c1a33250..6a09abe7479 100644 --- a/strings/Makefile.am +++ b/strings/Makefile.am @@ -17,6 +17,7 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include pkglib_LIBRARIES = libmystrings.a +noinst_LTLIBRARIES = libmystrings.la # Exact one of ASSEMBLER_X if ASSEMBLER_x86 @@ -37,7 +38,7 @@ CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend. endif endif -libmystrings_a_SOURCES = $(ASRCS) $(CSRCS) +libmystrings_la_SOURCES = $(ASRCS) $(CSRCS) noinst_PROGRAMS = conf_to_src CLEANFILES = str_test uctypedump test_decimal # Default charset definitions @@ -56,9 +57,9 @@ EXTRA_DIST = ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc t_ctype.h my_strchr.c CMakeLists.txt \ CHARSET_INFO.txt strmov_overlapp.c -libmystrings_a_LIBADD= -conf_to_src_SOURCES = conf_to_src.c xml.c ctype.c bcmp.c -conf_to_src_LDADD= +libmystrings_la_LIBADD= +conf_to_src_SOURCES = conf_to_src.c +conf_to_src_LDADD = libmystrings.a #force static linking of conf_to_src - essential when linking against #custom installation of libc conf_to_src_LDFLAGS= @NOINST_LDFLAGS@ @@ -66,6 +67,9 @@ conf_to_src_LDFLAGS= @NOINST_LDFLAGS@ # This is because the dependency tracking misses @FOO@ vars in sources. #strtoull.o: @CHARSET_OBJS@ +libmystrings_a_SOURCES= +libmystrings.a: libmystrings.la + $(CP) .libs/libmystrings.a $@ FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@ diff --git a/unittest/unit.pl b/unittest/unit.pl index a1aab376fdf..be6424ec798 100644 --- a/unittest/unit.pl +++ b/unittest/unit.pl @@ -65,7 +65,7 @@ sub _find_test_files (@) { my @dirs = @_; my @files; find sub { - $File::Find::prune = 1 if /^SCCS$/; + $File::Find::prune = 1 if /^(SCCS|\.libs)$/; push(@files, $File::Find::name) if -x _ && (/-t\z/ || /-t\.exe\z/); }, @dirs; return @files; diff --git a/vio/Makefile.am b/vio/Makefile.am index c70af1008cd..588cd3ea0c4 100644 --- a/vio/Makefile.am +++ b/vio/Makefile.am @@ -17,9 +17,15 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ $(openssl_includes) LDADD = @CLIENT_EXTRA_LDFLAGS@ $(openssl_libs) $(yassl_libs) pkglib_LIBRARIES = libvio.a +noinst_LTLIBRARIES = libvio.la noinst_HEADERS = vio_priv.h -libvio_a_SOURCES = vio.c viosocket.c viossl.c viosslfactories.c +libvio_la_SOURCES = vio.c viosocket.c viossl.c viosslfactories.c EXTRA_DIST= CMakeLists.txt + +libvio_a_SOURCES= +libvio.a: libvio.la + $(CP) .libs/libvio.a $@ + From a967802ae94e1b0ce75436648446621a381838e7 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Nov 2010 16:10:11 +0200 Subject: [PATCH 7/7] Fix of the debugging print. --- storage/maria/ma_pagecache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c index f79b1f53022..1bb82ba92cd 100644 --- a/storage/maria/ma_pagecache.c +++ b/storage/maria/ma_pagecache.c @@ -3496,8 +3496,9 @@ static my_bool pagecache_delete_internal(PAGECACHE *pagecache, { PAGECACHE_FILE *filedesc= &block->hash_link->file; /* We are not going to write the page but have to call callbacks */ - DBUG_PRINT("info", ("flush_callback :0x%lx data: 0x%lx" + DBUG_PRINT("info", ("flush_callback :0x%lx" "write_callback: 0x%lx data: 0x%lx", + (ulong) filedesc->flush_log_callback, (ulong) filedesc->write_callback, (ulong) filedesc->callback_data)); if ((*filedesc->flush_log_callback)