From 1ff678a903eab5bb93c4756fbcca88caf487a074 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 Jan 2002 16:29:15 +0200 Subject: [PATCH 01/17] btr0cur.c, ha_innobase.cc: Fine-tune optimization parameters; in small tables the estimates are accurate; in big tables let us not be too optimistic about index selectivity sql/ha_innobase.cc: Fine-tune optimization parameters; in small tables the estimates are accurate; in big tables let us not be too optimistic about index selectivity innobase/btr/btr0cur.c: Fine-tune optimization parameters; in small tables the estimates are accurate; in big tables let us not be too optimistic about index selectivity --- innobase/btr/btr0cur.c | 20 +++++++++++++++++++- sql/ha_innobase.cc | 16 ---------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c index da51be11176..a078c843159 100644 --- a/innobase/btr/btr0cur.c +++ b/innobase/btr/btr0cur.c @@ -2552,6 +2552,7 @@ btr_estimate_number_of_different_key_vals( ulint total_external_size = 0; ulint i; ulint j; + ulint add_on; mtr_t mtr; n_cols = dict_index_get_n_unique(index); @@ -2624,8 +2625,25 @@ btr_estimate_number_of_different_key_vals( + not_empty_flag) / (BTR_KEY_VAL_ESTIMATE_N_PAGES + total_external_size); - } + /* If the tree is small, smaller than < + 10 * BTR_KEY_VAL_ESTIMATE_N_PAGES + total_external_size, then + the above estimate is ok. For bigger trees it is common that we + do not see any borders between key values in the few pages + we pick. But still there may be BTR_KEY_VAL_ESTIMATE_N_PAGES + different key values, or even more. Let us try to approximate + that: */ + + add_on = index->stat_n_leaf_pages / + (10 * (BTR_KEY_VAL_ESTIMATE_N_PAGES + total_external_size)); + + if (add_on > BTR_KEY_VAL_ESTIMATE_N_PAGES) { + add_on = BTR_KEY_VAL_ESTIMATE_N_PAGES; + } + + index->stat_n_diff_key_vals[j] += add_on; + } + mem_free(n_diff); } diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index acdc9736a4f..a923a259ebd 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -3130,22 +3130,6 @@ ha_innobase::info( rec_per_key = 1; } - /* Since the MySQL optimizer is often too - pessimistic in the assumption that a table - does not fit in the buffer pool, we - increase the attractiveness of indexes - by assuming the selectivity of any prefix - of an index is 1 / 100 or better. - (Actually, we should look at the table - size, and if the table is smaller than - the buffer pool, we should uniformly - increase the attractiveness of indexes, - regardless of the estimated selectivity.) */ - - if (rec_per_key > records / 100) { - rec_per_key = records / 100; - } - table->key_info[i].rec_per_key[j] = rec_per_key; } From 3518de828d1c7c384ea3503ae2ce1477bf4a9095 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 3 Feb 2002 15:21:15 +0200 Subject: [PATCH 02/17] ha_innobase.cc: Fix the crashes reported by Peter; SHOW CREATE does not call external_lock before calling ::info, and consequently the trx struct in prebuilt is obsolete; setting trx->op_info caused erratic memory corruption in mysqldump sql/ha_innobase.cc: Fix the crashes reported by Peter; SHOW CREATE does not call external_lock before calling ::info, and consequently the trx struct in prebuilt is obsolete; setting trx->op_info caused erratic memory corruption in mysqldump --- sql/ha_innobase.cc | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index a923a259ebd..88c7e10e94c 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -2952,10 +2952,6 @@ ha_innobase::records_in_range( void* heap2; DBUG_ENTER("records_in_range"); - - if (prebuilt->trx) { - prebuilt->trx->op_info = "estimating range size"; - } active_index = keynr; @@ -2988,10 +2984,6 @@ ha_innobase::records_in_range( dtuple_free_for_mysql(heap2); my_free((char*) key_val_buff2, MYF(0)); - - if (prebuilt->trx) { - prebuilt->trx->op_info = ""; - } DBUG_RETURN((ha_rows) n_rows); } @@ -3013,11 +3005,6 @@ ha_innobase::estimate_number_of_rows(void) ulonglong estimate; ulonglong data_file_length; - if (prebuilt->trx) { - prebuilt->trx->op_info = - "estimating upper bound of table size"; - } - DBUG_ENTER("info"); index = dict_table_get_first_index_noninline(prebuilt->table); @@ -3033,10 +3020,6 @@ ha_innobase::estimate_number_of_rows(void) estimate = 2 * data_file_length / dict_index_calc_min_rec_len(index); - if (prebuilt->trx) { - prebuilt->trx->op_info = ""; - } - return((ha_rows) estimate); } @@ -3075,10 +3058,6 @@ ha_innobase::info( ulong i; DBUG_ENTER("info"); - - if (prebuilt->trx) { - prebuilt->trx->op_info = "calculating table stats"; - } ib_table = prebuilt->table; @@ -3149,10 +3128,6 @@ ha_innobase::info( (dict_index_t*) trx_get_error_info(prebuilt->trx)); } - - if (prebuilt->trx) { - prebuilt->trx->op_info = ""; - } DBUG_VOID_RETURN; } From 9871a6d080f507f58afa91bfd7624c27b27963cd Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 4 Feb 2002 23:55:41 +0200 Subject: [PATCH 03/17] Many files: Small improvements row0mysql.c: Small improvements + fix the ALTER TABLE problem by introducing a lazy drop table it can use ha_innobase.cc: Some fine-tuning of optimization sql/ha_innobase.cc: Some fine-tuning of optimization innobase/include/log0recv.h: Small improvements innobase/include/mem0mem.h: Small improvements innobase/include/mem0pool.h: Small improvements innobase/include/row0mysql.h: Small improvements innobase/include/srv0srv.h: Small improvements innobase/include/trx0trx.h: Small improvements innobase/buf/buf0lru.c: Small improvements innobase/fil/fil0fil.c: Small improvements innobase/log/log0recv.c: Small improvements innobase/mem/mem0mem.c: Small improvements innobase/mem/mem0pool.c: Small improvements innobase/row/row0mysql.c: Small improvements + fix the ALTER TABLE problem by introducing a lazy drop table it can use innobase/srv/srv0srv.c: Small improvements innobase/srv/srv0start.c: Small improvements innobase/trx/trx0purge.c: Small improvements innobase/trx/trx0trx.c: Small improvements --- innobase/buf/buf0lru.c | 1 - innobase/fil/fil0fil.c | 10 +- innobase/include/log0recv.h | 1 + innobase/include/mem0mem.h | 19 ++- innobase/include/mem0pool.h | 12 ++ innobase/include/row0mysql.h | 20 ++- innobase/include/srv0srv.h | 6 + innobase/include/trx0trx.h | 17 +++ innobase/log/log0recv.c | 3 +- innobase/mem/mem0mem.c | 54 +++++++ innobase/mem/mem0pool.c | 36 ++++- innobase/row/row0mysql.c | 278 +++++++++++++++++++++++++++++------ innobase/srv/srv0srv.c | 58 ++++++-- innobase/srv/srv0start.c | 22 ++- innobase/trx/trx0purge.c | 4 +- innobase/trx/trx0trx.c | 52 ++++++- sql/ha_innobase.cc | 140 ++++++++++++------ 17 files changed, 610 insertions(+), 123 deletions(-) diff --git a/innobase/buf/buf0lru.c b/innobase/buf/buf0lru.c index c3118544492..a2996eefca9 100644 --- a/innobase/buf/buf0lru.c +++ b/innobase/buf/buf0lru.c @@ -242,7 +242,6 @@ loop: if (n_iterations > 30) { ut_print_timestamp(stderr); fprintf(stderr, - " ***********************************************\n" "InnoDB: Warning: difficult to find free blocks from\n" "InnoDB: the buffer pool (%lu search iterations)! Consider\n" "InnoDB: increasing the buffer pool size.\n", diff --git a/innobase/fil/fil0fil.c b/innobase/fil/fil0fil.c index 62389c8394c..138f1a78985 100644 --- a/innobase/fil/fil0fil.c +++ b/innobase/fil/fil0fil.c @@ -1088,7 +1088,15 @@ loop: node = UT_LIST_GET_FIRST(space->chain); for (;;) { - ut_a(node); + if (node == NULL) { + fprintf(stderr, + "InnoDB: Error: trying to access page number %lu in space %lu\n" + "InnoDB: which is outside the tablespace bounds.\n" + "InnoDB: Byte offset %lu, len %lu, i/o type %lu\n", + block_offset, space_id, byte_offset, len, type); + + ut_a(0); + } if (node->size > block_offset) { /* Found! */ diff --git a/innobase/include/log0recv.h b/innobase/include/log0recv.h index 51f14393d38..8f896756db9 100644 --- a/innobase/include/log0recv.h +++ b/innobase/include/log0recv.h @@ -258,6 +258,7 @@ struct recv_sys_struct{ extern recv_sys_t* recv_sys; extern ibool recv_recovery_on; extern ibool recv_no_ibuf_operations; +extern ibool recv_needed_recovery; /* States of recv_addr_struct */ #define RECV_NOT_PROCESSED 71 diff --git a/innobase/include/mem0mem.h b/innobase/include/mem0mem.h index 57fac93d3ac..89c5428f054 100644 --- a/innobase/include/mem0mem.h +++ b/innobase/include/mem0mem.h @@ -269,13 +269,24 @@ mem_realloc( ulint n, /* in: desired number of bytes */ char* file_name,/* in: file name where called */ ulint line); /* in: line where called */ +#ifdef MEM_PERIODIC_CHECK +/********************************************************************** +Goes through the list of all allocated mem blocks, checks their magic +numbers, and reports possible corruption. */ +void +mem_validate_all_blocks(void); +/*=========================*/ +#endif /*#######################################################################*/ /* The info header of a block in a memory heap */ struct mem_block_info_struct { + ulint magic_n;/* magic number for debugging */ + char file_name[8];/* file name where the mem heap was created */ + ulint line; /* line number where the mem heap was created */ UT_LIST_BASE_NODE_T(mem_block_t) base; /* In the first block in the the list this is the base node of the list of blocks; in subsequent blocks this is undefined */ @@ -299,9 +310,11 @@ struct mem_block_info_struct { allocated buffer frame, which can be appended as a free block to the heap, if we need more space; otherwise, this is NULL */ - ulint magic_n;/* magic number for debugging */ - char file_name[8];/* file name where the mem heap was created */ - ulint line; /* line number where the mem heap was created */ +#ifdef MEM_PERIODIC_CHECK + UT_LIST_NODE_T(mem_block_t) mem_block_list; + /* List of all mem blocks allocated; protected + by the mem_comm_pool mutex */ +#endif }; #define MEM_BLOCK_MAGIC_N 764741555 diff --git a/innobase/include/mem0pool.h b/innobase/include/mem0pool.h index eb675b4a7f9..43707bd5f61 100644 --- a/innobase/include/mem0pool.h +++ b/innobase/include/mem0pool.h @@ -72,6 +72,18 @@ mem_pool_get_reserved( /* out: reserved mmeory in bytes */ mem_pool_t* pool); /* in: memory pool */ /************************************************************************ +Reserves the mem pool mutex. */ + +void +mem_pool_mutex_enter(void); +/*======================*/ +/************************************************************************ +Releases the mem pool mutex. */ + +void +mem_pool_mutex_exit(void); +/*=====================*/ +/************************************************************************ Validates a memory pool. */ ibool diff --git a/innobase/include/row0mysql.h b/innobase/include/row0mysql.h index 0346299bb10..48b6ba8a715 100644 --- a/innobase/include/row0mysql.h +++ b/innobase/include/row0mysql.h @@ -251,6 +251,24 @@ row_table_add_foreign_constraints( char* name); /* in: table full name in the normalized form database_name/table_name */ /************************************************************************* +The master thread in srv0srv.c calls this regularly to drop tables which +we must drop in background after queries to them have ended. Such lazy +dropping of tables is needed in ALTER TABLE on Unix. */ + +ulint +row_drop_tables_for_mysql_in_background(void); +/*=========================================*/ + /* out: how many tables dropped + + remaining tables in list */ +/************************************************************************* +Get the background drop list length. NOTE: the caller must own the kernel +mutex! */ + +ulint +row_get_background_drop_list_len_low(void); +/*======================================*/ + /* out: how many tables in list */ +/************************************************************************* Drops a table for MySQL. If the name of the dropped table ends to characters INNODB_MONITOR, then this also stops printing of monitor output by the master thread. */ @@ -426,7 +444,7 @@ struct row_prebuilt_struct { fetched row in fetch_cache */ ulint n_fetch_cached; /* number of not yet fetched rows in fetch_cache */ - mem_heap_t* blob_heap; /* in SELECTS BLOB fields are copied + mem_heap_t* blob_heap; /* in SELECTS BLOB fie lds are copied to this heap */ mem_heap_t* old_vers_heap; /* memory heap where a previous version is built in consistent read */ diff --git a/innobase/include/srv0srv.h b/innobase/include/srv0srv.h index 05989c6410e..01986c759d7 100644 --- a/innobase/include/srv0srv.h +++ b/innobase/include/srv0srv.h @@ -249,6 +249,12 @@ mutex, for performace reasons). */ void srv_active_wake_master_thread(void); /*===============================*/ +/*********************************************************************** +Wakes up the master thread if it is suspended or being suspended. */ + +void +srv_wake_master_thread(void); +/*========================*/ /************************************************************************* Puts an OS thread to wait if there are too many concurrent threads (>= srv_thread_concurrency) inside InnoDB. The threads wait in a FIFO queue. */ diff --git a/innobase/include/trx0trx.h b/innobase/include/trx0trx.h index d67628b8bad..26c9ace08b6 100644 --- a/innobase/include/trx0trx.h +++ b/innobase/include/trx0trx.h @@ -50,6 +50,13 @@ trx_allocate_for_mysql(void); /*========================*/ /* out, own: transaction object */ /************************************************************************ +Creates a transaction object for background operations by the master thread. */ + +trx_t* +trx_allocate_for_background(void); +/*=============================*/ + /* out, own: transaction object */ +/************************************************************************ Frees a transaction object. */ void @@ -63,6 +70,13 @@ void trx_free_for_mysql( /*===============*/ trx_t* trx); /* in, own: trx object */ +/************************************************************************ +Frees a transaction object of a background operation of the master thread. */ + +void +trx_free_for_background( +/*====================*/ + trx_t* trx); /* in, own: trx object */ /******************************************************************** Creates trx objects for transactions and initializes the trx list of trx_sys at database start. Rollback segment and undo log lists must @@ -266,11 +280,14 @@ struct trx_sig_struct{ transaction is waiting a reply */ }; +#define TRX_MAGIC_N 91118598 + /* The transaction handle; every session has a trx object which is freed only when the session is freed; in addition there may be session-less transactions rolling back after a database recovery */ struct trx_struct{ + ulint magic_n; /* All the next fields are protected by the kernel mutex, except the undo logs which are protected by undo_mutex */ char* op_info; /* English text describing the diff --git a/innobase/log/log0recv.c b/innobase/log/log0recv.c index 7be172685ae..29e87c7572b 100644 --- a/innobase/log/log0recv.c +++ b/innobase/log/log0recv.c @@ -1020,8 +1020,9 @@ loop: if (recv_addr->state == RECV_NOT_PROCESSED) { if (!has_printed) { + ut_print_timestamp(stderr); fprintf(stderr, -"InnoDB: Starting an apply batch of log records to the database...\n" +" InnoDB: Starting an apply batch of log records to the database...\n" "InnoDB: Progress in percents: "); has_printed = TRUE; } diff --git a/innobase/mem/mem0mem.c b/innobase/mem/mem0mem.c index 3e0a9c008f3..0680968a7eb 100644 --- a/innobase/mem/mem0mem.c +++ b/innobase/mem/mem0mem.c @@ -75,6 +75,14 @@ After freeing, all the blocks in the heap are set to random bytes to help us discover errors which result from the use of buffers in an already freed heap. */ +#ifdef MEM_PERIODIC_CHECK + +ibool mem_block_list_inited; +/* List of all mem blocks allocated; protected by the mem_comm_pool mutex */ +UT_LIST_BASE_NODE_T(mem_block_t) mem_block_list; + +#endif + /******************************************************************* NOTE: Use the corresponding macro instead of this function. Allocates a single buffer of memory from the dynamic memory of @@ -169,7 +177,19 @@ mem_heap_create_block( 7); block->file_name[7]='\0'; block->line = line; + +#ifdef MEM_PERIODIC_CHECK + mem_pool_mutex_enter(); + + if (!mem_block_list_inited) { + mem_block_list_inited = TRUE; + UT_LIST_INIT(mem_block_list); + } + UT_LIST_ADD_LAST(mem_block_list, mem_block_list, block); + + mem_pool_mutex_exit(); +#endif mem_block_set_len(block, len); mem_block_set_type(block, type); mem_block_set_free(block, MEM_BLOCK_HEADER_SIZE); @@ -261,6 +281,13 @@ mem_heap_block_free( UT_LIST_REMOVE(list, heap->base, block); +#ifdef MEM_PERIODIC_CHECK + mem_pool_mutex_enter(); + + UT_LIST_REMOVE(mem_block_list, mem_block_list, block); + + mem_pool_mutex_exit(); +#endif type = heap->type; len = block->len; init_block = block->init_block; @@ -306,3 +333,30 @@ mem_heap_free_block_free( heap->free_block = NULL; } } + +#ifdef MEM_PERIODIC_CHECK +/********************************************************************** +Goes through the list of all allocated mem blocks, checks their magic +numbers, and reports possible corruption. */ + +void +mem_validate_all_blocks(void) +/*=========================*/ +{ + mem_block_t* block; + + mem_pool_mutex_enter(); + + block = UT_LIST_GET_FIRST(mem_block_list); + + while (block) { + if (block->magic_n != MEM_BLOCK_MAGIC_N) { + mem_analyze_corruption((byte*)block); + } + + block = UT_LIST_GET_NEXT(mem_block_list, block); + } + + mem_pool_mutex_exit(); +} +#endif diff --git a/innobase/mem/mem0pool.c b/innobase/mem/mem0pool.c index 48e7e686953..3681c8ef779 100644 --- a/innobase/mem/mem0pool.c +++ b/innobase/mem/mem0pool.c @@ -78,9 +78,9 @@ pool, and after that its locks will grow into the buffer pool. */ /* The smallest memory area total size */ #define MEM_AREA_MIN_SIZE (2 * MEM_AREA_EXTRA_SIZE) + /* Data structure for a memory pool. The space is allocated using the buddy algorithm, where free list i contains areas of size 2 to power i. */ - struct mem_pool_struct{ byte* buf; /* memory pool */ ulint size; /* memory common pool size */ @@ -98,6 +98,26 @@ mem_pool_t* mem_comm_pool = NULL; ulint mem_out_of_mem_err_msg_count = 0; +/************************************************************************ +Reserves the mem pool mutex. */ + +void +mem_pool_mutex_enter(void) +/*======================*/ +{ + mutex_enter(&(mem_comm_pool->mutex)); +} + +/************************************************************************ +Releases the mem pool mutex. */ + +void +mem_pool_mutex_exit(void) +/*=====================*/ +{ + mutex_exit(&(mem_comm_pool->mutex)); +} + /************************************************************************ Returns memory area size. */ UNIV_INLINE @@ -240,15 +260,15 @@ mem_pool_fill_free_list( if (mem_out_of_mem_err_msg_count % 1000000000 == 0) { /* We do not print the message every time: */ + + ut_print_timestamp(stderr); fprintf(stderr, - "Innobase: Warning: out of memory in additional memory pool.\n"); - fprintf(stderr, - "Innobase: Innobase will start allocating memory from the OS.\n"); - fprintf(stderr, - "Innobase: You should restart the database with a bigger value in\n"); - fprintf(stderr, - "Innobase: the MySQL .cnf file for innobase_additional_mem_pool_size.\n"); + " InnoDB: Out of memory in additional memory pool.\n" + "InnoDB: InnoDB will start allocating memory from the OS.\n" + "InnoDB: You may get better performance if you configure a bigger\n" + "InnoDB: value in the MySQL my.cnf file for\n" + "InnoDB: innodb_additional_mem_pool_size.\n"); } mem_out_of_mem_err_msg_count++; diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index c0f527017e0..7b036ca4e00 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -26,6 +26,19 @@ Created 9/17/2000 Heikki Tuuri #include "trx0purge.h" #include "lock0lock.h" #include "rem0cmp.h" +#include "log0log.h" + +/* List of tables we should drop in background. ALTER TABLE in MySQL requires +that the table handler can drop the table in background when there are no +queries to it any more. Protected by the kernel mutex. */ +typedef struct row_mysql_drop_struct row_mysql_drop_t; +struct row_mysql_drop_struct{ + char* table_name; + UT_LIST_NODE_T(row_mysql_drop_t) row_mysql_drop_list; +}; + +UT_LIST_BASE_NODE_T(row_mysql_drop_t) row_mysql_drop_list; +ibool row_mysql_drop_list_inited = FALSE; /*********************************************************************** Reads a MySQL format variable-length field (like VARCHAR) length and @@ -172,10 +185,22 @@ handle_new_error: trx_general_rollback_for_mysql(trx, TRUE, savept); } } else if (err == DB_TOO_BIG_RECORD) { + if (savept) { + /* Roll back the latest, possibly incomplete + insertion or update */ + + trx_general_rollback_for_mysql(trx, TRUE, savept); + } /* MySQL will roll back the latest SQL statement */ } else if (err == DB_ROW_IS_REFERENCED || err == DB_NO_REFERENCED_ROW || err == DB_CANNOT_ADD_CONSTRAINT) { + if (savept) { + /* Roll back the latest, possibly incomplete + insertion or update */ + + trx_general_rollback_for_mysql(trx, TRUE, savept); + } /* MySQL will roll back the latest SQL statement */ } else if (err == DB_LOCK_WAIT) { @@ -200,6 +225,12 @@ handle_new_error: trx_general_rollback_for_mysql(trx, FALSE, NULL); } else if (err == DB_OUT_OF_FILE_SPACE) { + if (savept) { + /* Roll back the latest, possibly incomplete + insertion or update */ + + trx_general_rollback_for_mysql(trx, TRUE, savept); + } /* MySQL will roll back the latest SQL statement */ } else if (err == DB_MUST_GET_MORE_FILE_SPACE) { @@ -375,13 +406,13 @@ row_update_prebuilt_trx( handle */ trx_t* trx) /* in: transaction handle */ { - if (prebuilt->magic_n != ROW_PREBUILT_ALLOCATED) { + if (trx->magic_n != TRX_MAGIC_N) { fprintf(stderr, - "InnoDB: Error: trying to free a corrupt\n" - "InnoDB: table handle. Magic n %lu, table name %s\n", - prebuilt->magic_n, prebuilt->table->name); + "InnoDB: Error: trying to use a corrupt\n" + "InnoDB: trx handle. Magic n %lu\n", + trx->magic_n); - mem_analyze_corruption((byte*)prebuilt); + mem_analyze_corruption((byte*)trx); ut_a(0); } @@ -1170,8 +1201,11 @@ row_create_table_for_mysql( row_drop_table_for_mysql(table->name, trx, TRUE); } else { ut_a(err == DB_DUPLICATE_KEY); + + ut_print_timestamp(stderr); + fprintf(stderr, - "InnoDB: Error: table %s already exists in InnoDB internal\n" + " InnoDB: Error: table %s already exists in InnoDB internal\n" "InnoDB: data dictionary. Have you deleted the .frm file\n" "InnoDB: and not used DROP TABLE? Have you used DROP DATABASE\n" "InnoDB: for InnoDB tables in MySQL version <= 3.23.43?\n" @@ -1349,6 +1383,164 @@ row_table_add_foreign_constraints( return((int) err); } +/************************************************************************* +Drops a table for MySQL as a background operation. MySQL relies on Unix +in ALTER TABLE to the fact that the table handler does not remove the +table before all handles to it has been removed. Furhermore, the MySQL's +call to drop table must be non-blocking. Therefore we do the drop table +as a background operation, which is taken care of by the master thread +in srv0srv.c. */ +static +int +row_drop_table_for_mysql_in_background( +/*===================================*/ + /* out: error code or DB_SUCCESS */ + char* name) /* in: table name */ +{ + ulint error; + trx_t* trx; + + trx = trx_allocate_for_background(); + +/* fprintf(stderr, "InnoDB: Dropping table %s in background drop list\n", + name); */ + /* Drop the table in InnoDB */ + + error = row_drop_table_for_mysql(name, trx, FALSE); + + if (error != DB_SUCCESS) { + fprintf(stderr, + "InnoDB: Error: Dropping table %s in background drop list failed\n", + name); + } + + /* Flush the log to reduce probability that the .frm files and + the InnoDB data dictionary get out-of-sync if the user runs + with innodb_flush_log_at_trx_commit = 0 */ + + log_flush_up_to(ut_dulint_max, LOG_WAIT_ONE_GROUP); + + trx_commit_for_mysql(trx); + + trx_free_for_background(trx); + + return(DB_SUCCESS); +} + +/************************************************************************* +The master thread in srv0srv.c calls this regularly to drop tables which +we must drop in background after queries to them have ended. Such lazy +dropping of tables is needed in ALTER TABLE on Unix. */ + +ulint +row_drop_tables_for_mysql_in_background(void) +/*=========================================*/ + /* out: how many tables dropped + + remaining tables in list */ +{ + row_mysql_drop_t* drop; + dict_table_t* table; + ulint n_tables; + ulint n_tables_dropped = 0; +loop: + mutex_enter(&kernel_mutex); + + if (!row_mysql_drop_list_inited) { + + UT_LIST_INIT(row_mysql_drop_list); + row_mysql_drop_list_inited = TRUE; + } + + drop = UT_LIST_GET_FIRST(row_mysql_drop_list); + + n_tables = UT_LIST_GET_LEN(row_mysql_drop_list); + + mutex_exit(&kernel_mutex); + + if (drop == NULL) { + + return(n_tables + n_tables_dropped); + } + + mutex_enter(&(dict_sys->mutex)); + table = dict_table_get_low(drop->table_name); + mutex_exit(&(dict_sys->mutex)); + + if (table->n_mysql_handles_opened > 0) { + + return(n_tables + n_tables_dropped); + } + + n_tables_dropped++; + + row_drop_table_for_mysql_in_background(drop->table_name); + + mutex_enter(&kernel_mutex); + + UT_LIST_REMOVE(row_mysql_drop_list, row_mysql_drop_list, drop); + + mem_free(drop->table_name); + + mem_free(drop); + + mutex_exit(&kernel_mutex); + + goto loop; +} + +/************************************************************************* +Get the background drop list length. NOTE: the caller must own the kernel +mutex! */ + +ulint +row_get_background_drop_list_len_low(void) +/*======================================*/ + /* out: how many tables in list */ +{ + ut_ad(mutex_own(&kernel_mutex)); + + if (!row_mysql_drop_list_inited) { + + UT_LIST_INIT(row_mysql_drop_list); + row_mysql_drop_list_inited = TRUE; + } + + return(UT_LIST_GET_LEN(row_mysql_drop_list)); +} + +/************************************************************************* +Adds a table to the list of tables which the master thread drops in +background. We need this on Unix because in ALTER TABLE MySQL may call +drop table even if the table has running queries on it. */ +static +void +row_add_table_to_background_drop_list( +/*==================================*/ + dict_table_t* table) /* in: table */ +{ + row_mysql_drop_t* drop; + + drop = mem_alloc(sizeof(row_mysql_drop_t)); + + drop->table_name = mem_alloc(1 + ut_strlen(table->name)); + + ut_memcpy(drop->table_name, table->name, 1 + ut_strlen(table->name)); + + mutex_enter(&kernel_mutex); + + if (!row_mysql_drop_list_inited) { + + UT_LIST_INIT(row_mysql_drop_list); + row_mysql_drop_list_inited = TRUE; + } + + UT_LIST_ADD_LAST(row_mysql_drop_list, row_mysql_drop_list, drop); + +/* fprintf(stderr, "InnoDB: Adding table %s to background drop list\n", + drop->table_name); */ + mutex_exit(&kernel_mutex); +} + /************************************************************************* Drops a table for MySQL. If the name of the dropped table ends to characters INNODB_MONITOR, then this also stops printing of monitor @@ -1536,9 +1728,10 @@ row_drop_table_for_mysql( if (!table) { err = DB_TABLE_NOT_FOUND; + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Error: table %s does not exist in the InnoDB internal\n" + " InnoDB: Error: table %s does not exist in the InnoDB internal\n" "InnoDB: data dictionary though MySQL is trying to drop it.\n" "InnoDB: Have you copied the .frm file of the table to the\n" "InnoDB: MySQL database directory from another database?\n", @@ -1546,41 +1739,18 @@ row_drop_table_for_mysql( goto funct_exit; } + if (table->n_mysql_handles_opened > 0) { + + row_add_table_to_background_drop_list(table); + + err = DB_SUCCESS; + + goto funct_exit; + } + /* Remove any locks there are on the table or its records */ lock_reset_all_on_table(table); -loop: - if (table->n_mysql_handles_opened > 0) { - rw_lock_s_unlock(&(purge_sys->purge_is_running)); - - rw_lock_x_unlock(&(dict_foreign_key_check_lock)); - - mutex_exit(&(dict_sys->mutex)); - - if (rounds > 60) { - fprintf(stderr, - "InnoDB: waiting for queries to table %s to end before dropping it\n", - name); - } - - os_thread_sleep(1000000); - - mutex_enter(&(dict_sys->mutex)); - - rw_lock_x_lock(&(dict_foreign_key_check_lock)); - - rw_lock_s_lock(&(purge_sys->purge_is_running)); - - rounds++; - - if (rounds > 120) { - fprintf(stderr, -"InnoDB: Warning: queries to table %s have not ended but we continue anyway\n", - name); - } else { - goto loop; - } - } trx->dict_operation = TRUE; trx->table_id = table->id; @@ -1617,6 +1787,8 @@ funct_exit: trx->op_info = ""; + srv_wake_master_thread(); + return((int) err); } @@ -1788,7 +1960,31 @@ row_rename_table_for_mysql( err = trx->error_state; if (err != DB_SUCCESS) { - row_mysql_handle_errors(&err, trx, thr, NULL); + if (err == DB_DUPLICATE_KEY) { + ut_print_timestamp(stderr); + + fprintf(stderr, + " InnoDB: Error: table %s exists in the InnoDB internal data\n" + "InnoDB: dictionary though MySQL is trying rename table %s to it.\n" + "InnoDB: Have you deleted the .frm file and not used DROP TABLE?\n", + new_name, old_name); + + fprintf(stderr, + "InnoDB: If table %s is a temporary table #sql..., then it can be that\n" + "InnoDB: there are still queries running on the table, and it will be\n" + "InnoDB: dropped automatically when the queries end.\n", new_name); + + fprintf(stderr, + "InnoDB: You can drop the orphaned table inside InnoDB by\n" + "InnoDB: creating an InnoDB table with the same name in another\n" + "InnoDB: database and moving the .frm file to the current database.\n" + "InnoDB: Then MySQL thinks the table exists, and DROP TABLE will\n" + "InnoDB: succeed.\n"); + } + + trx->error_state = DB_SUCCESS; + trx_general_rollback_for_mysql(trx, FALSE, NULL); + trx->error_state = DB_SUCCESS; } else { ut_a(dict_table_rename_in_cache(table, new_name)); } @@ -1945,7 +2141,7 @@ row_check_table_for_mysql( ulint ret = DB_SUCCESS; prebuilt->trx->op_info = "checking table"; - + index = dict_table_get_first_index(table); while (index != NULL) { diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index d75783fe425..77e3ee03a21 100644 --- a/innobase/srv/srv0srv.c +++ b/innobase/srv/srv0srv.c @@ -20,7 +20,7 @@ Windows 2000 will have something called thread pooling Another possibility could be to use some very fast user space thread library. This might confuse NT though. -(c) 1995 InnoDB Oy +(c) 1995 Innobase Oy Created 10/8/1995 Heikki Tuuri *******************************************************/ @@ -49,6 +49,7 @@ Created 10/8/1995 Heikki Tuuri #include "btr0sea.h" #include "dict0load.h" #include "srv0start.h" +#include "row0mysql.h" /* Buffer which can be used in printing fatal error messages */ char srv_fatal_errbuf[5000]; @@ -1911,17 +1912,12 @@ srv_boot(void) srv_init(); - /* Reserve the first slot for the current thread, i.e., the master - thread */ - - srv_table_reserve_slot(SRV_MASTER); - return(DB_SUCCESS); } /************************************************************************* Reserves a slot in the thread table for the current MySQL OS thread. -NOTE! The server mutex has to be reserved by the caller! */ +NOTE! The kernel mutex has to be reserved by the caller! */ static srv_slot_t* srv_table_reserve_slot_for_mysql(void) @@ -1931,6 +1927,8 @@ srv_table_reserve_slot_for_mysql(void) srv_slot_t* slot; ulint i; + ut_ad(mutex_own(&kernel_mutex)); + i = 0; slot = srv_mysql_table + i; @@ -2352,6 +2350,22 @@ srv_active_wake_master_thread(void) } } +/*********************************************************************** +Wakes up the master thread if it is suspended or being suspended. */ + +void +srv_wake_master_thread(void) +/*========================*/ +{ + srv_activity_count++; + + mutex_enter(&kernel_mutex); + + srv_release_threads(SRV_MASTER, 1); + + mutex_exit(&kernel_mutex); +} + /************************************************************************* The master thread controlling the server. */ @@ -2374,6 +2388,7 @@ srv_master_thread( ulint n_bytes_merged; ulint n_pages_flushed; ulint n_bytes_archived; + ulint n_tables_to_drop; ulint n_ios; ulint n_ios_old; ulint n_ios_very_old; @@ -2415,7 +2430,11 @@ loop: can drop tables lazily after there no longer are SELECT queries to them. */ -/* row_drop_tables_for_mysql_in_background(); */ + srv_main_thread_op_info = "doing background drop tables"; + + row_drop_tables_for_mysql_in_background(); + + srv_main_thread_op_info = ""; if (srv_force_recovery >= SRV_FORCE_NO_BACKGROUND) { @@ -2465,6 +2484,11 @@ loop: printf("Master thread wakes up!\n"); } +#ifdef MEM_PERIODIC_CHECK + /* Check magic numbers of every allocated mem block once in 10 + seconds */ + mem_validate_all_blocks(); +#endif /* If there were less than 200 i/os during the 10 second period, we assume that there is free disk i/o capacity available, and it makes sense to do a buffer pool flush. */ @@ -2521,6 +2545,12 @@ background_loop: /* In this loop we run background operations when the server is quiet and we also come here about once in 10 seconds */ + srv_main_thread_op_info = "doing background drop tables"; + + n_tables_to_drop = row_drop_tables_for_mysql_in_background(); + + srv_main_thread_op_info = ""; + srv_main_thread_op_info = "flushing buffer pool pages"; /* Flush a few oldest pages to make the checkpoint younger */ @@ -2604,11 +2634,13 @@ background_loop: log_archive_do(FALSE, &n_bytes_archived); if (srv_fast_shutdown && srv_shutdown_state > 0) { - if (n_pages_flushed + n_bytes_archived != 0) { + if (n_tables_to_drop + n_pages_flushed + + n_bytes_archived != 0) { goto background_loop; } - } else if (n_pages_purged + n_bytes_merged + n_pages_flushed + } else if (n_tables_to_drop + + n_pages_purged + n_bytes_merged + n_pages_flushed + n_bytes_archived != 0) { goto background_loop; } @@ -2627,6 +2659,12 @@ suspend_thread: mutex_enter(&kernel_mutex); + if (row_get_background_drop_list_len_low() > 0) { + mutex_exit(&kernel_mutex); + + goto loop; + } + event = srv_suspend_thread(); mutex_exit(&kernel_mutex); diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c index 93e1addd3c3..f9a13944bb5 100644 --- a/innobase/srv/srv0start.c +++ b/innobase/srv/srv0start.c @@ -270,13 +270,18 @@ open_or_create_log_file( } else { *log_file_created = TRUE; + ut_print_timestamp(stderr); + fprintf(stderr, - "InnoDB: Log file %s did not exist: new to be created\n", + " InnoDB: Log file %s did not exist: new to be created\n", name); fprintf(stderr, "InnoDB: Setting log file %s size to %lu MB\n", name, srv_log_file_size >> (20 - UNIV_PAGE_SIZE_SHIFT)); + fprintf(stderr, + "InnoDB: Database physically writes the file full: wait...\n"); + ret = os_file_set_size(name, files[i], srv_calc_low32(srv_log_file_size), srv_calc_high32(srv_log_file_size)); @@ -454,8 +459,9 @@ open_or_create_data_files( one_created = TRUE; if (i > 0) { + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Data file %s did not exist: new to be created\n", + " InnoDB: Data file %s did not exist: new to be created\n", name); } else { fprintf(stderr, @@ -464,8 +470,9 @@ open_or_create_data_files( *create_new_db = TRUE; } + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Setting file %s size to %lu MB\n", + " InnoDB: Setting file %s size to %lu MB\n", name, (srv_data_file_sizes[i] >> (20 - UNIV_PAGE_SIZE_SHIFT))); @@ -905,6 +912,12 @@ innobase_start_or_create_for_mysql(void) mtr_commit(&mtr); } + if (recv_needed_recovery) { + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Flushing modified pages from the buffer pool...\n"); + } + log_make_checkpoint_at(ut_dulint_max, TRUE); if (!srv_log_archive_on) { @@ -983,9 +996,8 @@ innobase_shutdown_for_mysql(void) ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Warning: shutting down a not properly started\n"); - ut_print_timestamp(stderr); fprintf(stderr, - " InnoDB: or created database!\n"); + " InnoDB: or created database!\n"); } return(DB_SUCCESS); diff --git a/innobase/trx/trx0purge.c b/innobase/trx/trx0purge.c index a91ac135f81..b73629c9fa4 100644 --- a/innobase/trx/trx0purge.c +++ b/innobase/trx/trx0purge.c @@ -226,9 +226,9 @@ trx_purge_sys_create(void) value */ purge_sys->sess = sess_open(com_endpoint, (byte*)"purge_system", 13); - purge_sys->trx = (purge_sys->sess)->trx; + purge_sys->trx = purge_sys->sess->trx; - (purge_sys->trx)->type = TRX_PURGE; + purge_sys->trx->type = TRX_PURGE; ut_a(trx_start_low(purge_sys->trx, ULINT_UNDEFINED)); diff --git a/innobase/trx/trx0trx.c b/innobase/trx/trx0trx.c index 43cca5b62b3..6cbf97104b3 100644 --- a/innobase/trx/trx0trx.c +++ b/innobase/trx/trx0trx.c @@ -26,9 +26,9 @@ Created 3/26/1996 Heikki Tuuri /* Copy of the prototype for innobase_mysql_print_thd: this - copy must be equal to the one in mysql/sql/ha_innobase.cc ! */ -void innobase_mysql_print_thd(void* thd); +copy must be equal to the one in mysql/sql/ha_innobase.cc ! */ +void innobase_mysql_print_thd(void* thd); /* Dummy session used currently in MySQL interface */ sess_t* trx_dummy_sess = NULL; @@ -64,6 +64,8 @@ trx_create( trx = mem_alloc(sizeof(trx_t)); + trx->magic_n = TRX_MAGIC_N; + trx->op_info = ""; trx->type = TRX_USER; @@ -157,6 +159,32 @@ trx_allocate_for_mysql(void) return(trx); } +/************************************************************************ +Creates a transaction object for background operations by the master thread. */ + +trx_t* +trx_allocate_for_background(void) +/*=============================*/ + /* out, own: transaction object */ +{ + trx_t* trx; + + mutex_enter(&kernel_mutex); + + /* Open a dummy session */ + + if (!trx_dummy_sess) { + trx_dummy_sess = sess_open(NULL, (byte*)"Dummy sess", + ut_strlen("Dummy sess")); + } + + trx = trx_create(trx_dummy_sess); + + mutex_exit(&kernel_mutex); + + return(trx); +} + /************************************************************************ Releases the search latch if trx has reserved it. */ @@ -181,6 +209,11 @@ trx_free( trx_t* trx) /* in, own: trx object */ { ut_ad(mutex_own(&kernel_mutex)); + + ut_a(trx->magic_n == TRX_MAGIC_N); + + trx->magic_n = 11112222; + ut_a(trx->conc_state == TRX_NOT_STARTED); mutex_free(&(trx->undo_mutex)); @@ -242,6 +275,21 @@ trx_free_for_mysql( mutex_exit(&kernel_mutex); } +/************************************************************************ +Frees a transaction object of a background operation of the master thread. */ + +void +trx_free_for_background( +/*====================*/ + trx_t* trx) /* in, own: trx object */ +{ + mutex_enter(&kernel_mutex); + + trx_free(trx); + + mutex_exit(&kernel_mutex); +} + /******************************************************************** Inserts the trx handle in the trx system trx list in the right position. The list is sorted on the trx id so that the biggest id is at the list diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index 88c7e10e94c..106704d5b75 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -16,7 +16,7 @@ /* This file defines the InnoDB handler: the interface between MySQL and InnoDB */ - + /* TODO list for the InnoDB handler: - Ask Monty if strings of different languages can exist in the same database. Answer: in near future yes, but not yet. @@ -229,7 +229,7 @@ convert_error_code_to_mysql( extern "C" { /***************************************************************** Prints info of a THD object (== user session thread) to the -standatd output. NOTE that mysql/innobase/trx/trx0trx.c must contain +standard output. NOTE that mysql/innobase/trx/trx0trx.c must contain the prototype for this function! */ void @@ -298,6 +298,8 @@ check_trx_exists( thd->transaction.stmt.innobase_tid = (void*)&innodb_dummy_stmt_trx_handle; + } else { + ut_a(trx->magic_n == TRX_MAGIC_N); } return(trx); @@ -835,6 +837,7 @@ innobase_close_connection( whose transaction should be rolled back */ { if (NULL != thd->transaction.all.innobase_tid) { + trx_rollback_for_mysql((trx_t*) (thd->transaction.all.innobase_tid)); trx_free_for_mysql((trx_t*) @@ -2435,44 +2438,6 @@ ha_innobase::position( ref_stored_len = len; } -/*********************************************************************** -Tells something additional to the handler about how to do things. */ - -int -ha_innobase::extra( -/*===============*/ - /* out: 0 or error number */ - enum ha_extra_function operation) - /* in: HA_EXTRA_DONT_USE_CURSOR_TO_UPDATE */ -{ - row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; - - switch (operation) { - case HA_EXTRA_RESET: - case HA_EXTRA_RESET_STATE: - prebuilt->read_just_key = 0; - break; - case HA_EXTRA_NO_KEYREAD: - prebuilt->read_just_key = 0; - break; - case HA_EXTRA_DONT_USE_CURSOR_TO_UPDATE: - prebuilt->in_update_remember_pos = FALSE; - break; - case HA_EXTRA_KEYREAD: - prebuilt->read_just_key = 1; - break; - default:/* Do nothing */ - ; - } - - return(0); -} - -int ha_innobase::reset(void) -{ - return(0); -} - /********************************************************************* Creates a table definition to an InnoDB database. */ static @@ -2952,6 +2917,10 @@ ha_innobase::records_in_range( void* heap2; DBUG_ENTER("records_in_range"); + + /* Warning: since it is not sure that MySQL calls external_lock + before calling this function, the trx field in prebuilt can be + obsolete! */ active_index = keynr; @@ -2984,6 +2953,10 @@ ha_innobase::records_in_range( dtuple_free_for_mysql(heap2); my_free((char*) key_val_buff2, MYF(0)); + + if (prebuilt->trx) { + prebuilt->trx->op_info = ""; + } DBUG_RETURN((ha_rows) n_rows); } @@ -3005,6 +2978,10 @@ ha_innobase::estimate_number_of_rows(void) ulonglong estimate; ulonglong data_file_length; + /* Warning: since it is not sure that MySQL calls external_lock + before calling this function, the trx field in prebuilt can be + obsolete! */ + DBUG_ENTER("info"); index = dict_table_get_first_index_noninline(prebuilt->table); @@ -3035,10 +3012,12 @@ ha_innobase::scan_time() { row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; - /* In the following formula we assume that scanning 10 pages - takes the same time as a disk seek: */ - - return((double) (prebuilt->table->stat_clustered_index_size / 10)); + /* Since MySQL seems to favor table scans too much over index + searches, we pretend that a sequential read takes the same time + as a random disk read, that is, we do not divide the following + by 10, which would be physically realistic. */ + + return((double) (prebuilt->table->stat_clustered_index_size)); } /************************************************************************* @@ -3058,7 +3037,11 @@ ha_innobase::info( ulong i; DBUG_ENTER("info"); - + + /* Warning: since it is not sure that MySQL calls external_lock + before calling this function, the trx field in prebuilt can be + obsolete! */ + ib_table = prebuilt->table; if (flag & HA_STATUS_TIME) { @@ -3105,6 +3088,13 @@ ha_innobase::info( index->stat_n_diff_key_vals[j + 1]); } + /* Since MySQL seems to favor table scans + too much over index searches, we pretend + index selectivity is 2 times better than + our estimate: */ + + rec_per_key = rec_per_key / 2; + if (rec_per_key == 0) { rec_per_key = 1; } @@ -3124,11 +3114,13 @@ ha_innobase::info( pointer and cause a seg fault. */ if (flag & HA_STATUS_ERRKEY) { + ut_a(prebuilt->trx && prebuilt->trx->magic_n == TRX_MAGIC_N); + errkey = (unsigned int) row_get_mysql_key_number_for_index( (dict_index_t*) trx_get_error_info(prebuilt->trx)); } - + DBUG_VOID_RETURN; } @@ -3148,7 +3140,9 @@ ha_innobase::check( { row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; ulint ret; - + + ut_a(prebuilt->trx && prebuilt->trx->magic_n == TRX_MAGIC_N); + if (prebuilt->mysql_template == NULL) { /* Build the template; we will use a dummy template in index scans done in checking */ @@ -3182,6 +3176,10 @@ ha_innobase::update_table_comment( char* str = my_malloc(length + 550, MYF(0)); char* pos; + /* Warning: since it is not sure that MySQL calls external_lock + before calling this function, the trx field in prebuilt can be + obsolete! */ + if (!str) { return((char*)comment); } @@ -3203,6 +3201,53 @@ ha_innobase::update_table_comment( return(str); } +/*********************************************************************** +Tells something additional to the handler about how to do things. */ + +int +ha_innobase::extra( +/*===============*/ + /* out: 0 or error number */ + enum ha_extra_function operation) + /* in: HA_EXTRA_DONT_USE_CURSOR_TO_UPDATE */ +{ + row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; + + /* Warning: since it is not sure that MySQL calls external_lock + before calling this function, the trx field in prebuilt can be + obsolete! */ + + switch (operation) { + case HA_EXTRA_RESET: + case HA_EXTRA_RESET_STATE: + prebuilt->read_just_key = 0; + break; + case HA_EXTRA_NO_KEYREAD: + prebuilt->read_just_key = 0; + break; + case HA_EXTRA_DONT_USE_CURSOR_TO_UPDATE: + prebuilt->in_update_remember_pos = FALSE; + break; + case HA_EXTRA_KEYREAD: + prebuilt->read_just_key = 1; + break; + default:/* Do nothing */ + ; + } + + return(0); +} + +/********************************************************************** +????????????? */ + +int +ha_innobase::reset(void) +/*====================*/ +{ + return(0); +} + /********************************************************************** As MySQL will execute an external lock for every new table it uses when it starts to process an SQL statement, we can use this function to store the @@ -3427,5 +3472,4 @@ ha_innobase::get_auto_increment() return(nr); } - #endif /* HAVE_INNOBASE_DB */ From 70634523d4c5e4b7c236ed61c48d4539bf825954 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 5 Feb 2002 00:16:38 +0200 Subject: [PATCH 04/17] ha_innobase.cc: Remove use of prebuilt->trx, better play safe since we do not know MySQL call order of external_lock sql/ha_innobase.cc: Remove use of prebuilt->trx, better play safe since we do not know MySQL call order of external_lock --- sql/ha_innobase.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index 106704d5b75..d9fb7d3eb2e 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -2954,9 +2954,6 @@ ha_innobase::records_in_range( my_free((char*) key_val_buff2, MYF(0)); - if (prebuilt->trx) { - prebuilt->trx->op_info = ""; - } DBUG_RETURN((ha_rows) n_rows); } From 9a052e273ff4404528ab0bc75b16fce7f199d0a7 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 7 Feb 2002 12:05:02 +0200 Subject: [PATCH 05/17] rem0cmp.c: Prevent a foreign key constraint references between INT columns where the signedness is different innobase/rem/rem0cmp.c: Prevent a foreign key constraint references between INT columns where the signedness is different --- innobase/rem/rem0cmp.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/innobase/rem/rem0cmp.c b/innobase/rem/rem0cmp.c index 363bb013ac9..60828b122ba 100644 --- a/innobase/rem/rem0cmp.c +++ b/innobase/rem/rem0cmp.c @@ -113,6 +113,16 @@ cmp_types_are_equal( return(FALSE); } + if (type1->mtype == DATA_INT + && (type1->prtype & DATA_UNSIGNED) + != (type2->prtype & DATA_UNSIGNED)) { + /* The storage format of an unsigned integer is different + from a signed integer: in a signed integer we OR + 0x8000... to the value of positive integers. */ + + return(FALSE); + } + if (type1->mtype == DATA_MYSQL || type1->mtype == DATA_VARMYSQL) { From 3942e44524777ead3d8c5dd314fd0b7bc3e13f32 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 7 Feb 2002 21:34:35 +0200 Subject: [PATCH 06/17] Update to autoconf 2.52 Fix of InnoDB variables in SHOW VARIABLES Fix for ALTER TABLE and InnoDB BUILD/FINISH.sh: Update to autoconf 2.52 BUILD/SETUP.sh: Update to autoconf 2.52 BUILD/compile-alpha: Update to autoconf 2.52 BUILD/compile-pentium-gcov: Update to autoconf 2.52 BUILD/compile-pentium-gprof: Update to autoconf 2.52 BUILD/compile-pentium: Update to autoconf 2.52 Docs/manual.texi: Changelog acconfig.h: Update to autoconf 2.52 acinclude.m4: Update to autoconf 2.52 bdb/dist/configure.in: Update to autoconf 2.52 client/Makefile.am: Update to autoconf 2.52 configure.in: Update to autoconf 2.52 mysql-test/r/innodb.result: Update of InnoDB Cardinality values mysys/Makefile.am: Update to autoconf 2.52 scripts/Makefile.am: Update to autoconf 2.52 sql/ha_innobase.cc: Fix of InnoDB variables in SHOW VARIABLES sql/ha_innobase.h: Fix of InnoDB variables in SHOW VARIABLES sql/sql_table.cc: Fix for ALTER TABLE and InnoDB support-files/my-huge.cnf.sh: Fixed typo support-files/my-large.cnf.sh: Fixed typo support-files/my-medium.cnf.sh: Fixed typo support-files/my-small.cnf.sh: Fixed typo --- BUILD/FINISH.sh | 5 +- BUILD/SETUP.sh | 7 ++- BUILD/compile-alpha | 2 +- BUILD/compile-pentium | 4 +- BUILD/compile-pentium-gcov | 2 +- BUILD/compile-pentium-gprof | 2 +- Docs/manual.texi | 11 ++++ acconfig.h | 9 +++ acinclude.m4 | 99 ++++++++++++++++--------------- bdb/dist/configure.in | 104 +++++++++++++++++---------------- client/Makefile.am | 1 + configure.in | 83 +++++++++++++++++--------- mysql-test/r/innodb.result | 10 ++-- mysys/Makefile.am | 3 +- mysys/my_new.cc | 49 ++++++++++++++++ scripts/Makefile.am | 2 +- sql/ha_innobase.cc | 2 +- sql/ha_innobase.h | 5 +- sql/sql_table.cc | 35 ++++++----- support-files/my-huge.cnf.sh | 2 +- support-files/my-large.cnf.sh | 2 +- support-files/my-medium.cnf.sh | 2 +- support-files/my-small.cnf.sh | 2 +- 23 files changed, 278 insertions(+), 165 deletions(-) create mode 100644 mysys/my_new.cc diff --git a/BUILD/FINISH.sh b/BUILD/FINISH.sh index c7cd43fa64e..fbeaf1e3c68 100644 --- a/BUILD/FINISH.sh +++ b/BUILD/FINISH.sh @@ -10,7 +10,7 @@ done commands="\ $make -k clean || true -/bin/rm -f */.deps/*.P config.cache +/bin/rm -f */.deps/*.P config.cache innobase/config.cache bdb/build_unix/config.cache aclocal && autoheader && aclocal && automake && autoconf (cd bdb/dist && sh s_all) @@ -20,7 +20,8 @@ then (cd gemini && aclocal && autoheader && aclocal && automake && autoconf) fi -CFLAGS=\"$cflags\" CXX=$CXX CXXFLAGS=\"$cxxflags\" $configure" +CFLAGS=\"$cflags\" CXX=\"$CXX\" CXXFLAGS=\"$cxxflags\" CXXLDFLAGS=\"$CXXLDFLAGS\" \ +$configure" if [ -z "$just_configure" ] then diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index 0f2334dd573..a69cdcb14fd 100644 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -52,7 +52,8 @@ debug_cflags="-DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -DSAFEMALLOC -DSAFE_MUTEX -O1" base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti" -base_configs="--prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-mysqld-ldflags=-all-static" +base_configs="--prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client" +static_link="--with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static" alpha_configs="" # Not used yet pentium_configs="" sparc_configs="" @@ -68,7 +69,9 @@ fi if gcc -v 2>&1 | grep 'version 3' > /dev/null 2>&1 then - CXX=c++ + CXX="gcc -DUSE_MYSYS_NEW" + CXXLDFLAGS="-Wl,--defsym -Wl,__cxa_pure_virtual=0" else CXX=gcc + CXXLDFLAGS="" fi diff --git a/BUILD/compile-alpha b/BUILD/compile-alpha index 10b9d67e1c1..ce5050fee72 100755 --- a/BUILD/compile-alpha +++ b/BUILD/compile-alpha @@ -4,6 +4,6 @@ path=`dirname $0` . "$path/SETUP.sh" extra_flags="$alpha_cflags $fast_cflags" -extra_configs="$alpha_configs" +extra_configs="$alpha_configs $static_link" . "$path/FINISH.sh" diff --git a/BUILD/compile-pentium b/BUILD/compile-pentium index 11559be93de..b8f8d028e1f 100755 --- a/BUILD/compile-pentium +++ b/BUILD/compile-pentium @@ -4,9 +4,7 @@ path=`dirname $0` . "$path/SETUP.sh" extra_flags="$pentium_cflags $fast_cflags" -extra_configs="$pentium_configs" +extra_configs="$pentium_configs $static_link" strip=yes -extra_configs="$extra_configs" - . "$path/FINISH.sh" diff --git a/BUILD/compile-pentium-gcov b/BUILD/compile-pentium-gcov index 6b5c432e999..873d1d0d8e8 100755 --- a/BUILD/compile-pentium-gcov +++ b/BUILD/compile-pentium-gcov @@ -4,6 +4,6 @@ path=`dirname $0` . "$path/SETUP.sh" extra_flags="$pentium_cflags -O2 -fprofile-arcs -ftest-coverage" -extra_configs="$pentium_configs $debug_configs --disable-shared" +extra_configs="$pentium_configs $debug_configs --disable-shared $static_link" . "$path/FINISH.sh" diff --git a/BUILD/compile-pentium-gprof b/BUILD/compile-pentium-gprof index 02b595d1015..aa74de0b1b2 100755 --- a/BUILD/compile-pentium-gprof +++ b/BUILD/compile-pentium-gprof @@ -4,6 +4,6 @@ path=`dirname $0` . "$path/SETUP.sh" extra_flags="$pentium_cflags -O2 -pg -g" -extra_configs="$pentium_configs $debug_configs --disable-shared" +extra_configs="$pentium_configs $debug_configs --disable-shared $static_link" . "$path/FINISH.sh" diff --git a/Docs/manual.texi b/Docs/manual.texi index 5afd24ae174..576c3667881 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46889,10 +46889,21 @@ not yet 100% confident in this code. @appendixsubsec Changes in release 3.23.48 @itemize @bullet @item +Changed to use @code{autoconf} 2.52 (from @code{autoconf} 2.13) +@item Fixed bug in complicated join with @code{const} tables. @item Added internal safety checks for InnoDB. @item +Some InnoDB variables was always shown in @code{SHOW VARIABLES} as +@code{OFF} on high-byte-first systems (like sparc). +@item +Fixed problem with one threads using an InnoDB table and another +thread using an @code{ALTER TABLE} on the table. +@item +If inserts to several tables containing an auto-inc column are wrapped +inside one @code{LOCK TABLES}, InnoDB asserted in @code{lock0lock.c}. +@item @code{SHOW GRANTS} now shows @code{REFERENCES} instead of @code{REFERENCE}. @end itemize diff --git a/acconfig.h b/acconfig.h index c6a67ac7f26..be4461da7fd 100644 --- a/acconfig.h +++ b/acconfig.h @@ -14,6 +14,10 @@ Leave the following blank line there!! Autoheader needs it. */ +#undef C_ALLOCA + +#undef CRAY_STACKSEG_END + /* Version of .frm files */ #undef DOT_FRM_VERSION @@ -38,6 +42,9 @@ /* atomic_sub() from (Linux only) */ #undef HAVE_ATOMIC_SUB +/* If we have a working alloca() implementation */ +#undef HAVE_ALLOCA + /* bool is not defined by all C++ compilators */ #undef HAVE_BOOL @@ -212,6 +219,8 @@ /* Needed to get large file supportat HPUX 10.20 */ #undef __STDC_EXT__ +#undef STACK_DIRECTION + #undef STRCOLL_BROKEN #undef STRUCT_DIRENT_HAS_D_FILENO diff --git a/acinclude.m4 b/acinclude.m4 index 1eb95e1e9c9..0f8b076ff62 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -315,14 +315,6 @@ case "x$am_cv_prog_cc_stdc" in esac ]) -# serial 1 - -AC_DEFUN(AM_PROG_INSTALL, -[AC_REQUIRE([AC_PROG_INSTALL]) -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' -AC_SUBST(INSTALL_SCRIPT)dnl -]) - # # Check to make sure that the build environment is sane. # @@ -527,7 +519,7 @@ fi ])dnl AC_DEFUN(MYSQL_STACK_DIRECTION, - AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction, + [AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction, [AC_TRY_RUN([find_stack_direction () { static char *addr = 0; @@ -546,7 +538,7 @@ AC_DEFUN(MYSQL_STACK_DIRECTION, }], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1, ac_cv_c_stack_direction=0)]) AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction) -)dnl +])dnl AC_DEFUN(MYSQL_FUNC_ALLOCA, [ @@ -708,6 +700,7 @@ dnl echo "DBG2: [$mode] bdb='$bdb'; incl='$bdb_includes'; lib='$bdb_libs'" no ) bdb_includes= bdb_libs= + bdb_libs_with_path= ;; supplied-two ) MYSQL_CHECK_INSTALLED_BDB([$bdb_includes], [$bdb_libs]) @@ -737,6 +730,7 @@ dnl echo "DBG2: [$mode] bdb='$bdb'; incl='$bdb_includes'; lib='$bdb_libs'" esac bdb_includes= bdb_libs= + bdb_libs_with_path= ;; esac ;; @@ -765,6 +759,7 @@ dnl echo "DBG3: [$mode] bdb='$bdb'; incl='$bdb_includes'; lib='$bdb_libs'" AC_SUBST(bdb_includes) AC_SUBST(bdb_libs) + AC_SUBST(bdb_libs_with_path) ]) AC_DEFUN([MYSQL_CHECK_INSTALLED_BDB], [ @@ -785,6 +780,7 @@ dnl echo ["MYSQL_CHECK_INSTALLED_BDB ($1) ($2)"] MYSQL_TOP_BUILDDIR([lib]) bdb_includes="-I$inc" bdb_libs="-L$lib -ldb" + bdb_libs_with_path="$lib/libdb.a" ]) LDFLAGS="$save_LDFLAGS" else @@ -813,6 +809,7 @@ dnl echo ["MYSQL_CHECK_BDB_DIR ($1)"] MYSQL_TOP_BUILDDIR([dir]) bdb_includes="-I$dir/build_unix" bdb_libs="-L$dir/build_unix -ldb" + bdb_libs_with_path="$dir/build_unix/libdb.a" else bdb_dir_ok="$bdb_version_ok" fi @@ -924,47 +921,48 @@ AC_DEFUN([MYSQL_CHECK_INNODB], [ AC_DEFINE(HAVE_INNOBASE_DB) have_innodb="yes" innodb_includes="-I../innobase/include" + innodb_system_libs="" dnl Some libs are listed several times, in order for gcc to sort out dnl circular references. innodb_libs="\ - ../innobase/usr/libusr.a\ - ../innobase/odbc/libodbc.a\ - ../innobase/srv/libsrv.a\ - ../innobase/que/libque.a\ - ../innobase/srv/libsrv.a\ - ../innobase/dict/libdict.a\ - ../innobase/ibuf/libibuf.a\ - ../innobase/row/librow.a\ - ../innobase/pars/libpars.a\ - ../innobase/btr/libbtr.a\ - ../innobase/trx/libtrx.a\ - ../innobase/read/libread.a\ - ../innobase/usr/libusr.a\ - ../innobase/buf/libbuf.a\ - ../innobase/ibuf/libibuf.a\ - ../innobase/eval/libeval.a\ - ../innobase/log/liblog.a\ - ../innobase/fsp/libfsp.a\ - ../innobase/fut/libfut.a\ - ../innobase/fil/libfil.a\ - ../innobase/lock/liblock.a\ - ../innobase/mtr/libmtr.a\ - ../innobase/page/libpage.a\ - ../innobase/rem/librem.a\ - ../innobase/thr/libthr.a\ - ../innobase/com/libcom.a\ - ../innobase/sync/libsync.a\ - ../innobase/data/libdata.a\ - ../innobase/mach/libmach.a\ - ../innobase/ha/libha.a\ - ../innobase/dyn/libdyn.a\ - ../innobase/mem/libmem.a\ - ../innobase/sync/libsync.a\ - ../innobase/ut/libut.a\ - ../innobase/os/libos.a\ - ../innobase/ut/libut.a" + \$(top_builddir)/innobase/usr/libusr.a\ + \$(top_builddir)/innobase/odbc/libodbc.a\ + \$(top_builddir)/innobase/srv/libsrv.a\ + \$(top_builddir)/innobase/dict/libdict.a\ + \$(top_builddir)/innobase/que/libque.a\ + \$(top_builddir)/innobase/srv/libsrv.a\ + \$(top_builddir)/innobase/ibuf/libibuf.a\ + \$(top_builddir)/innobase/row/librow.a\ + \$(top_builddir)/innobase/pars/libpars.a\ + \$(top_builddir)/innobase/btr/libbtr.a\ + \$(top_builddir)/innobase/trx/libtrx.a\ + \$(top_builddir)/innobase/read/libread.a\ + \$(top_builddir)/innobase/usr/libusr.a\ + \$(top_builddir)/innobase/buf/libbuf.a\ + \$(top_builddir)/innobase/ibuf/libibuf.a\ + \$(top_builddir)/innobase/eval/libeval.a\ + \$(top_builddir)/innobase/log/liblog.a\ + \$(top_builddir)/innobase/fsp/libfsp.a\ + \$(top_builddir)/innobase/fut/libfut.a\ + \$(top_builddir)/innobase/fil/libfil.a\ + \$(top_builddir)/innobase/lock/liblock.a\ + \$(top_builddir)/innobase/mtr/libmtr.a\ + \$(top_builddir)/innobase/page/libpage.a\ + \$(top_builddir)/innobase/rem/librem.a\ + \$(top_builddir)/innobase/thr/libthr.a\ + \$(top_builddir)/innobase/com/libcom.a\ + \$(top_builddir)/innobase/sync/libsync.a\ + \$(top_builddir)/innobase/data/libdata.a\ + \$(top_builddir)/innobase/mach/libmach.a\ + \$(top_builddir)/innobase/ha/libha.a\ + \$(top_builddir)/innobase/dyn/libdyn.a\ + \$(top_builddir)/innobase/mem/libmem.a\ + \$(top_builddir)/innobase/sync/libsync.a\ + \$(top_builddir)/innobase/ut/libut.a\ + \$(top_builddir)/innobase/os/libos.a\ + \$(top_builddir)/innobase/ut/libut.a" - AC_CHECK_LIB(rt, aio_read, [innodb_libs="$innodb_libs -lrt"]) + AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"]) ;; * ) AC_MSG_RESULT([Not using Innodb]) @@ -973,6 +971,7 @@ dnl circular references. AC_SUBST(innodb_includes) AC_SUBST(innodb_libs) + AC_SUBST(innodb_system_libs) ]) dnl --------------------------------------------------------------------------- @@ -1103,10 +1102,10 @@ changequote([, ])dnl AC_DEFINE_UNQUOTED([$1], [$]$2, [$3]) fi]) -AC_DEFUN(AC_SYS_LARGEFILE, +AC_DEFUN(MYSQL_SYS_LARGEFILE, [AC_REQUIRE([AC_CANONICAL_HOST]) - AC_ARG_ENABLE(largefile, - [ --disable-largefile Omit support for large files]) + AC_ARG_ENABLE(largefile, + [ --disable-largefile Omit support for large files]) if test "$enable_largefile" != no; then AC_CHECK_TOOL(GETCONF, getconf) AC_SYS_LARGEFILE_FLAGS(CFLAGS) diff --git a/bdb/dist/configure.in b/bdb/dist/configure.in index d5196be9740..6656a588a66 100644 --- a/bdb/dist/configure.in +++ b/bdb/dist/configure.in @@ -21,9 +21,7 @@ AC_SUBST(ADDITIONAL_LANG) AC_SUBST(ADDITIONAL_LIBS) AC_SUBST(ADDITIONAL_OBJS) AC_SUBST(ADDITIONAL_PROGS) -AC_SUBST(CFLAGS) AC_SUBST(CPPFLAGS) -AC_SUBST(CXX) AC_SUBST(CXXFLAGS) AC_SUBST(DBS_LIBS) AC_SUBST(DEFAULT_INSTALL) @@ -145,55 +143,6 @@ osf*) CPPFLAGS="-D_REENTRANT $CPPFLAGS";; *qnx) AC_DEFINE(HAVE_QNX);; sco3.2v4*) CC=${CC-"cc -belf"} LIBS="-lsocket -lnsl_s $LIBS";; -sco3.2v5*) if test "$GCC" != "yes"; then - CFLAGS="$CFLAGS" - LD='$(CC) $(CFLAGS)' - LIBS="-lsocket -lnsl $LIBS" - CPPFLAGS="-D_THREAD_SAFE -pthread $CPPFLAGS" - case "$CFLAGS" in - *-belf*) - AC_SYS_COMPILER_FLAG(-belf,sco_belf_option,CFLAGS,[],[ - case "$LDFLAGS" in - *-belf*) ;; - *) echo "Adding -belf option to ldflags." - LDFLAGS="$LDFLAGS -belf" - ;; - esac - ]) - ;; - *) - AC_SYS_COMPILER_FLAG(-belf,sco_belf_option,CFLAGS,[],[ - case "$LDFLAGS" in - *-belf*) ;; - *) - echo "Adding -belf option to ldflags." - LDFLAGS="$LDFLAGS -belf" - ;; - esac - ]) - ;; - esac - else - CC="gcc" - LIBS="-lsocket -lnsl $LIBS" - CPPFLAGS="-D_THREAD_SAFE -pthread $CPPFLAGS" - fi - ;; -sysv5uw7*) LIBS="-lsocket -lnsl $LIBS" - if test "$GCC" != "yes"; then - # We are using built-in inline function - CC="cc -belf" - CXX="CC -belf" - CFLAGS="$CFLAGS -Kalloca -Kthread" - CXX="$CXX -DNO_CPLUSPLUS_ALLOCA" - LIBS="-Kthread -lsocket -lnsl $LIBS" - else - CFLAGS="$CFLAGS -Kalloca -pthread" - CXX="$CXX -DNO_CPLUSPLUS_ALLOCA" - CPPFLAGS="-D_THREAD_SAFE -pthread $CPPFLAGS" - LIBS="-pthread -lsocket -lnsl $LIBS" - fi - ;; sco*) CC=${CC-"cc -belf"} LIBS="-lsocket -lnsl $LIBS";; solaris*) CPPFLAGS="-D_REENTRANT $CPPFLAGS";; @@ -281,6 +230,59 @@ if test "$GXX" = "yes"; then esac fi +dnl Give the OS a last chance to override CFLAGS and LDFLAGS + +case "$host_os" in +sco3.2v5*) + if test "$GCC" != "yes"; then + CFLAGS="$CFLAGS" + LD='$(CC) $(CFLAGS)' + LIBS="-lsocket -lnsl $LIBS" + CPPFLAGS="-D_THREAD_SAFE -pthread $CPPFLAGS" + case "$CFLAGS" in + *-belf*) + AC_SYS_COMPILER_FLAG(-belf,sco_belf_option,CFLAGS,[],[ + case "$LDFLAGS" in + *-belf*) ;; + *) echo "Adding -belf option to ldflags." + LDFLAGS="$LDFLAGS -belf" + ;; + esac + ]) + ;; + *) + AC_SYS_COMPILER_FLAG(-belf,sco_belf_option,CFLAGS,[],[ + case "$LDFLAGS" in + *-belf*) ;; + *) + echo "Adding -belf option to ldflags." + LDFLAGS="$LDFLAGS -belf" + ;; + esac + ]) + ;; + esac + else + CC="gcc" + LIBS="-lsocket -lnsl $LIBS" + CPPFLAGS="-D_THREAD_SAFE -pthread $CPPFLAGS" + fi ;; +sysv5uw7*) LIBS="-lsocket -lnsl $LIBS" + if test "$GCC" != "yes"; then + # We are using built-in inline function + CC="cc -belf" + CXX="CC -belf -DNO_CPLUSPLUS_ALLOCA" + CFLAGS="$CFLAGS -Kalloca -Kthread" + LIBS="-Kthread -lsocket -lnsl $LIBS" + else + CFLAGS="$CFLAGS -Kalloca -pthread" + CXX="$CXX -DNO_CPLUSPLUS_ALLOCA" + CPPFLAGS="-D_THREAD_SAFE -pthread $CPPFLAGS" + LIBS="-pthread -lsocket -lnsl $LIBS" + fi + ;; +esac + dnl Export our compiler preferences for the libtool configuration. export CC CCC CCC=CXX diff --git a/client/Makefile.am b/client/Makefile.am index d1b16870f67..1710e573d20 100644 --- a/client/Makefile.am +++ b/client/Makefile.am @@ -28,6 +28,7 @@ noinst_HEADERS = sql_string.h completion_hash.h my_readline.h \ client_priv.h mysql_SOURCES = mysql.cc readline.cc sql_string.cc completion_hash.cc mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD) $(CXXLDFLAGS) +mysqlbinlog_LDADD = $(LDADD) $(CXXLDFLAGS) mysql_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) mysqladmin_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) mysqlcheck_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) diff --git a/configure.in b/configure.in index 7b0c604d2be..33d6443275d 100644 --- a/configure.in +++ b/configure.in @@ -65,6 +65,12 @@ AC_DEFINE_UNQUOTED(SYSTEM_TYPE, "$SYSTEM_TYPE") AC_SUBST(MACHINE_TYPE) AC_DEFINE_UNQUOTED(MACHINE_TYPE, "$MACHINE_TYPE") +# Detect intel x86 like processor +BASE_MACHINE_TYPE=$MACHINE_TYPE +case $MACHINE_TYPE in + i?86) BASE_MACHINE_TYPE=i386 ;; +esac + # Save some variables and the command line options for mysqlbug SAVE_CFLAGS="$CFLAGS" SAVE_CXXFLAGS="$CXXFLAGS" @@ -81,7 +87,7 @@ AC_SUBST(CXXLDFLAGS) AC_PREREQ(2.12)dnl Minimum Autoconf version required. AM_MAINTAINER_MODE -AC_ARG_PROGRAM +#AC_ARG_PROGRAM # Automaticly invoked by AM_INIT_AUTOMAKE AM_SANITY_CHECK # This is needed is SUBDIRS is set AC_PROG_MAKE_SET @@ -145,8 +151,10 @@ AM_PROG_LIBTOOL #AC_LIBTOOL_DLOPEN AC_LIBTOOL_WIN32_DLL AC_DISABLE_FAST_INSTALL AC_DISABLE_SHARED AC_DISABLE_STATIC -# AC_PROG_INSTALL We should only need a AM_PROG_INSTALL +# AC_PROG_INSTALL AC_PROG_INSTALL +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + # Not critical since the generated file is distributed AC_PROG_YACC AC_CHECK_PROG(PDFMANUAL, pdftex, manual.pdf) @@ -179,7 +187,8 @@ AC_DEFINE(SPRINTF_RETURNS_INT) AC_MSG_RESULT("int"), AC_DEFINE(SPRINTF_RETURNS_GARBAGE) AC_MSG_RESULT("garbage"))) -# option, cache_name, variable +# option, cache_name, variable, +# code to execute if yes, code to exectute if fail AC_DEFUN(AC_SYS_COMPILER_FLAG, [ AC_MSG_CHECKING($1) @@ -188,7 +197,7 @@ AC_DEFUN(AC_SYS_COMPILER_FLAG, [ CFLAGS="[$]OLD_CFLAGS $1" AC_TRY_RUN([int main(){exit(0);}],mysql_cv_option_$2=yes,mysql_cv_option_$2=no,mysql_cv_option_$2=no) - ]) + ]) CFLAGS="[$]OLD_CFLAGS" @@ -288,6 +297,7 @@ AC_SUBST(CFLAGS) AC_SUBST(CXX) AC_SUBST(CXXFLAGS) AC_SUBST(LD) +AC_SUBST(INSTALL_SCRIPT) export CC CFLAGS LD LDFLAGS @@ -515,12 +525,22 @@ AC_ARG_ENABLE(assembler, [ ENABLE_ASSEMBLER=$enableval ], [ ENABLE_ASSEMBLER=no ] ) -# For now we only support assembler on i386 and sparc systems -AM_CONDITIONAL(ASSEMBLER_x86, test "$ENABLE_ASSEMBLER" = "yes" -a "$MACHINE_TYPE" = "i386") -AM_CONDITIONAL(ASSEMBLER_sparc, test "$ENABLE_ASSEMBLER" = "yes" -a "$MACHINE_TYPE" = "sparc") -AM_CONDITIONAL(ASSEMBLER, test ASSEMBLER_x86 = "" -o ASSEMBLER_x86 = "") -AC_MSG_CHECKING(whether to use RAID) +AC_MSG_CHECKING(if we should use assembler functions) +# For now we only support assembler on i386 and sparc systems +AM_CONDITIONAL(ASSEMBLER_x86, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "i386") +AM_CONDITIONAL(ASSEMBLER_sparc, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparc") +AM_CONDITIONAL(ASSEMBLER, test "$ASSEMBLER_x86_TRUE" = "" -o "$ASSEMBLER_sparc_TRUE" = "") + +if test "$ASSEMBLER_TRUE" = "" +then + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi + + +AC_MSG_CHECKING(if we should use RAID) AC_ARG_WITH(raid, [ --with-raid Enable RAID Support], [ USE_RAID=$withval ], @@ -563,9 +583,8 @@ AC_ARG_WITH(mysqld-user, ) AC_SUBST(MYSQLD_USER) -# Use Paul Eggerts macros from GNU tar to check for large file -# support. -AC_SYS_LARGEFILE +# Use Paul Eggerts macros from GNU tar to check for large file support. +MYSQL_SYS_LARGEFILE # Types that must be checked AFTER large file support is checked AC_TYPE_SIZE_T @@ -764,8 +783,8 @@ case $SYSTEM_TYPE in ;; *hpux10.20*) echo "Enabling snprintf workaround for hpux 10.20" - CFLAGS="$CFLAGS -DHAVE_BROKEN_SNPRINTF -DSIGNALS_DONT_BREAK_READ" - CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_SNPRINTF -D_INCLUDE_LONGLONG -DSIGNALS_DONT_BREAK_READ" + CFLAGS="$CFLAGS -DHAVE_BROKEN_SNPRINTF -DSIGNALS_DONT_BREAK_READ -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX -DSIGNAL_WITH_VIO_CLOSE" + CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_SNPRINTF -D_INCLUDE_LONGLONG -DSIGNALS_DONT_BREAK_READ -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX -DSIGNAL_WITH_VIO_CLOSE" if test "$with_named_thread" = "no" then echo "Using --with-named-thread=-lpthread" @@ -774,8 +793,8 @@ case $SYSTEM_TYPE in ;; *hpux11.*) echo "Enabling pread/pwrite workaround for hpux 11" - CFLAGS="$CFLAGS -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -DHAVE_BROKEN_GETPASS -DNO_FCNTL_NONBLOCK" - CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -D_INCLUDE_LONGLONG -DNO_FCNTL_NONBLOCK" + CFLAGS="$CFLAGS -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -DHAVE_BROKEN_GETPASS -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS" + CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -D_INCLUDE_LONGLONG -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS" if test "$with_named_thread" = "no" then echo "Using --with-named-thread=-lpthread" @@ -1419,7 +1438,7 @@ MYSQL_TYPE_QSORT AC_FUNC_UTIME_NULL AC_FUNC_VPRINTF AC_CHECK_FUNCS(alarm bmove \ - chsize ftruncate rint finite fpsetmask fpresetsticky\ + chsize ftruncate rint finite isnan fpsetmask fpresetsticky\ cuserid fcntl fconvert poll \ getrusage getpwuid getcwd getrlimit getwd index stpcpy locking longjmp \ perror pread realpath readlink rename \ @@ -1728,7 +1747,7 @@ AC_ARG_WITH(readline, if test "$with_readline" = "yes" then readline_dir="readline" - readline_link="../readline/libreadline.a" + readline_link="\$(top_builddir)/readline/libreadline.a" else # This requires readline to be in a standard place. Mosty for linux # there readline may be a shared library. @@ -1738,15 +1757,15 @@ fi AC_SUBST(readline_dir) AC_SUBST(readline_link) -# Choose a character set -dnl in order to add new charset, you must add charset name to -dnl CHARSETS_AVAILABLE list and add the charset name to -dnl sql/share/charsets/Index. If the character set uses strcoll -dnl or other special handling, you must also create -dnl strings/ctype-$charset_name.c +dnl In order to add new charset, you must add charset name to +dnl this CHARSETS_AVAILABLE list and sql/share/charsets/Index. +dnl If the character set uses strcoll or other special handling, +dnl you must also create strings/ctype-$charset_name.c +AC_DIVERT_PUSH(0) CHARSETS_AVAILABLE="big5 cp1251 cp1257 croat czech danish dec8 dos estonia euc_kr gb2312 gbk german1 greek hebrew hp8 hungarian koi8_ru koi8_ukr latin1 latin2 latin5 swe7 usa7 win1250 win1251 win1251ukr ujis sjis tis620" DEFAULT_CHARSET=latin1 +AC_DIVERT_POP dnl win1251 is deprecated - it's available, but not listed here in the help AC_ARG_WITH(charset, @@ -2086,7 +2105,17 @@ EOF then sql_server_dirs="innobase $sql_server_dirs" echo "CONFIGURING FOR INNODB" - (cd innobase && sh ./configure) \ + if test ! -d "innobase"; then + # This should only happen when doing a VPATH build + echo "NOTICE: I have to make the Innobase directory: `pwd`/innobase" + mkdir "innobase" || exit 1 + fi + rel_srcdir= + case "$srcdir" in + /* ) rel_srcdir="$srcdir" ;; + * ) rel_srcdir="../$srcdir" ;; + esac + (cd innobase && sh $rel_srcdir/innobase/configure) \ || AC_MSG_ERROR([could not configure INNODB]) echo "END OF INNODB CONFIGURATION" @@ -2158,9 +2187,9 @@ AC_OUTPUT(Makefile extra/Makefile mysys/Makefile isam/Makefile \ include/mysql_version.h , , [ test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h - rm -f $AVAILABLE_LANGUAGES_ERRORS_RULES ]) +rm -f $AVAILABLE_LANGUAGES_ERRORS_RULES echo echo "MySQL has a Web site at http://www.mysql.com/ which carries details on the" echo "latest release, upcoming features, and other information to make your" @@ -2170,6 +2199,6 @@ echo echo "Remember to check the platform specific part in the reference manual for" echo "hints about installing on your platfrom. See the Docs directory." echo -# This text is checked in ./Do-compile to se that the configure finished. +# The following text is checked in ./Do-compile to se that the configure ends. echo "Thank you for choosing MySQL!" echo diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 63674d050c1..388c83492f5 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -133,9 +133,9 @@ level id parent_id Table Op Msg_type Msg_text test.t1 optimize error The handler for the table doesn't support check/repair Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment -t1 0 PRIMARY 1 id A 87 NULL NULL -t1 1 parent_id 1 parent_id A 21 NULL NULL -t1 1 level 1 level A 4 NULL NULL +t1 0 PRIMARY 1 id A NULL NULL NULL +t1 1 parent_id 1 parent_id A NULL NULL NULL +t1 1 level 1 level A NULL NULL NULL gesuchnr benutzer_id 1 1 2 1 @@ -150,7 +150,7 @@ a b Table Op Msg_type Msg_text test.t1 analyze error The handler for the table doesn't support check/repair Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment -t1 1 skr 1 a A 1 NULL NULL +t1 1 skr 1 a A NULL NULL NULL a b 1 n after rollback @@ -438,7 +438,7 @@ hello 1 Table Op Msg_type Msg_text test.t1 optimize error The handler for the table doesn't support check/repair Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment -t1 0 PRIMARY 1 a A 1 NULL NULL +t1 0 PRIMARY 1 a A NULL NULL NULL i j 1 2 i j diff --git a/mysys/Makefile.am b/mysys/Makefile.am index 6dd9bb06fe9..73cd9768013 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -30,7 +30,8 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\ mf_iocache.c mf_iocache2.c mf_cache.c mf_tempfile.c \ my_lock.c mf_brkhant.c my_alarm.c \ my_malloc.c my_realloc.c my_once.c mulalloc.c \ - my_alloc.c safemalloc.c my_fopen.c my_fstream.c \ + my_alloc.c safemalloc.c my_new.cc \ + my_fopen.c my_fstream.c \ my_error.c errors.c my_div.c my_messnc.c \ mf_format.c mf_same.c mf_dirname.c mf_fn_ext.c \ my_symlink.c my_symlink2.c \ diff --git a/mysys/my_new.cc b/mysys/my_new.cc new file mode 100644 index 00000000000..5cc291af9aa --- /dev/null +++ b/mysys/my_new.cc @@ -0,0 +1,49 @@ +/* Copyright (C) 2000 MySQL AB + + 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; either version 2 of the License, or + (at your option) any later version. + + 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 */ + +/* + This is a replacement of new/delete operators to be used when compiling + with gcc 3.0.x to avoid including libstdc++ +*/ + +#include "mysys_priv.h" + +#ifdef USE_MYSYS_NEW + +void *operator new (size_t sz) +{ + return (void *) malloc (sz ? sz+1 : sz); +} + +void *operator new[] (size_t sz) +{ + return (void *) malloc (sz ? sz+1 : sz); +} + +void operator delete (void *ptr) +{ + if (ptr) + free(ptr); +} + +void operator delete[] (void *ptr) throw () +{ + if (ptr) + free(ptr); +} + +#endif /* USE_MYSYS_NEW */ + diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 45fbe275476..18957b6422d 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -71,7 +71,7 @@ CLEANFILES = @server_scripts@ \ SUPERCLEANFILES = mysqlbug # We want the right version and configure comand line in mysqlbug -mysqlbug: ${top_builddir}/config.status ${top_builddir}/config.cache mysqlbug.sh +mysqlbug: ${top_builddir}/config.status mysqlbug.sh SUFFIXES = .sh diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index acdc9736a4f..ada9cbc740b 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -85,7 +85,7 @@ long innobase_mirrored_log_groups, innobase_log_files_in_group, char *innobase_data_home_dir, *innobase_data_file_path; char *innobase_log_group_home_dir, *innobase_log_arch_dir; char *innobase_unix_file_flush_method; -bool innobase_flush_log_at_trx_commit, innobase_log_archive, +my_bool innobase_flush_log_at_trx_commit, innobase_log_archive, innobase_use_native_aio, innobase_fast_shutdown; /* innobase_data_file_path=ibdata:15,idata2:1,... */ diff --git a/sql/ha_innobase.h b/sql/ha_innobase.h index 54449a1ef2b..ec77cd1a70f 100644 --- a/sql/ha_innobase.h +++ b/sql/ha_innobase.h @@ -174,8 +174,9 @@ extern long innobase_force_recovery, innobase_thread_concurrency; extern char *innobase_data_home_dir, *innobase_data_file_path; extern char *innobase_log_group_home_dir, *innobase_log_arch_dir; extern char *innobase_unix_file_flush_method; -extern bool innobase_flush_log_at_trx_commit, innobase_log_archive, - innobase_use_native_aio, innobase_fast_shutdown; +/* The following variables have to be my_bool for SHOW VARIABLES to work */ +extern my_bool innobase_flush_log_at_trx_commit, innobase_log_archive, + innobase_use_native_aio, innobase_fast_shutdown; extern TYPELIB innobase_lock_typelib; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index aa54f325ebb..62ebf04a9f3 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -771,7 +771,7 @@ bool close_cached_table(THD *thd,TABLE *table) /* Mark all tables that are in use as 'old' */ mysql_lock_abort(thd,table); // end threads waiting on lock -#ifdef REMOVE_LOCKS +#if defined(USING_TRANSACTIONS) || defined( __WIN__) || defined( __EMX__) || !defined(OS2) /* Wait until all there are no other threads that has this table open */ while (remove_table_from_cache(thd,table->table_cache_key, table->table_name)) @@ -1569,19 +1569,28 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, } } -#if defined( __WIN__) || defined( __EMX__) || defined( OS2) - // Win32 can't rename an open table, so we must close the org table! - table_name=thd->strdup(table_name); // must be saved - if (close_cached_table(thd,table)) - { // Aborted - VOID(quick_rm_table(new_db_type,new_db,tmp_name)); - VOID(pthread_mutex_unlock(&LOCK_open)); - goto err; - } - table=0; // Marker for win32 version -#else - table->file->extra(HA_EXTRA_FORCE_REOPEN); // Don't use this file anymore +#if (!defined( __WIN__) && !defined( __EMX__) && !defined( OS2)) + if (table->file->has_transactions()) #endif + { + /* + Win32 and InnoDB can't rename an open table, so we must close + the original table at before doing the rename + */ + table_name=thd->strdup(table_name); // must be saved + if (close_cached_table(thd,table)) + { // Aborted + VOID(quick_rm_table(new_db_type,new_db,tmp_name)); + VOID(pthread_mutex_unlock(&LOCK_open)); + goto err; + } + table=0; // Marker that table is closed + } +#if (!defined( __WIN__) && !defined( __EMX__) && !defined( OS2)) + else + table->file->extra(HA_EXTRA_FORCE_REOPEN); // Don't use this file anymore +#endif + error=0; if (mysql_rename_table(old_db_type,db,table_name,db,old_name)) diff --git a/support-files/my-huge.cnf.sh b/support-files/my-huge.cnf.sh index 103a6c16cfd..ce9b5b18586 100644 --- a/support-files/my-huge.cnf.sh +++ b/support-files/my-huge.cnf.sh @@ -4,7 +4,7 @@ # MySQL. # # You can copy this file to -# /etc/mf.cnf to set global options, +# /etc/my.cnf to set global options, # mysql-data-dir/my.cnf to set server-specific options (in this # installation this directory is @localstatedir@) or # ~/.my.cnf to set user-specific options. diff --git a/support-files/my-large.cnf.sh b/support-files/my-large.cnf.sh index f314566c5fb..0602921abc1 100644 --- a/support-files/my-large.cnf.sh +++ b/support-files/my-large.cnf.sh @@ -4,7 +4,7 @@ # MySQL. # # You can copy this file to -# /etc/mf.cnf to set global options, +# /etc/my.cnf to set global options, # mysql-data-dir/my.cnf to set server-specific options (in this # installation this directory is @localstatedir@) or # ~/.my.cnf to set user-specific options. diff --git a/support-files/my-medium.cnf.sh b/support-files/my-medium.cnf.sh index 675241b25dd..bddba03eee9 100644 --- a/support-files/my-medium.cnf.sh +++ b/support-files/my-medium.cnf.sh @@ -5,7 +5,7 @@ # other programs (like a web server) # # You can copy this file to -# /etc/mf.cnf to set global options, +# /etc/my.cnf to set global options, # mysql-data-dir/my.cnf to set server-specific options (in this # installation this directory is @localstatedir@) or # ~/.my.cnf to set user-specific options. diff --git a/support-files/my-small.cnf.sh b/support-files/my-small.cnf.sh index cad0e10e684..9e7d07ec449 100644 --- a/support-files/my-small.cnf.sh +++ b/support-files/my-small.cnf.sh @@ -5,7 +5,7 @@ # doesn't use much resources. # # You can copy this file to -# /etc/mf.cnf to set global options, +# /etc/my.cnf to set global options, # mysql-data-dir/my.cnf to set server-specific options (in this # installation this directory is @localstatedir@) or # ~/.my.cnf to set user-specific options. From 73edf19b0c0a06e0271090002c6bd33df886d87b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 7 Feb 2002 23:46:29 +0200 Subject: [PATCH 07/17] Fixed results after Heikki's last change --- mysql-test/r/innodb.result | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 388c83492f5..d13347b7903 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -133,9 +133,9 @@ level id parent_id Table Op Msg_type Msg_text test.t1 optimize error The handler for the table doesn't support check/repair Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment -t1 0 PRIMARY 1 id A NULL NULL NULL -t1 1 parent_id 1 parent_id A NULL NULL NULL -t1 1 level 1 level A NULL NULL NULL +t1 0 PRIMARY 1 id A 87 NULL NULL +t1 1 parent_id 1 parent_id A 43 NULL NULL +t1 1 level 1 level A 8 NULL NULL gesuchnr benutzer_id 1 1 2 1 @@ -150,7 +150,7 @@ a b Table Op Msg_type Msg_text test.t1 analyze error The handler for the table doesn't support check/repair Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment -t1 1 skr 1 a A NULL NULL NULL +t1 1 skr 1 a A 3 NULL NULL a b 1 n after rollback @@ -438,7 +438,7 @@ hello 1 Table Op Msg_type Msg_text test.t1 optimize error The handler for the table doesn't support check/repair Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment -t1 0 PRIMARY 1 a A NULL NULL NULL +t1 0 PRIMARY 1 a A 2 NULL NULL i j 1 2 i j From 17b2cd98c9b142fb4414cde86a3ce4026c486bc8 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 8 Feb 2002 23:24:36 +0200 Subject: [PATCH 08/17] dict0crea.c: Add some error messages to help in tracking Harald Fuchs' foreign key failure innobase/dict/dict0crea.c: Add some error messages to help in tracking Harald Fuchs' foreign key failure --- innobase/dict/dict0crea.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/innobase/dict/dict0crea.c b/innobase/dict/dict0crea.c index f60db829380..ddaad90af34 100644 --- a/innobase/dict/dict0crea.c +++ b/innobase/dict/dict0crea.c @@ -1235,16 +1235,21 @@ loop: if (error != DB_SUCCESS) { fprintf(stderr, - "InnoDB: foreign constraint creation failed;\n" + "InnoDB: Foreign key constraint creation failed:\n" "InnoDB: internal error number %lu\n", error); - ut_a(error == DB_OUT_OF_FILE_SPACE); + if (error == DB_DUPLICATE_KEY) { + fprintf(stderr, + "InnoDB: Duplicate key error in system table %s index %s\n", + ((dict_index_t*)trx->error_info)->table_name, + ((dict_index_t*)trx->error_info)->name); - fprintf(stderr, "InnoDB: tablespace is full\n"); - - trx_general_rollback_for_mysql(trx, FALSE, NULL); - - error = DB_MUST_GET_MORE_FILE_SPACE; + fprintf(stderr, + "InnoDB: Maybe the internal data dictionary of InnoDB is\n" + "InnoDB: out-of-sync from the .frm files of your tables.\n" + "InnoDB: See section 15.1 Troubleshooting data dictionary operations\n" + "InnoDB: at http://www.innodb.com/ibman.html\n"); + } return(error); } From 4bb78022255434e1bb5dc559fd9a6b475167c522 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 8 Feb 2002 23:35:50 +0200 Subject: [PATCH 09/17] dict0crea.c: Still a little better error message for Harald Fuchs innobase/dict/dict0crea.c: Still a little better error message for Harald Fuchs --- innobase/dict/dict0crea.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/innobase/dict/dict0crea.c b/innobase/dict/dict0crea.c index ddaad90af34..f15d36251e4 100644 --- a/innobase/dict/dict0crea.c +++ b/innobase/dict/dict0crea.c @@ -1244,6 +1244,8 @@ loop: ((dict_index_t*)trx->error_info)->table_name, ((dict_index_t*)trx->error_info)->name); + fprintf(stderr, "%s\n", buf); + fprintf(stderr, "InnoDB: Maybe the internal data dictionary of InnoDB is\n" "InnoDB: out-of-sync from the .frm files of your tables.\n" From f7c085efe3155ad81aebb7d141182d60f6328ca2 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 9 Feb 2002 04:00:24 +0200 Subject: [PATCH 10/17] Removed compiler warnings Docs/manual.texi: Cleanup myisam/myisampack.c: Removed warning sql/handler.cc: cleanup sql/slave.cc: Removed not used var --- Docs/manual.texi | 4 ++-- myisam/myisampack.c | 2 +- sql/handler.cc | 43 +++++++++++++++++++++++-------------------- sql/slave.cc | 1 - 4 files changed, 26 insertions(+), 24 deletions(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index 576c3667881..524e68d2f1f 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46898,8 +46898,8 @@ Added internal safety checks for InnoDB. Some InnoDB variables was always shown in @code{SHOW VARIABLES} as @code{OFF} on high-byte-first systems (like sparc). @item -Fixed problem with one threads using an InnoDB table and another -thread using an @code{ALTER TABLE} on the table. +Fixed problem with one thread using an InnoDB table and another +thread doing an @code{ALTER TABLE} on the same table. @item If inserts to several tables containing an auto-inc column are wrapped inside one @code{LOCK TABLES}, InnoDB asserted in @code{lock0lock.c}. diff --git a/myisam/myisampack.c b/myisam/myisampack.c index 7ee0ff61204..98fa8fcb377 100644 --- a/myisam/myisampack.c +++ b/myisam/myisampack.c @@ -283,7 +283,7 @@ static void usage(void) -?, --help Display this help and exit.\n\ -V, --version Output version information and exit."); print_defaults("my",load_default_groups); -}; +} /* reads options */ /* Initiates DEBUG - but no debugging here ! */ diff --git a/sql/handler.cc b/sql/handler.cc index c1e28b0058e..5a713bccc1e 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -257,28 +257,31 @@ int ha_autocommit_or_rollback(THD *thd, int error) DBUG_RETURN(error); } -/* This function is called when MySQL writes the log segment of a transaction -to the binlog. It is called when the LOCK_log mutex is reserved. Here we -communicate to transactional table handlers whta binlog position corresponds -to the current transaction. The handler can store it and in recovery print -to the user, so that the user knows from what position in the binlog to -start possible roll-forward, for example, if the crashed server was a slave -in replication. This function also calls the commit of the table handler, -because the order of trasnactions in the log of the table handler must be -the same as in the binlog. */ +/* + This function is called when MySQL writes the log segment of a + transaction to the binlog. It is called when the LOCK_log mutex is + reserved. Here we communicate to transactional table handlers whta + binlog position corresponds to the current transaction. The handler + can store it and in recovery print to the user, so that the user + knows from what position in the binlog to start possible + roll-forward, for example, if the crashed server was a slave in + replication. This function also calls the commit of the table + handler, because the order of trasnactions in the log of the table + handler must be the same as in the binlog. -int ha_report_binlog_offset_and_commit( - THD *thd, /* in: user thread */ - char *log_file_name, /* in: latest binlog file name */ - my_off_t end_offset) /* in: the offset in the binlog file - up to which we wrote */ + arguments: + log_file_name: latest binlog file name + end_offset: the offset in the binlog file up to which we wrote +*/ + +int ha_report_binlog_offset_and_commit(THD *thd, + char *log_file_name, + my_off_t end_offset) { - THD_TRANS *trans; - int error = 0; - - trans = &thd->transaction.all; - + int error= 0; #ifdef HAVE_INNOBASE_DB + THD_TRANS *trans; + trans = &thd->transaction.all; if (trans->innobase_tid) { if ((error=innobase_report_binlog_offset_and_commit(thd, @@ -292,10 +295,10 @@ int ha_report_binlog_offset_and_commit( trans->innodb_active_trans=0; } #endif - return error; } + int ha_commit_trans(THD *thd, THD_TRANS* trans) { int error=0; diff --git a/sql/slave.cc b/sql/slave.cc index ee8b82052b7..cff3af42ce1 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -79,7 +79,6 @@ static byte* get_table_key(TABLE_RULE_ENT* e, uint* len, void init_slave_skip_errors(char* arg) { char* p; - my_bool last_was_digit = 0; if (bitmap_init(&slave_error_mask,MAX_SLAVE_ERROR,0)) { fprintf(stderr, "Badly out of memory, please check your system status\n"); From 84c71cf7789ab7b74a7c9d8bb11c84ac0a63b846 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 9 Feb 2002 17:14:58 +0200 Subject: [PATCH 11/17] added options 'version-suffix' to Do-compile Build-tools/Do-compile: added options 'version-suffix' --- Build-tools/Do-compile | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile index 24b70453e5f..937f62b64bf 100755 --- a/Build-tools/Do-compile +++ b/Build-tools/Do-compile @@ -3,29 +3,29 @@ use Getopt::Long; $opt_distribution=$opt_user=$opt_result=$opt_config_options=$opt_config_env=""; $opt_dbd_options=$opt_perl_options=$opt_suffix=""; -$opt_tmp=$version_suffix=""; +$opt_tmp=$opt_version_suffix=""; $opt_help=$opt_Information=$opt_delete=$opt_debug=$opt_stage=$opt_rsh_mail=$opt_no_test=$opt_no_perl=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_no_mysqltest=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=0; $opt_innodb=$opt_bdb=0; -GetOptions("Information","help","distribution=s","user=s","result=s","delete","no-test","no-mysqltest","perl-files=s","debug","config-options=s","config-env=s","stage=i","rsh-mail","with-low-memory","fast-benchmark","tmp=s","static-client","static-server","static-perl","no-perl","local-perl","perl-options=s","sur","with-small-disk","dbd-options=s","tcpip","suffix=s","build-thread=i","innodb","bdb","use-old-distribution","enable-shared","no-crash-me","no-strip") || usage(); +GetOptions("Information","help","distribution=s","user=s","result=s","delete","no-test","no-mysqltest","perl-files=s","debug","config-options=s","config-env=s","stage=i","rsh-mail","with-low-memory","fast-benchmark","tmp=s","static-client","static-server","static-perl","no-perl","local-perl","perl-options=s","sur","with-small-disk","dbd-options=s","tcpip","suffix=s","build-thread=i","innodb","bdb","use-old-distribution","enable-shared","no-crash-me","no-strip","version-suffix") || usage(); usage() if ($opt_help || $opt_Information); usage() if (!$opt_distribution); -if ($opt_innodb || $opt_bdb) +if (($opt_innodb || $opt_bdb) && $opt_version_suffix eq "") { - $version_suffix="-max"; + $opt_version_suffix="-max"; } chomp($host=`hostname`); $full_host_name=$host; -info("Compiling MySQL$version_suffix at $host$suffix, stage: $opt_stage\n"); +info("Compiling MySQL$opt_version_suffix at $host$suffix, stage: $opt_stage\n"); $connect_option= ($opt_tcpip ? "--host=$host" : ""); $host =~ /^([^.-]*)/; $host=$1 . $opt_suffix; $email="$opt_user\@mysql.com"; $pwd = `pwd`; chomp($pwd); -$log="$pwd/Logs/$host$version_suffix.log"; +$log="$pwd/Logs/$host$opt_version_suffix.log"; $opt_distribution =~ /(mysql-[^\/]*)\.tar/; $ver=$1; $gcc_version=which("gcc"); @@ -156,7 +156,7 @@ if ($opt_stage <= 1) { $opt_config_options.= " --with-innodb" } - check_system("$opt_config_env ./configure --prefix=/usr/local/mysql \"--with-comment=Official MySQL$version_suffix binary\" --with-extra-charsets=complex \"--with-server-suffix=$version_suffix\" --enable-thread-safe-client $opt_config_options","Thank you for choosing MySQL"); + check_system("$opt_config_env ./configure --prefix=/usr/local/mysql \"--with-comment=Official MySQL$opt_version_suffix binary\" --with-extra-charsets=complex \"--with-server-suffix=$opt_version_suffix\" --enable-thread-safe-client $opt_config_options","Thank you for choosing MySQL"); if (-d "$pwd/$host/include-mysql") { safe_system("cp -r $pwd/$host/include-mysql/* $pwd/$host/$ver/include"); @@ -361,6 +361,9 @@ To set up the environment, like 'CC=cc CXX=gcc CXXFLAGS=-O3' --dbd-options 'options' Options for Makefile.PL when configuring msql-mysql-modules. +--version-suffix suffix +Can be used to set a suffix (normally com or -max) for a distribution + --with-low-memory Use less memory when compiling. From c9a4dde5de64fe31f65653ca5bc7495fcf471382 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 10 Feb 2002 00:34:05 +0200 Subject: [PATCH 12/17] Add forgotten argument to --version-suffix --- Build-tools/Do-compile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile index 937f62b64bf..eecd01066e0 100755 --- a/Build-tools/Do-compile +++ b/Build-tools/Do-compile @@ -7,7 +7,7 @@ $opt_tmp=$opt_version_suffix=""; $opt_help=$opt_Information=$opt_delete=$opt_debug=$opt_stage=$opt_rsh_mail=$opt_no_test=$opt_no_perl=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_no_mysqltest=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=0; $opt_innodb=$opt_bdb=0; -GetOptions("Information","help","distribution=s","user=s","result=s","delete","no-test","no-mysqltest","perl-files=s","debug","config-options=s","config-env=s","stage=i","rsh-mail","with-low-memory","fast-benchmark","tmp=s","static-client","static-server","static-perl","no-perl","local-perl","perl-options=s","sur","with-small-disk","dbd-options=s","tcpip","suffix=s","build-thread=i","innodb","bdb","use-old-distribution","enable-shared","no-crash-me","no-strip","version-suffix") || usage(); +GetOptions("Information","help","distribution=s","user=s","result=s","delete","no-test","no-mysqltest","perl-files=s","debug","config-options=s","config-env=s","stage=i","rsh-mail","with-low-memory","fast-benchmark","tmp=s","static-client","static-server","static-perl","no-perl","local-perl","perl-options=s","sur","with-small-disk","dbd-options=s","tcpip","suffix=s","build-thread=i","innodb","bdb","use-old-distribution","enable-shared","no-crash-me","no-strip","version-suffix=s") || usage(); usage() if ($opt_help || $opt_Information); usage() if (!$opt_distribution); @@ -362,7 +362,7 @@ To set up the environment, like 'CC=cc CXX=gcc CXXFLAGS=-O3' Options for Makefile.PL when configuring msql-mysql-modules. --version-suffix suffix -Can be used to set a suffix (normally com or -max) for a distribution +Can be used to set a suffix (normally 'com' or '-max') for a distribution --with-low-memory Use less memory when compiling. From 61b769d94a9bbbea987ce4fb3afbe1f6d47795cd Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 10 Feb 2002 02:28:24 +0200 Subject: [PATCH 13/17] Fix for customer build --- Build-tools/Do-compile | 4 ++-- Build-tools/mysql-copyright | 4 ++-- sql/mysqld.cc | 9 +++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile index eecd01066e0..fedee8c7774 100755 --- a/Build-tools/Do-compile +++ b/Build-tools/Do-compile @@ -26,7 +26,7 @@ $host=$1 . $opt_suffix; $email="$opt_user\@mysql.com"; $pwd = `pwd`; chomp($pwd); $log="$pwd/Logs/$host$opt_version_suffix.log"; -$opt_distribution =~ /(mysql-[^\/]*)\.tar/; +$opt_distribution =~ /(mysql[^\/]*)\.tar/; $ver=$1; $gcc_version=which("gcc"); if (defined($gcc_version) && ! $opt_config_env) @@ -209,7 +209,7 @@ if ($opt_stage <= 4 && !$opt_no_test) safe_system("gunzip < $tar_file | $tar xf -"); } -$tar_file =~ /(mysql-[^\/]*)\.tar/; +$tar_file =~ /(mysql[^\/]*)\.tar/; $ver=$1; $test_dir="$pwd/$host/test/$ver"; $ENV{"LD_LIBRARY_PATH"}= "$test_dir/lib:" . $ENV{"LD_LIBRARY_PATH"}; diff --git a/Build-tools/mysql-copyright b/Build-tools/mysql-copyright index df819b20fa1..0d49acac400 100755 --- a/Build-tools/mysql-copyright +++ b/Build-tools/mysql-copyright @@ -96,7 +96,7 @@ sub main # remove the 'PUBLIC' file from distribution and copy LICENSE # on the toplevel of the directory instead. file 'PUBLIC' shouldn't # exist in the new mysql distributions, but let's be sure.. - `rm -f $destdir/PUBLIC`; + `rm -f $destdir/PUBLIC $destdir/README`; `cp -p $WD/Docs/LICENSE $destdir/`; # fix file copyrights @@ -129,7 +129,7 @@ sub fix_usage_copyright foreach my $Cfile (@Cfiles) { chop $Cfile; - `replace \"This is free software,\\\\\\nand you are welcome to modify and redistribute it under the GPL license\" \"This is commercial software,\\\\nplease see the file LICENSE for details\" -- $Cfile`; + `replace "This is free software," "This is commercial software," "and you are welcome to modify and redistribute it under the GPL license" "please see the file LICENSE for details" -- $Cfile`; } } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index be20c5fa964..a7c59dc3c7f 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3183,10 +3183,11 @@ static void use_help(void) static void usage(void) { print_version(); - puts("Copyright (C) 2000 MySQL AB & MySQL Finland AB, by Monty and others"); - 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("Starts the MySQL server\n"); + puts("\ +Copyright (C) 2000 MySQL AB, by Monty and others\n\ +This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\ +and you are welcome to modify and redistribute it under the GPL license\n\ +Starts the MySQL server\n"); printf("Usage: %s [OPTIONS]\n", my_progname); puts("\n\ From e370bdeeb6a3cf1c6b44e91851a1dbcc859f0f90 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 10 Feb 2002 04:50:46 +0200 Subject: [PATCH 14/17] srv0srv.c: If the default character set was set to non-latin1 then the collation order of DATA_CHAR and DATA_VARCHAR was not defined, and foreign key system tables did not work, because they contain DATA_VARCHAR columns innobase/srv/srv0srv.c: If the default character set was set to non-latin1 then the collation order of DATA_CHAR and DATA_VARCHAR was not defined, and foreign key system tables did not work, because they contain DATA_VARCHAR columns --- innobase/srv/srv0srv.c | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index 77e3ee03a21..553c012bf85 100644 --- a/innobase/srv/srv0srv.c +++ b/innobase/srv/srv0srv.c @@ -92,8 +92,43 @@ ibool srv_log_archive_on = TRUE; ulint srv_log_buffer_size = ULINT_MAX; /* size in database pages */ ibool srv_flush_log_at_trx_commit = TRUE; -byte srv_latin1_ordering[256]; /* The sort order table of the latin1 - character set */ +byte srv_latin1_ordering[256] /* The sort order table of the latin1 + character set. The following table is + the MySQL order as of Feb 10th, 2002 */ += { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 +, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F +, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 +, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F +, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27 +, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F +, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37 +, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F +, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47 +, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F +, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57 +, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F +, 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47 +, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F +, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57 +, 0x58, 0x59, 0x5A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F +, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87 +, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F +, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97 +, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F +, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7 +, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF +, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7 +, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF +, 0x41, 0x41, 0x41, 0x41, 0x5C, 0x5B, 0x5C, 0x43 +, 0x45, 0x45, 0x45, 0x45, 0x49, 0x49, 0x49, 0x49 +, 0x44, 0x4E, 0x4F, 0x4F, 0x4F, 0x4F, 0x5D, 0xD7 +, 0xD8, 0x55, 0x55, 0x55, 0x59, 0x59, 0xDE, 0xDF +, 0x41, 0x41, 0x41, 0x41, 0x5C, 0x5B, 0x5C, 0x43 +, 0x45, 0x45, 0x45, 0x45, 0x49, 0x49, 0x49, 0x49 +, 0x44, 0x4E, 0x4F, 0x4F, 0x4F, 0x4F, 0x5D, 0xF7 +, 0xD8, 0x55, 0x55, 0x55, 0x59, 0x59, 0xDE, 0xFF +}; ibool srv_use_native_aio = FALSE; From c1caaf756f1b83a805505344240f74383aba9642 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 10 Feb 2002 12:47:37 +0200 Subject: [PATCH 15/17] Fixed bug in full join with many NULL fields. Build-tools/Do-compile: Fixed 'touch' and 'chmod' of files. Docs/manual.texi: Changelog --- Build-tools/Do-compile | 7 +++++-- Docs/manual.texi | 11 ++++++++++- mysql-test/r/join.result | 3 +++ mysql-test/t/join.test | 24 ++++++++++++++++++++++++ sql/sql_select.cc | 10 +++++----- 5 files changed, 47 insertions(+), 8 deletions(-) diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile index fedee8c7774..0ab631a4161 100755 --- a/Build-tools/Do-compile +++ b/Build-tools/Do-compile @@ -108,7 +108,7 @@ $|=1; select STDOUT; $|=1; -safe_cd("$host"); +safe_cd($host); if ($opt_stage == 0 && ! $opt_use_old_distribution) { safe_system("gunzip < $opt_distribution | $tar xf -"); @@ -118,6 +118,7 @@ if ($opt_stage == 0 && ! $opt_use_old_distribution) system("touch timestamp; find . -newer timestamp -print | xargs touch; rm -f timestamp"); sleep(2); # Ensure that files we don't want to rebuild are newer than other files + safe_cd($ver); foreach $name ("configure", "Docs/include.texi", "Docs/*.html", "Docs/manual.txt", "Docs/mysql.info", @@ -125,9 +126,11 @@ if ($opt_stage == 0 && ! $opt_use_old_distribution) { system("touch $name"); } + # Fix some file modes in BDB tables that makes life harder. + system("chmod -R u+rw ."); } -safe_cd($ver); +safe_cd("$pwd/$host/$ver"); if ($opt_stage <= 1) { $opt_config_options.=" --with-low-memory" if ($opt_with_low_memory); diff --git a/Docs/manual.texi b/Docs/manual.texi index 524e68d2f1f..12949abeb97 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46833,6 +46833,7 @@ users use this code as the rest of the code and because of this we are not yet 100% confident in this code. @menu +* News-3.23.49:: * News-3.23.48:: Changes in release 3.23.48 * News-3.23.47:: Changes in release 3.23.47 * News-3.23.46:: Changes in release 3.23.46 @@ -46885,7 +46886,15 @@ not yet 100% confident in this code. * News-3.23.0:: Changes in release 3.23.0 @end menu -@node News-3.23.48, News-3.23.47, News-3.23.x, News-3.23.x +@node News-3.23.49, News-3.23.48, News-3.23.x, News-3.23.x +@appendixsubsec Changes in release 3.23.49 +@itemize @bullet +@item +Fixed unlikely caching bug when doing a join without keys. In this case +the last used field for a table always returned @code{NULL}. +@end itemize + +@node News-3.23.48, News-3.23.47, News-3.23.49, News-3.23.x @appendixsubsec Changes in release 3.23.48 @itemize @bullet @item diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result index 6c7284e4a37..c99c63245dd 100644 --- a/mysql-test/r/join.result +++ b/mysql-test/r/join.result @@ -31,3 +31,6 @@ COUNT(t1.Title) 1 COUNT(t1.Title) 1 +t1_id t2_id type cost_unit min_value max_value t3_id item_id id name +22 1 Percent Cost 100 -1 6 291 1 s1 +23 1 Percent Cost 100 -1 21 291 1 s1 diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test index 32ce4947b91..9db520a5edf 100644 --- a/mysql-test/t/join.test +++ b/mysql-test/t/join.test @@ -194,3 +194,27 @@ t3.Contractor_ID = '999999' OR t3.Contractor_ID = '1') AND t3.CanRead='1' AND t3.Active='1'; drop table t1,t2,t3; + +# +# Bug when doing full join and NULL fields. +# + +CREATE TABLE t1 ( + t1_id int(11) default NULL, + t2_id int(11) default NULL, + type enum('Cost','Percent') default NULL, + cost_unit enum('Cost','Unit') default NULL, + min_value double default NULL, + max_value double default NULL, + t3_id int(11) default NULL, + item_id int(11) default NULL +) TYPE=MyISAM; +INSERT INTO t1 VALUES (12,5,'Percent','Cost',-1,0,-1,-1),(14,4,'Percent','Cost',-1,0,-1,-1),(18,5,'Percent','Cost',-1,0,-1,-1),(19,4,'Percent','Cost',-1,0,-1,-1),(20,5,'Percent','Cost',100,-1,22,291),(21,5,'Percent','Cost',100,-1,18,291),(22,1,'Percent','Cost',100,-1,6,291),(23,1,'Percent','Cost',100,-1,21,291),(24,1,'Percent','Cost',100,-1,9,291),(25,1,'Percent','Cost',100,-1,4,291),(26,1,'Percent','Cost',100,-1,20,291),(27,4,'Percent','Cost',100,-1,7,202),(28,1,'Percent','Cost',50,-1,-1,137),(29,2,'Percent','Cost',100,-1,4,354),(30,2,'Percent','Cost',100,-1,9,137),(93,2,'Cost','Cost',-1,10000000,-1,-1); +CREATE TABLE t2 ( + id int(10) unsigned NOT NULL auto_increment, + name varchar(255) default NULL, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO t2 VALUES (1,'s1'),(2,'s2'),(3,'s3'),(4,'s4'),(5,'s5'); +select t1.*, t2.* from t1, t2 where t2.id=t1.t2_id limit 2; +drop table t1,t2; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 57053b87fa6..1ee0d84e182 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -5636,10 +5636,10 @@ SORT_FIELD *make_unireg_sortorder(ORDER *order, uint *length) /***************************************************************************** -** Fill join cache with packed records -** Records are stored in tab->cache.buffer and last record in -** last record is stored with pointers to blobs to support very big -** records + Fill join cache with packed records + Records are stored in tab->cache.buffer and last record in + last record is stored with pointers to blobs to support very big + records ******************************************************************************/ static int @@ -5701,7 +5701,7 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count) if (null_fields && tables[i].table->null_fields) { /* must copy null bits */ copy->str=(char*) tables[i].table->null_flags; - copy->length=(tables[i].table->null_fields+7)/8; + copy->length=tables[i].table->null_bytes; copy->strip=0; copy->blob_field=0; length+=copy->length; From 5081986810e6d88853e18457c1fb997b865c5604 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 10 Feb 2002 20:28:58 +0200 Subject: [PATCH 16/17] Remove uage of static variable from file locks. mysql-test/mysql-test-run.sh: Cleanup --- mysql-test/mysql-test-run.sh | 1 - sql/my_lock.c | 17 +++++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index daf8b8abd03..09cdab9664b 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -266,7 +266,6 @@ fi [ -z "$COLUMNS" ] && COLUMNS=80 E=`$EXPR $COLUMNS - 8` -#DASH72=`$EXPR substr '------------------------------------------------------------------------' 1 $E` DASH72=`$ECHO '------------------------------------------------------------------------'|$CUT -c 1-$E` # on source dist, we pick up freshly build executables diff --git a/sql/my_lock.c b/sql/my_lock.c index 7025682d40e..647c07a03c3 100644 --- a/sql/my_lock.c +++ b/sql/my_lock.c @@ -26,10 +26,6 @@ #include #include -#ifdef HAVE_FCNTL -static struct flock lock; /* Must be static for sun-sparc */ -#endif - /* Lock a part of a file */ int my_lock(File fd,int locktype,my_off_t start,my_off_t length,myf MyFlags) @@ -37,24 +33,25 @@ int my_lock(File fd,int locktype,my_off_t start,my_off_t length,myf MyFlags) thr_alarm_t alarmed; ALARM alarm_buff; uint wait_for_alarm; + struct flock m_lock; DBUG_ENTER("my_lock"); DBUG_PRINT("my",("Fd: %d Op: %d start: %ld Length: %ld MyFlags: %d", fd,locktype,(ulong) start,(ulong) length,MyFlags)); if (my_disable_locking) DBUG_RETURN(0); /* purecov: inspected */ - lock.l_type=(short) locktype; - lock.l_whence=0L; - lock.l_start=(long) start; - lock.l_len=(long) length; + m_lock.l_type=(short) locktype; + m_lock.l_whence=0L; + m_lock.l_start=(long) start; + m_lock.l_len=(long) length; wait_for_alarm=(MyFlags & MY_DONT_WAIT ? MY_HOW_OFTEN_TO_ALARM : (uint) 12*60*60); - if (fcntl(fd,F_SETLK,&lock) != -1) /* Check if we can lock */ + if (fcntl(fd,F_SETLK,&m_lock) != -1) /* Check if we can lock */ DBUG_RETURN(0); /* Ok, file locked */ DBUG_PRINT("info",("Was locked, trying with alarm")); if (!thr_alarm(&alarmed,wait_for_alarm,&alarm_buff)) { int value; - while ((value=fcntl(fd,F_SETLKW,&lock)) && !thr_got_alarm(&alarmed) && + while ((value=fcntl(fd,F_SETLKW,&m_lock)) && !thr_got_alarm(&alarmed) && errno == EINTR) ; thr_end_alarm(&alarmed); if (value != -1) From 501650c5b16a4c7cf7b673b19f9a2ae9c319e24f Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 11 Feb 2002 12:56:48 +0200 Subject: [PATCH 17/17] Updated changelog of 3.23.48 with InnoDB changes. sql/sql_table.cc: Fixed comment --- Docs/manual.texi | 39 +++++++++++++++++++++++++++++++++++---- sql/sql_table.cc | 4 ++-- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index 12949abeb97..a705340fe86 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46833,7 +46833,7 @@ users use this code as the rest of the code and because of this we are not yet 100% confident in this code. @menu -* News-3.23.49:: +* News-3.23.49:: Changes in release 3.23.49 * News-3.23.48:: Changes in release 3.23.48 * News-3.23.47:: Changes in release 3.23.47 * News-3.23.46:: Changes in release 3.23.46 @@ -46908,10 +46908,41 @@ Some InnoDB variables was always shown in @code{SHOW VARIABLES} as @code{OFF} on high-byte-first systems (like sparc). @item Fixed problem with one thread using an InnoDB table and another -thread doing an @code{ALTER TABLE} on the same table. +thread doing an @code{ALTER TABLE} on the same table. Before that, +mysqld could crash with an assertion failure in row0row.c, line 474. @item -If inserts to several tables containing an auto-inc column are wrapped -inside one @code{LOCK TABLES}, InnoDB asserted in @code{lock0lock.c}. +Tuned the InnoDB SQL optimizer to favor more often index searches +over table scans. +@item +Fixed a performance problem with InnoDB tables when several large SELECT +queries are run concurrently on a multiprocessor Linux computer. Large +CPU-bound SELECT queries will now also generally run faster on all +platforms. +@item +If MySQL binlogging is used, InnoDB now prints after crash recovery the +latest MySQL binlog name and the offset InnoDB was able to recover +to. This is useful, for example, when resynchronizing a master and a +slave database in replication. +@item +Added better error messages to help in installation problems of InnoDB tables. +@item +One can now recover also MySQL temporary tables which have become +orphaned inside the InnoDB tablespace. +@item +InnoDB now prevents a @code{FOREIGN KEY} declaration where the signedness +is not the same in the referencing and referenced integer columns. +@item +Calling @code{SHOW CREATE TABLE} or @code{SHOW TABLE STATUS} could cause +memory corruption and make mysqld to crash. Especially at risk was +@code{mysqldump}, because it calls frequently @code{SHOW CREATE TABLE}. +@item +If inserts to several tables containing an auto-inc column were wrapped +inside one @code{LOCK TABLES}, InnoDB asserted in lock0lock.c. +@item +In 3.23.47 we allowed several @code{NULLS} in a @code{UNIQUE} secondary +index for an InnoDB table. But @code{CHECK TABLE} was not relaxed: it +reports the table as corrupt. @code{CHECK TABLE} no longer complains in +this situation. @item @code{SHOW GRANTS} now shows @code{REFERENCES} instead of @code{REFERENCE}. @end itemize diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 62ebf04a9f3..7b5fc5797c9 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1574,8 +1574,8 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, #endif { /* - Win32 and InnoDB can't rename an open table, so we must close - the original table at before doing the rename + Win32 and InnoDB can't drop a table that is in use, so we must + close all the original table at before doing the rename */ table_name=thd->strdup(table_name); // must be saved if (close_cached_table(thd,table))