Below is the list of changes that have just been committed into a local
5.2 repository of emurphy. When emurphy does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2178 06/06/05 08:15:28 elliot@stripped +8 -0
Merge mysql.com:/home/emurphy/src/bk-clean/mysql-5.1-new
into mysql.com:/home/emurphy/src/bk-clean/mysql-5.2
sql/sql_yacc.yy
1.467 06/06/05 08:15:22 elliot@stripped +0 -0
Auto merged
sql/share/errmsg.txt
1.91 06/06/05 08:15:22 elliot@stripped +0 -0
Auto merged
sql/item.h
1.199 06/06/05 08:15:21 elliot@stripped +0 -0
Auto merged
sql/item.cc
1.178 06/06/05 08:15:21 elliot@stripped +0 -0
Auto merged
sql/handler.cc
1.224 06/06/05 08:15:21 elliot@stripped +0 -0
Auto merged
sql/ha_innodb.cc
1.266 06/06/05 08:15:21 elliot@stripped +0 -0
Auto merged
mysql-test/mysql-test-run.sh
1.313 06/06/05 08:15:21 elliot@stripped +0 -0
Auto merged
mysql-test/mysql-test-run.pl
1.122 06/06/05 08:15:21 elliot@stripped +0 -0
Auto merged
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: elliot
# Host: scared.(none)
# Root: /home/emurphy/src/bk-clean/mysql-5.2/RESYNC
--- 1.312/mysql-test/mysql-test-run.sh 2006-06-01 22:16:40 -04:00
+++ 1.313/mysql-test/mysql-test-run.sh 2006-06-05 08:15:21 -04:00
@@ -1121,7 +1121,10 @@ mysql_install_db () {
if [ ! -z "$USE_NDBCLUSTER" ]
then
$ECHO "Installing Master Databases 1"
- $INSTALL_DB -1
+# $INSTALL_DB -1
+ $RM -rf var/master-data1
+ mkdir var/master-data1
+ cp -r var/master-data/* var/master-data1
if [ $? != 0 ]; then
error "Could not install master test DBs 1"
exit 1
@@ -1129,7 +1132,9 @@ mysql_install_db () {
fi
$ECHO "Installing Slave Databases"
$RM -rf $SLAVE_MYDDIR $MY_LOG_DIR/*
- $INSTALL_DB -slave
+# $INSTALL_DB -slave
+ mkdir var/slave-data
+ cp -r var/master-data/* var/slave-data
if [ $? != 0 ]; then
error "Could not install slave test DBs"
exit 1
@@ -2155,6 +2160,7 @@ then
# Remove files that can cause problems
$RM -rf $MYSQL_TEST_DIR/var/ndbcluster
+ $RM -rf $MYSQL_TEST_DIR/var/tmp/snapshot*
$RM -f $MYSQL_TEST_DIR/var/run/* $MYSQL_TEST_DIR/var/tmp/*
# Remove old berkeley db log files that can confuse the server
--- 1.223/sql/handler.cc 2006-06-03 23:50:53 -04:00
+++ 1.224/sql/handler.cc 2006-06-05 08:15:21 -04:00
@@ -44,19 +44,20 @@
#include "ha_innodb.h"
#endif
-/* While we have legacy_db_type, we have this array to
- check for dups and to find handlerton from legacy_db_type.
- Remove when legacy_db_type is finally gone */
-static handlerton *installed_htons[128];
+/*
+ While we have legacy_db_type, we have this array to
+ check for dups and to find handlerton from legacy_db_type.
+ Remove when legacy_db_type is finally gone
+*/
st_plugin_int *hton2plugin[MAX_HA];
-#define BITMAP_STACKBUF_SIZE (128/8)
+static handlerton *installed_htons[128];
KEY_CREATE_INFO default_key_create_info= { HA_KEY_ALG_UNDEF, 0, {NullS,0} };
/* static functions defined in this file */
-static handler *create_default(TABLE_SHARE *table);
+static handler *create_default(TABLE_SHARE *table, MEM_ROOT *mem_root);
static SHOW_COMP_OPTION have_yes= SHOW_OPTION_YES;
@@ -126,8 +127,7 @@ handlerton *ha_resolve_by_name(THD *thd,
const char *ha_get_storage_engine(enum legacy_db_type db_type)
{
- switch (db_type)
- {
+ switch (db_type) {
case DB_TYPE_DEFAULT:
return "DEFAULT";
case DB_TYPE_UNKNOWN:
@@ -141,17 +141,16 @@ const char *ha_get_storage_engine(enum l
}
-static handler *create_default(TABLE_SHARE *table)
+static handler *create_default(TABLE_SHARE *table, MEM_ROOT *mem_root)
{
handlerton *hton=ha_resolve_by_legacy_type(current_thd, DB_TYPE_DEFAULT);
- return (hton && hton->create) ? hton->create(table) : NULL;
+ return (hton && hton->create) ? hton->create(table, mem_root) : NULL;
}
handlerton *ha_resolve_by_legacy_type(THD *thd, enum legacy_db_type db_type)
{
- switch (db_type)
- {
+ switch (db_type) {
case DB_TYPE_DEFAULT:
return (thd->variables.table_type != NULL) ?
thd->variables.table_type :
@@ -204,36 +203,23 @@ handlerton *ha_checktype(THD *thd, enum
handler *get_new_handler(TABLE_SHARE *share, MEM_ROOT *alloc,
handlerton *db_type)
{
- handler *file= NULL;
- /*
- handlers are allocated with new in the handlerton create() function
- we need to set the thd mem_root for these to be allocated correctly
- */
- THD *thd= current_thd;
- MEM_ROOT *thd_save_mem_root= thd->mem_root;
- thd->mem_root= alloc;
-
- if (db_type != NULL && db_type->state == SHOW_OPTION_YES &&
db_type->create)
- file= db_type->create(share);
-
- thd->mem_root= thd_save_mem_root;
+ handler *file;
+ DBUG_ENTER("get_new_handler");
+ DBUG_PRINT("enter", ("alloc: 0x%lx", (long) alloc));
- if (!file)
+ if (db_type && db_type->state == SHOW_OPTION_YES &&
db_type->create)
{
- handlerton *def= current_thd->variables.table_type;
- /* Try first with 'default table type' */
- if (db_type != def)
- return get_new_handler(share, alloc, def);
+ if ((file= db_type->create(share, alloc)))
+ file->init();
+ DBUG_RETURN(file);
}
- if (file)
- {
- if (file->ha_initialise())
- {
- delete file;
- file=0;
- }
- }
- return file;
+ /*
+ Try the default table type
+ Here the call to current_thd() is ok as we call this function a lot of
+ times but we enter this branch very seldom.
+ */
+ DBUG_RETURN(get_new_handler(share, alloc,
+ current_thd->variables.table_type));
}
@@ -244,11 +230,13 @@ handler *get_ha_partition(partition_info
DBUG_ENTER("get_ha_partition");
if ((partition= new ha_partition(part_info)))
{
- if (partition->ha_initialise())
+ if (partition->initialise_partition(current_thd->mem_root))
{
delete partition;
partition= 0;
}
+ else
+ partition->init();
}
else
{
@@ -1335,7 +1323,7 @@ int ha_delete_table(THD *thd, handlerton
! (file=get_new_handler(&dummy_share, thd->mem_root, table_type)))
DBUG_RETURN(ENOENT);
- if (lower_case_table_names == 2 && !(file->table_flags() &
HA_FILE_BASED))
+ if (lower_case_table_names == 2 && !(file->ha_table_flags() &
HA_FILE_BASED))
{
/* Ensure that table handler get path in lower case */
strmov(tmp_path, path);
@@ -1418,6 +1406,7 @@ int handler::ha_open(TABLE *table_arg, c
table= table_arg;
DBUG_ASSERT(table->s == table_share);
+ DBUG_ASSERT(alloc_root_inited(&table->mem_root));
if ((error=open(name,mode,test_if_locked)))
{
@@ -1439,106 +1428,23 @@ int handler::ha_open(TABLE *table_arg, c
table->db_stat|=HA_READ_ONLY;
(void) extra(HA_EXTRA_NO_READCHECK); // Not needed in SQL
- DBUG_ASSERT(alloc_root_inited(&table->mem_root));
-
if (!(ref= (byte*) alloc_root(&table->mem_root, ALIGN_SIZE(ref_length)*2)))
{
close();
error=HA_ERR_OUT_OF_MEM;
}
else
- dupp_ref=ref+ALIGN_SIZE(ref_length);
-
- if (ha_allocate_read_write_set(table->s->fields))
- error= 1;
+ dup_ref=ref+ALIGN_SIZE(ref_length);
+ cached_table_flags= table_flags();
}
DBUG_RETURN(error);
}
-int handler::ha_initialise()
-{
- DBUG_ENTER("ha_initialise");
- DBUG_RETURN(FALSE);
-}
-
-
-/*
- Initalize bit maps for used fields
-
- Called from open_table_from_share()
-*/
-
-int handler::ha_allocate_read_write_set(ulong no_fields)
-{
- uint bitmap_size= bitmap_buffer_size(no_fields+1);
- uint32 *read_buf, *write_buf;
- DBUG_ENTER("ha_allocate_read_write_set");
- DBUG_PRINT("enter", ("no_fields = %d", no_fields));
-
- if (!multi_alloc_root(&table->mem_root,
- &read_set, sizeof(MY_BITMAP),
- &write_set, sizeof(MY_BITMAP),
- &read_buf, bitmap_size,
- &write_buf, bitmap_size,
- NullS))
- {
- DBUG_RETURN(TRUE);
- }
- bitmap_init(read_set, read_buf, no_fields+1, FALSE);
- bitmap_init(write_set, write_buf, no_fields+1, FALSE);
- table->read_set= read_set;
- table->write_set= write_set;
- ha_clear_all_set();
- DBUG_RETURN(FALSE);
-}
-
-void handler::ha_clear_all_set()
-{
- DBUG_ENTER("ha_clear_all_set");
- bitmap_clear_all(read_set);
- bitmap_clear_all(write_set);
- bitmap_set_bit(read_set, 0);
- bitmap_set_bit(write_set, 0);
- DBUG_VOID_RETURN;
-}
-
-int handler::ha_retrieve_all_cols()
-{
- DBUG_ENTER("handler::ha_retrieve_all_cols");
- bitmap_set_all(read_set);
- DBUG_RETURN(0);
-}
-
-int handler::ha_retrieve_all_pk()
-{
- DBUG_ENTER("ha_retrieve_all_pk");
- ha_set_primary_key_in_read_set();
- DBUG_RETURN(0);
-}
-
-void handler::ha_set_primary_key_in_read_set()
-{
- ulong prim_key= table->s->primary_key;
- DBUG_ENTER("handler::ha_set_primary_key_in_read_set");
- DBUG_PRINT("info", ("Primary key = %d", prim_key));
- if (prim_key != MAX_KEY)
- {
- KEY_PART_INFO *key_part= table->key_info[prim_key].key_part;
- KEY_PART_INFO *key_part_end= key_part +
- table->key_info[prim_key].key_parts;
- for (;key_part != key_part_end; ++key_part)
- ha_set_bit_in_read_set(key_part->fieldnr);
- }
- DBUG_VOID_RETURN;
-}
-
-
-
/*
Read first row (only) from a table
This is never called for InnoDB or BDB tables, as these table types
- has the HA_NOT_EXACT_COUNT set.
+ has the HA_STATS_RECORDS_IS_EXACT set.
*/
int handler::read_first_row(byte * buf, uint primary_key)
@@ -1554,7 +1460,7 @@ int handler::read_first_row(byte * buf,
scanning the table.
TODO remove the test for HA_READ_ORDER
*/
- if (deleted < 10 || primary_key >= MAX_KEY ||
+ if (stats.deleted < 10 || primary_key >= MAX_KEY ||
!(index_flags(primary_key, 0, 0) & HA_READ_ORDER))
{
(void) ha_rnd_init(1);
@@ -1807,6 +1713,29 @@ void handler::restore_auto_increment()
/*
+ MySQL signal that it changed the column bitmap
+
+ USAGE
+ This is for handlers that needs to setup their own column bitmaps.
+ Normally the handler should set up their own column bitmaps in
+ index_init() or rnd_init() and in any column_bitmaps_signal() call after
+ this.
+
+ The handler is allowd to do changes to the bitmap after a index_init or
+ rnd_init() call is made as after this, MySQL will not use the bitmap
+ for any program logic checking.
+*/
+
+void handler::column_bitmaps_signal()
+{
+ DBUG_ENTER("column_bitmaps_signal");
+ DBUG_PRINT("info", ("read_set: 0x%lx write_set: 0x%lx", table->read_set,
+ table->write_set));
+ DBUG_VOID_RETURN;
+}
+
+
+/*
Reserves an interval of auto_increment values from the handler.
SYNOPSIS
@@ -1822,7 +1751,6 @@ void handler::restore_auto_increment()
If the function sets *first_value to ~(ulonglong)0 it means an error.
If the function sets *nb_reserved_values to ULONGLONG_MAX it means it has
reserved to "positive infinite".
-
*/
void handler::get_auto_increment(ulonglong offset, ulonglong increment,
@@ -1834,6 +1762,9 @@ void handler::get_auto_increment(ulonglo
int error;
(void) extra(HA_EXTRA_KEYREAD);
+ table->mark_columns_used_by_index_no_reset(table->s->next_number_index,
+ table->read_set);
+ column_bitmaps_signal();
index_init(table->s->next_number_index, 1);
if (!table->s->next_number_key_offset)
{ // Autoincrement at key-start
@@ -1873,7 +1804,7 @@ void handler::get_auto_increment(ulonglo
}
-void handler::print_keydupp_error(uint key_nr, const char *msg)
+void handler::print_keydup_error(uint key_nr, const char *msg)
{
/* Write the duplicated key in the error message */
char key[MAX_KEY_LENGTH];
@@ -1930,7 +1861,7 @@ void handler::print_error(int error, myf
uint key_nr=get_dup_key(error);
if ((int) key_nr >= 0)
{
- print_keydupp_error(key_nr, ER(ER_DUP_ENTRY));
+ print_keydup_error(key_nr, ER(ER_DUP_ENTRY));
DBUG_VOID_RETURN;
}
textno=ER_DUP_KEY;
@@ -1941,12 +1872,14 @@ void handler::print_error(int error, myf
uint key_nr= get_dup_key(error);
if ((int) key_nr >= 0)
{
+ uint max_length;
/* Write the key in the error message */
char key[MAX_KEY_LENGTH];
String str(key,sizeof(key),system_charset_info);
/* Table is opened and defined at this point */
key_unpack(&str,table,(uint) key_nr);
- uint max_length= MYSQL_ERRMSG_SIZE-(uint) strlen(ER(ER_FOREIGN_DUPLICATE_KEY));
+ max_length= (MYSQL_ERRMSG_SIZE-
+ (uint) strlen(ER(ER_FOREIGN_DUPLICATE_KEY)));
if (str.length() >= max_length)
{
str.length(max_length-4);
@@ -2355,22 +2288,23 @@ int handler::index_next_same(byte *buf,
}
-void handler::get_dynamic_partition_info(PARTITION_INFO *stat_info, uint part_id)
+void handler::get_dynamic_partition_info(PARTITION_INFO *stat_info,
+ uint part_id)
{
info(HA_STATUS_CONST | HA_STATUS_TIME | HA_STATUS_VARIABLE |
HA_STATUS_NO_LOCK);
- stat_info->records= records;
- stat_info->mean_rec_length= mean_rec_length;
- stat_info->data_file_length= data_file_length;
- stat_info->max_data_file_length= max_data_file_length;
- stat_info->index_file_length= index_file_length;
- stat_info->delete_length= delete_length;
- stat_info->create_time= create_time;
- stat_info->update_time= update_time;
- stat_info->check_time= check_time;
- stat_info->check_sum= 0;
+ stat_info->records= stats.records;
+ stat_info->mean_rec_length= stats.mean_rec_length;
+ stat_info->data_file_length= stats.data_file_length;
+ stat_info->max_data_file_length= stats.max_data_file_length;
+ stat_info->index_file_length= stats.index_file_length;
+ stat_info->delete_length= stats.delete_length;
+ stat_info->create_time= stats.create_time;
+ stat_info->update_time= stats.update_time;
+ stat_info->check_time= stats.check_time;
+ stat_info->check_sum= 0;
if (table_flags() & (ulong) HA_HAS_CHECKSUM)
- stat_info->check_sum= checksum();
+ stat_info->check_sum= checksum();
return;
}
@@ -2414,7 +2348,7 @@ int ha_create_table(THD *thd, const char
name= share.path.str;
if (lower_case_table_names == 2 &&
- !(table.file->table_flags() & HA_FILE_BASED))
+ !(table.file->ha_table_flags() & HA_FILE_BASED))
{
/* Ensure that handler gets name in lower case */
strmov(name_buff, name);
@@ -2493,7 +2427,7 @@ int ha_create_table_from_engine(THD* thd
create_info.table_options|= HA_OPTION_CREATE_FROM_ENGINE;
if (lower_case_table_names == 2 &&
- !(table.file->table_flags() & HA_FILE_BASED))
+ !(table.file->ha_table_flags() & HA_FILE_BASED))
{
/* Ensure that handler gets name in lower case */
my_casedn_str(files_charset_info, path);
@@ -2843,6 +2777,9 @@ int handler::read_multi_range_first(KEY_
multi_range_sorted= sorted;
multi_range_buffer= buffer;
+ table->mark_columns_used_by_index_no_reset(active_index, table->read_set);
+ table->column_bitmaps_set(table->read_set, table->write_set);
+
for (multi_range_curr= ranges, multi_range_end= ranges + range_count;
multi_range_curr < multi_range_end;
multi_range_curr++)
@@ -3085,7 +3022,7 @@ static my_bool exts_handlerton(THD *unus
handlerton *hton= (handlerton *)plugin->data;
handler *file;
if (hton->state == SHOW_OPTION_YES && hton->create &&
- (file= hton->create((TABLE_SHARE*) 0)))
+ (file= hton->create((TABLE_SHARE*) 0, current_thd->mem_root)))
{
List_iterator_fast<char> it(*found_exts);
const char **ext, *old_ext;
@@ -3225,7 +3162,7 @@ namespace {
char const *name;
};
- int table_name_compare(void const *a, void const *b)
+ static int table_name_compare(void const *a, void const *b)
{
st_table_data const *x = (st_table_data const*) a;
st_table_data const *y = (st_table_data const*) b;
@@ -3235,7 +3172,7 @@ namespace {
return res != 0 ? res : strcmp(x->name, y->name);
}
- bool check_table_binlog_row_based(THD *thd, TABLE *table)
+ static bool check_table_binlog_row_based(THD *thd, TABLE *table)
{
static st_table_data const ignore[] = {
{ "mysql", "event" },
@@ -3256,44 +3193,29 @@ namespace {
DBUG_ASSERT(table->s->cached_row_logging_check == 0 ||
table->s->cached_row_logging_check == 1);
- return
- thd->current_stmt_binlog_row_based &&
- thd && (thd->options & OPTION_BIN_LOG) &&
- mysql_bin_log.is_open() &&
- table->s->cached_row_logging_check;
+ return (thd->current_stmt_binlog_row_based &&
+ (thd->options & OPTION_BIN_LOG) &&
+ mysql_bin_log.is_open() &&
+ table->s->cached_row_logging_check);
}
}
-template<class RowsEventT> int binlog_log_row(TABLE* table,
+template<class RowsEventT> int binlog_log_row(TABLE *table,
const byte *before_record,
const byte *after_record)
{
if (table->file->is_injective())
return 0;
bool error= 0;
- THD *const thd= current_thd;
- if (check_table_binlog_row_based(thd, table))
+ if (check_table_binlog_row_based(table->in_use, table))
{
- MY_BITMAP cols;
- /* Potential buffer on the stack for the bitmap */
- uint32 bitbuf[BITMAP_STACKBUF_SIZE/sizeof(uint32)];
- uint n_fields= table->s->fields;
- my_bool use_bitbuf= n_fields <= sizeof(bitbuf)*8;
- if (likely(!(error= bitmap_init(&cols,
- use_bitbuf ? bitbuf : NULL,
- (n_fields + 7) & ~7UL,
- false))))
- {
- bitmap_set_all(&cols);
- error=
- RowsEventT::binlog_row_logging_function(thd, table,
- table->file->has_transactions(),
- &cols, table->s->fields,
- before_record, after_record);
- if (!use_bitbuf)
- bitmap_free(&cols);
- }
+ error=
+ RowsEventT::binlog_row_logging_function(table->in_use, table,
+ table->file->has_transactions(),
+ &table->s->all_set,
+ table->s->fields,
+ before_record, after_record);
}
return error ? HA_ERR_RBR_LOGGING_FAILED : 0;
}
@@ -3354,6 +3276,28 @@ int handler::ha_external_lock(THD *thd,
DBUG_RETURN(0);
}
+
+/*
+ Check handler usage and reset state of file to after 'open'
+*/
+
+int handler::ha_reset()
+{
+ DBUG_ENTER("ha_reset");
+ /* Check that we have called all proper delallocation functions */
+ DBUG_ASSERT((byte*) table->def_read_set.bitmap +
+ table->s->column_bitmap_size ==
+ (char*) table->def_write_set.bitmap);
+ DBUG_ASSERT(bitmap_is_set_all(&table->s->all_set));
+ DBUG_ASSERT(table->key_read == 0);
+ /* ensure that ha_index_end / ha_rnd_end has been called */
+ DBUG_ASSERT(inited == NONE);
+ /* Free cache used by filesort */
+ free_io_cache(table);
+ DBUG_RETURN(reset());
+}
+
+
int handler::ha_write_row(byte *buf)
{
int error;
@@ -3397,10 +3341,26 @@ int handler::ha_delete_row(const byte *b
return 0;
}
+
+
+/*
+ use_hidden_primary_key() is called in case of an update/delete when
+ (table_flags() and HA_PRIMARY_KEY_REQUIRED_FOR_DELETE) is defined
+ but we don't have a primary key
+*/
+
+void handler::use_hidden_primary_key()
+{
+ /* fallback to use all columns in the table to identify row */
+ table->use_all_columns();
+}
+
+
/*
Dummy function which accept information about log files which is not need
by handlers
*/
+
void signal_log_not_needed(struct handlerton, char *log_file)
{
DBUG_ENTER("signal_log_not_needed");
@@ -3408,6 +3368,7 @@ void signal_log_not_needed(struct handle
DBUG_VOID_RETURN;
}
+
#ifdef TRANS_LOG_MGM_EXAMPLE_CODE
/*
Example of transaction log management functions based on assumption that logs
@@ -3460,6 +3421,7 @@ err:
really detect the log status and check that the file is a log of this
handler.
*/
+
enum log_status fl_get_log_status(char *log)
{
MY_STAT stat_buff;
@@ -3567,7 +3529,7 @@ enum handler_create_iterator_result
fl_create_iterator(enum handler_iterator_type type,
struct handler_iterator *iterator)
{
- switch(type){
+ switch(type) {
case HA_TRANSACTLOG_ITERATOR:
return fl_log_iterator_buffer_init(iterator);
default:
--- 1.177/sql/item.cc 2006-06-01 22:17:34 -04:00
+++ 1.178/sql/item.cc 2006-06-05 08:15:21 -04:00
@@ -551,6 +551,23 @@ bool Item_field::find_item_in_field_list
}
+/*
+ Mark field in read_map
+
+ NOTES
+ This is used by filesort to register used fields in a a temporary
+ column read set or to register used fields in a view
+*/
+
+bool Item_field::register_field_in_read_map(byte *arg)
+{
+ TABLE *table= (TABLE *) arg;
+ if (field->table == table || !table)
+ bitmap_set_bit(field->table->read_set, field->field_index);
+ return 0;
+}
+
+
bool Item::check_cols(uint c)
{
if (c != 1)
@@ -790,14 +807,25 @@ CHARSET_INFO *Item::default_charset()
}
+/*
+ Save value in field, but don't give any warnings
+
+ NOTES
+ This is used to temporary store and retrieve a value in a column,
+ for example in opt_range to adjust the key value to fit the column.
+*/
+
int Item::save_in_field_no_warnings(Field *field, bool no_conversions)
{
int res;
- THD *thd= field->table->in_use;
+ TABLE *table= field->table;
+ THD *thd= table->in_use;
enum_check_fields tmp= thd->count_cuted_fields;
+ my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->write_set);
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
res= save_in_field(field, no_conversions);
thd->count_cuted_fields= tmp;
+ dbug_tmp_restore_column_map(table->write_set, old_map);
return res;
}
@@ -2366,7 +2394,8 @@ bool Item_param::set_from_user_var(THD *
CHARSET_INFO *tocs= thd->variables.collation_connection;
uint32 dummy_offset;
- value.cs_info.character_set_of_placeholder= fromcs;
+ value.cs_info.character_set_of_placeholder=
+ value.cs_info.character_set_client= fromcs;
/*
Setup source and destination character sets so that they
are different only if conversion is necessary: this will
@@ -3569,7 +3598,8 @@ bool Item_field::fix_fields(THD *thd, It
Item** res= find_item_in_list(this, thd->lex->current_select->item_list,
&counter, REPORT_EXCEPT_NOT_FOUND,
¬_used);
- if (res != (Item **)not_found_item && (*res)->type() ==
Item::FIELD_ITEM)
+ if (res != (Item **)not_found_item &&
+ (*res)->type() == Item::FIELD_ITEM)
{
set_field((*((Item_field**)res))->field);
return 0;
@@ -3588,7 +3618,7 @@ bool Item_field::fix_fields(THD *thd, It
if it is not expression from merged VIEW we will set this field.
We can leave expression substituted from view for next PS/SP rexecution
- (i.e. do not register this substitution for reverting on cleupup()
+ (i.e. do not register this substitution for reverting on cleanup()
(register_item_tree_changing())), because this subtree will be
fix_field'ed during setup_tables()->setup_underlying() (i.e. before
all other expressions of query, and references on tables which do
@@ -3600,13 +3630,13 @@ bool Item_field::fix_fields(THD *thd, It
return FALSE;
if (!outer_fixed && cached_table && cached_table->select_lex
&&
- context->select_lex &&
- cached_table->select_lex != context->select_lex)
+ context->select_lex &&
+ cached_table->select_lex != context->select_lex)
{
int ret;
if ((ret= fix_outer_field(thd, &from_field, reference)) < 0)
goto error;
- else if (!ret)
+ if (!ret)
return FALSE;
}
@@ -3617,17 +3647,28 @@ bool Item_field::fix_fields(THD *thd, It
set_if_bigger(thd->lex->in_sum_func->max_arg_level,
thd->lex->current_select->nest_level);
}
- else if (thd->set_query_id)
+ else if (thd->mark_used_columns != MARK_COLUMNS_NONE)
{
TABLE *table= field->table;
- table->file->ha_set_bit_in_rw_set(field->fieldnr,
- (bool)(thd->set_query_id-1));
- if (field->query_id != thd->query_id)
- {
- /* We only come here in unions */
- field->query_id=thd->query_id;
- table->used_fields++;
- table->used_keys.intersect(field->part_of_key);
+ MY_BITMAP *current_bitmap, *other_bitmap;
+ if (thd->mark_used_columns == MARK_COLUMNS_READ)
+ {
+ current_bitmap= table->read_set;
+ other_bitmap= table->write_set;
+ }
+ else
+ {
+ current_bitmap= table->write_set;
+ other_bitmap= table->read_set;
+ }
+ if (!bitmap_fast_test_and_set(current_bitmap, field->field_index))
+ {
+ if (!bitmap_is_set(other_bitmap, field->field_index))
+ {
+ /* First usage of column */
+ table->used_fields++; // Used to optimize loops
+ table->used_keys.intersect(field->part_of_key);
+ }
}
}
#ifndef NO_EMBEDDED_ACCESS_CHECKS
@@ -5398,17 +5439,17 @@ void Item_insert_value::print(String *st
void Item_trigger_field::setup_field(THD *thd, TABLE *table,
GRANT_INFO *table_grant_info)
{
- bool save_set_query_id= thd->set_query_id;
+ enum_mark_columns save_mark_used_columns= thd->mark_used_columns;
/* TODO: Think more about consequences of this step. */
- thd->set_query_id= 0;
+ thd->mark_used_columns= MARK_COLUMNS_NONE;
/*
Try to find field by its name and if it will be found
set field_idx properly.
*/
(void)find_field_in_table(thd, table, field_name, (uint) strlen(field_name),
0, &field_idx);
- thd->set_query_id= save_set_query_id;
+ thd->mark_used_columns= save_mark_used_columns;
triggers= table->triggers;
table_grants= table_grant_info;
}
--- 1.198/sql/item.h 2006-06-01 22:17:34 -04:00
+++ 1.199/sql/item.h 2006-06-05 08:15:21 -04:00
@@ -762,7 +762,7 @@ public:
static CHARSET_INFO *default_charset();
virtual CHARSET_INFO *compare_collation() { return NULL; }
- virtual bool walk(Item_processor processor, byte *arg)
+ virtual bool walk(Item_processor processor, bool walk_subquery, byte *arg)
{
return (this->*processor)(arg);
}
@@ -784,7 +784,7 @@ public:
virtual bool collect_item_field_processor(byte * arg) { return 0; }
virtual bool find_item_in_field_list_processor(byte *arg) { return 0; }
virtual bool change_context_processor(byte *context) { return 0; }
- virtual bool reset_query_id_processor(byte *query_id) { return 0; }
+ virtual bool register_field_in_read_map(byte *arg) { return 0; }
/*
Check if a partition function is allowed
SYNOPSIS
@@ -1280,13 +1280,7 @@ public:
Item *get_tmp_table_item(THD *thd);
bool collect_item_field_processor(byte * arg);
bool find_item_in_field_list_processor(byte *arg);
- bool reset_query_id_processor(byte *arg)
- {
- field->query_id= *((query_id_t *) arg);
- if (result_field)
- result_field->query_id= field->query_id;
- return 0;
- }
+ bool register_field_in_read_map(byte *arg);
bool check_partition_func_processor(byte *bool_arg) { return 0; }
void cleanup();
Item_equal *find_item_equal(COND_EQUAL *cond_equal);
@@ -1907,8 +1901,8 @@ public:
{
return ref ? (*ref)->real_item() : this;
}
- bool walk(Item_processor processor, byte *arg)
- { return (*ref)->walk(processor, arg); }
+ bool walk(Item_processor processor, bool walk_subquery, byte *arg)
+ { return (*ref)->walk(processor, walk_subquery, arg); }
void print(String *str);
void cleanup();
Item_field *filed_for_view_update()
@@ -2159,9 +2153,9 @@ public:
int save_in_field(Field *field_arg, bool no_conversions);
table_map used_tables() const { return (table_map)0L; }
- bool walk(Item_processor processor, byte *args)
+ bool walk(Item_processor processor, bool walk_subquery, byte *args)
{
- return arg->walk(processor, args) ||
+ return arg->walk(processor, walk_subquery, args) ||
(this->*processor)(args);
}
@@ -2206,9 +2200,9 @@ public:
}
table_map used_tables() const { return (table_map)0L; }
- bool walk(Item_processor processor, byte *args)
+ bool walk(Item_processor processor, bool walk_subquery, byte *args)
{
- return arg->walk(processor, args) ||
+ return arg->walk(processor, walk_subquery, args) ||
(this->*processor)(args);
}
};
--- 1.90/sql/share/errmsg.txt 2006-06-01 22:17:34 -04:00
+++ 1.91/sql/share/errmsg.txt 2006-06-05 08:15:22 -04:00
@@ -2865,30 +2865,8 @@ ER_WRONG_OUTER_JOIN 42000
swe "Felaktigt referens i OUTER JOIN. Kontrollera ON-uttrycket"
ukr "ðÅÒÅÈÒÅÓÎÁ ΦÓÔØ Õ OUTER JOIN. ðÅÒÅצÒÔÅ ÕÍÏ×Õ ON"
ER_NULL_COLUMN_IN_INDEX 42000
- cze "Sloupec '%-.32s' je pou-B¾it s UNIQUE nebo INDEX, ale není definován jako
NOT NULL"
- dan "Kolonne '%-.32s' bruges som UNIQUE eller INDEX men er ikke defineret som NOT NULL"
- nla "Kolom '%-.64s' wordt gebruikt met UNIQUE of INDEX maar is niet gedefinieerd als NOT
NULL"
- eng "Column '%-.64s' is used with UNIQUE or INDEX but is not defined as NOT NULL"
- jps "Column '%-.64s' ‚ª UNIQUE ‚© INDEX ‚ÅŽg—p‚³‚ê‚Ü‚µ‚½.
‚±‚̃Jƒ‰ƒ€‚Í NOT NULL ‚ƒè‹`‚³‚ê‚Ä‚¢‚Ü‚¹‚ñ.",
- est "Tulp '%-.64s' on kasutusel indeksina, kuid ei ole määratletud kui NOT NULL"
- fre "La colonne '%-.32s' fait partie d'un index UNIQUE ou INDEX mais n'est pas définie
comme NOT NULL"
- ger "Spalte '%-.64s' wurde mit UNIQUE oder INDEX benutzt, ist aber nicht als NOT NULL
definiert"
- greek "Ôï ðåäßï '%-.64s' ÷ñçóéìïðïéåßôáéóáí UNIQUE Þ INDEX áëëÜ äåí Ý÷åé ïñéóèåß óáí NOT
NULL"
- hun "A(z) '%-.64s' oszlop INDEX vagy UNIQUE (egyedi), de a definicioja szerint nem NOT
NULL"
- ita "La colonna '%-.64s' e` usata con UNIQUE o INDEX ma non e` definita come NOT NULL"
- jpn "Column '%-.64s' ¤¬ UNIQUE ¤« INDEX
¤Ç»ÈÍѤµ¤ì¤Þ¤·¤¿.
¤³¤Υ«¥é¥à¤Ï NOT NULL
¤ÈÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó."
- kor "'%-.64s' Ä®·³ÀÌ UNIQUE³ª INDEX¸¦
»ç¿ëÇÏ¿´Áö¸¸ NOT NULLÀÌ Á¤ÀǵÇÁö ¾Ê¾Ò±º¿ä..."
- nor "Column '%-.32s' is used with UNIQUE or INDEX but is not defined as NOT NULL"
- norwegian-ny "Column '%-.32s' is used with UNIQUE or INDEX but is not defined as NOT
NULL"
- pol "Column '%-.32s' is used with UNIQUE or INDEX but is not defined as NOT NULL"
- por "Coluna '%-.64s' é usada com única (UNIQUE) ou índice (INDEX), mas não está definida
como não-nula (NOT NULL)"
- rum "Coloana '%-.64s' e folosita cu UNIQUE sau INDEX dar fara sa fie definita ca NOT
NULL"
- rus "óÔÏÌÂÅÃ '%-.64s' ÉÓÐÏÌØÚÕÅÔÓÑ × UNIQUE ÉÌÉ × INDEX, ÎÏ ÎÅ ÏÐÒÅÄÅÌÅÎ ËÁË NOT NULL"
- serbian "Kolona '%-.64s' je upotrebljena kao 'UNIQUE' ili 'INDEX' ali nije definisana
kao 'NOT NULL'"
- slo "Pole '%-.64s' je pou¾ité s UNIQUE alebo INDEX, ale nie je zadefinované ako
NOT NULL"
- spa "Columna '%-.32s' es usada con UNIQUE o INDEX pero no está definida como NOT NULL"
- swe "Kolumn '%-.32s' är använd med UNIQUE eller INDEX men är inte definerad med NOT
NULL"
- ukr "óÔÏ×ÂÅÃØ '%-.64s' ×ÉËÏÒÉÓÔÏ×Õ¤ÔØÓÑ Ú UNIQUE ÁÂÏ INDEX, ÁÌÅ ÎÅ ×ÉÚÎÁÞÅÎÉÊ ÑË NOT
NULL"
+ eng "Table handler doesn't support NULL in given index. Please change column '%-.64s' to
be NOT NULL or use another handler"
+ swe "Tabell hanteraren kan inte indexera NULL kolumner för den givna index typen. Ändra
'%-.64s' till NOT NULL eller använd en annan hanterare"
ER_CANT_FIND_UDF
cze "Nemohu na-Bèíst funkci '%-.64s'"
dan "Kan ikke læse funktionen '%-.64s'"
--- 1.121/mysql-test/mysql-test-run.pl 2006-06-01 22:16:40 -04:00
+++ 1.122/mysql-test/mysql-test-run.pl 2006-06-05 08:15:21 -04:00
@@ -1943,6 +1943,7 @@ sub install_db ($$) {
mtr_add_arg($args, "--skip-innodb");
mtr_add_arg($args, "--skip-ndbcluster");
mtr_add_arg($args, "--skip-bdb");
+ mtr_add_arg($args, "--tmpdir=.");
if ( ! $opt_netware )
{
--- 1.265/sql/ha_innodb.cc 2006-06-03 23:50:53 -04:00
+++ 1.266/sql/ha_innodb.cc 2006-06-05 08:15:21 -04:00
@@ -204,14 +204,15 @@ static int innobase_rollback(THD* thd, b
static int innobase_rollback_to_savepoint(THD* thd, void *savepoint);
static int innobase_savepoint(THD* thd, void *savepoint);
static int innobase_release_savepoint(THD* thd, void *savepoint);
-static handler *innobase_create_handler(TABLE_SHARE *table);
+static handler *innobase_create_handler(TABLE_SHARE *table,
+ MEM_ROOT *mem_root);
static const char innobase_hton_name[]= "InnoDB";
handlerton innobase_hton;
-static handler *innobase_create_handler(TABLE_SHARE *table)
+static handler *innobase_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
{
- return new ha_innobase(table);
+ return new (mem_root) ha_innobase(table);
}
@@ -804,10 +805,9 @@ ha_innobase::ha_innobase(TABLE_SHARE *ta
HA_NULL_IN_KEY |
HA_CAN_INDEX_BLOBS |
HA_CAN_SQL_HANDLER |
- HA_NOT_EXACT_COUNT |
- HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS |
+ HA_PRIMARY_KEY_REQUIRED_FOR_POSITION |
HA_PRIMARY_KEY_IN_READ_INDEX |
- HA_CAN_GEOMETRY |
+ HA_CAN_GEOMETRY | HA_PARTIAL_COLUMN_READ |
HA_TABLE_SCAN_ON_INDEX),
start_of_scan(0),
num_write_row(0)
@@ -2307,7 +2307,7 @@ ha_innobase::open(
}
}
- block_size = 16 * 1024; /* Index block size in InnoDB: used by MySQL
+ stats.block_size = 16 * 1024; /* Index block size in InnoDB: used by MySQL
in query optimization */
/* Init table lock structure */
@@ -2902,16 +2902,15 @@ ha_innobase::store_key_val_for_row(
/******************************************************************
Builds a 'template' to the prebuilt struct. The template is used in fast
retrieval of just those column values MySQL needs in its processing. */
-static
void
-build_template(
+ha_innobase::build_template(
/*===========*/
row_prebuilt_t* prebuilt, /* in: prebuilt struct */
THD* thd, /* in: current user thread, used
only if templ_type is
ROW_MYSQL_REC_FIELDS */
TABLE* table, /* in: MySQL table */
- ulint templ_type) /* in: ROW_MYSQL_WHOLE_ROW or
+ uint templ_type) /* in: ROW_MYSQL_WHOLE_ROW or
ROW_MYSQL_REC_FIELDS */
{
dict_index_t* index;
@@ -3020,8 +3019,8 @@ build_template(
goto include_field;
}
- if (table->file->ha_get_bit_in_read_set(i+1) ||
- table->file->ha_get_bit_in_write_set(i+1)) {
+ if (bitmap_is_set(table->read_set, i) ||
+ bitmap_is_set(table->write_set, i)) {
/* This field is needed in the query */
goto include_field;
@@ -5405,7 +5404,7 @@ ha_innobase::info(
nor the CHECK TABLE time, nor the UPDATE or INSERT time. */
if (os_file_get_status(path,&stat_info)) {
- create_time = stat_info.ctime;
+ stats.create_time = stat_info.ctime;
}
}
@@ -5433,21 +5432,21 @@ ha_innobase::info(
n_rows++;
}
- records = (ha_rows)n_rows;
- deleted = 0;
- data_file_length = ((ulonglong)
+ stats.records = (ha_rows)n_rows;
+ stats.deleted = 0;
+ stats.data_file_length = ((ulonglong)
ib_table->stat_clustered_index_size)
* UNIV_PAGE_SIZE;
- index_file_length = ((ulonglong)
+ stats.index_file_length = ((ulonglong)
ib_table->stat_sum_of_other_index_sizes)
* UNIV_PAGE_SIZE;
- delete_length = 0;
- check_time = 0;
+ stats.delete_length = 0;
+ stats.check_time = 0;
- if (records == 0) {
- mean_rec_length = 0;
+ if (stats.records == 0) {
+ stats.mean_rec_length = 0;
} else {
- mean_rec_length = (ulong) (data_file_length / records);
+ stats.mean_rec_length = (ulong) (stats.data_file_length / stats.records);
}
}
@@ -5496,9 +5495,9 @@ ha_innobase::info(
if (index->stat_n_diff_key_vals[j + 1] == 0) {
- rec_per_key = records;
+ rec_per_key = stats.records;
} else {
- rec_per_key = (ha_rows)(records /
+ rec_per_key = (ha_rows)(stats.records /
index->stat_n_diff_key_vals[j + 1]);
}
@@ -5553,7 +5552,7 @@ ha_innobase::info(
}
}
- auto_increment_value = auto_inc;
+ stats.auto_increment_value = auto_inc;
}
prebuilt->trx->op_info = (char*)"";
@@ -5948,8 +5947,7 @@ ha_innobase::extra(
/*===============*/
/* out: 0 or error number */
enum ha_extra_function operation)
- /* in: HA_EXTRA_RETRIEVE_ALL_COLS or some
- other flag */
+ /* in: HA_EXTRA_FLUSH or some other flag */
{
row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
@@ -5963,13 +5961,6 @@ ha_innobase::extra(
row_mysql_prebuilt_free_blob_heap(prebuilt);
}
break;
- case HA_EXTRA_RESET:
- if (prebuilt->blob_heap) {
- row_mysql_prebuilt_free_blob_heap(prebuilt);
- }
- prebuilt->keep_other_fields_on_keyread = 0;
- prebuilt->read_just_key = 0;
- break;
case HA_EXTRA_RESET_STATE:
prebuilt->keep_other_fields_on_keyread = 0;
prebuilt->read_just_key = 0;
@@ -5977,16 +5968,6 @@ ha_innobase::extra(
case HA_EXTRA_NO_KEYREAD:
prebuilt->read_just_key = 0;
break;
- case HA_EXTRA_RETRIEVE_ALL_COLS:
- prebuilt->hint_need_to_fetch_extra_cols
- = ROW_RETRIEVE_ALL_COLS;
- break;
- case HA_EXTRA_RETRIEVE_PRIMARY_KEY:
- if (prebuilt->hint_need_to_fetch_extra_cols == 0) {
- prebuilt->hint_need_to_fetch_extra_cols
- = ROW_RETRIEVE_PRIMARY_KEY;
- }
- break;
case HA_EXTRA_KEYREAD:
prebuilt->read_just_key = 1;
break;
@@ -5999,6 +5980,18 @@ ha_innobase::extra(
return(0);
}
+
+int ha_innobase::reset()
+{
+ row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
+ if (prebuilt->blob_heap) {
+ row_mysql_prebuilt_free_blob_heap(prebuilt);
+ }
+ prebuilt->keep_other_fields_on_keyread = 0;
+ prebuilt->read_just_key = 0;
+ return 0;
+}
+
/**********************************************************************
MySQL calls this function at the start of each SQL statement inside LOCK
| Thread |
|---|
| • bk commit into 5.2 tree (elliot:1.2178) | Elliot Murphy | 5 Jun |