Below is the list of changes that have just been committed into a local
5.1 repository of mikron. When mikron 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.1887 05/07/18 10:06:58 mronstrom@stripped +14 -0
Manual merge
sql/share/errmsg.txt
1.40 05/07/18 10:06:48 mronstrom@stripped +2 -2
Manual merge
sql/table.h
1.103 05/07/18 10:03:59 mronstrom@stripped +0 -0
Auto merged
sql/sql_yacc.yy
1.402 05/07/18 10:03:58 mronstrom@stripped +0 -0
Auto merged
sql/sql_update.cc
1.166 05/07/18 10:03:58 mronstrom@stripped +0 -0
Auto merged
sql/sql_table.cc
1.258 05/07/18 10:03:57 mronstrom@stripped +0 -0
Auto merged
sql/sql_select.h
1.93 05/07/18 10:03:57 mronstrom@stripped +0 -0
Auto merged
sql/sql_select.cc
1.351 05/07/18 10:03:57 mronstrom@stripped +0 -0
Auto merged
sql/sql_lex.h
1.189 05/07/18 10:03:56 mronstrom@stripped +0 -0
Auto merged
sql/sql_lex.cc
1.155 05/07/18 10:03:56 mronstrom@stripped +0 -0
Auto merged
sql/sql_base.cc
1.259 05/07/18 10:03:56 mronstrom@stripped +0 -0
Auto merged
sql/sp.cc
1.83 05/07/18 10:03:55 mronstrom@stripped +0 -0
Auto merged
sql/mysql_priv.h
1.317 05/07/18 10:03:55 mronstrom@stripped +0 -0
Auto merged
sql/field.cc
1.277 05/07/18 10:03:55 mronstrom@stripped +0 -0
Auto merged
configure.in
1.281 05/07/18 10:03:54 mronstrom@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: mronstrom
# Host: c-7008e253.1238-1-64736c10.cust.bredbandsbolaget.se
# Root: /Users/mikron/wl1354/RESYNC
--- 1.276/sql/field.cc 2005-07-14 10:20:51 +02:00
+++ 1.277/sql/field.cc 2005-07-18 10:03:55 +02:00
@@ -47,6 +47,8 @@
const char field_separator=',';
#define DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE 320
+#define BLOB_PACK_LENGTH_TO_MAX_LENGH(arg) \
+((ulong) ((LL(1) << min(arg, 4) * 8) - LL(1)))
/*
Rules for merging different types of fields in UNION
@@ -6700,7 +6702,7 @@
enum utype unireg_check_arg, const char *field_name_arg,
struct st_table *table_arg,uint blob_pack_length,
CHARSET_INFO *cs)
- :Field_longstr(ptr_arg, (1L << min(blob_pack_length,3)*8)-1L,
+ :Field_longstr(ptr_arg, BLOB_PACK_LENGTH_TO_MAX_LENGH(blob_pack_length),
null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg,
table_arg, cs),
packlength(blob_pack_length)
@@ -8521,7 +8523,8 @@
else
interval=0;
def=0;
- if (!old_field->is_real_null() && ! (flags & BLOB_FLAG) &&
+ if (!(flags & (NO_DEFAULT_VALUE_FLAG | BLOB_FLAG)) &&
+ !old_field->is_real_null() &&
old_field->ptr && orig_field)
{
char buff[MAX_FIELD_WIDTH],*pos;
--- 1.316/sql/mysql_priv.h 2005-07-14 00:30:54 +02:00
+++ 1.317/sql/mysql_priv.h 2005-07-18 10:03:55 +02:00
@@ -747,7 +747,7 @@
bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create);
TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update);
TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT* mem,
- bool *refresh);
+ bool *refresh, uint flags);
TABLE *reopen_name_locked_table(THD* thd, TABLE_LIST* table);
TABLE *find_locked_table(THD *thd, const char *db,const char *table_name);
bool reopen_table(TABLE *table,bool locked);
--- 1.258/sql/sql_base.cc 2005-07-14 00:30:56 +02:00
+++ 1.259/sql/sql_base.cc 2005-07-18 10:03:56 +02:00
@@ -542,10 +542,9 @@
bool close_thread_table(THD *thd, TABLE **table_ptr)
{
- DBUG_ENTER("close_thread_table");
-
bool found_old_table= 0;
TABLE *table= *table_ptr;
+ DBUG_ENTER("close_thread_table");
DBUG_ASSERT(table->key_read == 0);
DBUG_ASSERT(table->file->inited == handler::NONE);
@@ -972,18 +971,34 @@
}
-/******************************************************************************
-** open a table
-** Uses a cache of open tables to find a table not in use.
-** If refresh is a NULL pointer, then the is no version number checking and
-** the table is not put in the thread-open-list
-** If the return value is NULL and refresh is set then one must close
-** all tables and retry the open
-******************************************************************************/
+/*
+ Open a table.
+
+ SYNOPSIS
+ open_table()
+ thd Thread context
+ table_list Open first table in list
+ refresh Pointer to memory that will be set to 1 if
+ we need to close all tables and reopen them
+ If this is a NULL pointer, then the is no version
+ number checking and the table is not put in the
+ thread-open-list
+ flags Bitmap of flags to modify how open works:
+ MYSQL_LOCK_IGNORE_FLUSH - Open table even if someone
+ has done a flush or namelock on it.
+
+ IMPLEMENTATION
+ Uses a cache of open tables to find a table not in use.
+
+ RETURN
+ NULL Open failed. If refresh is set then one should close
+ all other tables and retry the open
+ # Success. Pointer to TABLE object for open table.
+*/
TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
- bool *refresh)
+ bool *refresh, uint flags)
{
reg1 TABLE *table;
char key[MAX_DBKEY_LENGTH];
@@ -1026,6 +1041,8 @@
if (thd->locked_tables || thd->prelocked_mode)
{ // Using table locks
+ TABLE *best_table= 0;
+ int best_distance= INT_MIN, distance;
for (table=thd->open_tables; table ; table=table->next)
{
if (table->s->key_length == key_length &&
@@ -1034,11 +1051,37 @@
table->query_id != thd->query_id && /* skip tables already used by this query */
!(thd->prelocked_mode && table->query_id))
{
- table->query_id= thd->query_id;
- DBUG_PRINT("info",("Using locked table"));
- goto reset;
+ distance= ((int) table->reginfo.lock_type -
+ (int) table_list->lock_type);
+ /*
+ Find a table that either has the exact lock type requested,
+ or has the best suitable lock. In case there is no locked
+ table that has an equal or higher lock than requested,
+ we still maitain the best_table to produce an error message
+ about wrong lock mode on the table. The best_table is changed
+ if bd < 0 <= d or bd < d < 0 or 0 <= d < bd.
+
+ distance < 0 - we have not enough high lock mode
+ distance > 0 - we have lock mode higher then we require
+ distance == 0 - we have lock mode exactly which we need
+ */
+ if (best_distance < 0 && distance > best_distance ||
+ distance >= 0 && distance < best_distance)
+ {
+ best_distance= distance;
+ best_table= table;
+ if (best_distance == 0)
+ break;
+ }
}
}
+ if (best_table)
+ {
+ table= best_table;
+ table->query_id= thd->query_id;
+ DBUG_PRINT("info",("Using locked table"));
+ goto reset;
+ }
/*
is it view?
(it is work around to allow to open view with locked tables,
@@ -1096,9 +1139,16 @@
{
if (table->s->version != refresh_version)
{
+ if (flags & MYSQL_LOCK_IGNORE_FLUSH)
+ {
+ /* Force close at once after usage */
+ thd->version= table->s->version;
+ continue;
+ }
+
/*
- ** There is a refresh in progress for this table
- ** Wait until the table is freed or the thread is killed.
+ There is a refresh in progress for this table
+ Wait until the table is freed or the thread is killed.
*/
close_old_data_files(thd,thd->open_tables,0,0);
if (table->in_use != thd)
@@ -1681,6 +1731,15 @@
if (error == 5)
DBUG_RETURN(0); // we have just opened VIEW
+ /*
+ We can't mark all tables in 'mysql' database as system since we don't
+ allow to lock such tables for writing with any other tables (even with
+ other system tables) and some privilege tables need this.
+ */
+ if (!my_strcasecmp(system_charset_info, db, "mysql") &&
+ !my_strcasecmp(system_charset_info, name, "proc"))
+ entry->s->system_table= 1;
+
if (Table_triggers_list::check_n_load(thd, db, name, entry))
goto err;
@@ -1832,7 +1891,7 @@
}
(*counter)++;
if (!tables->table &&
- !(tables->table= open_table(thd, tables, &new_frm_mem, &refresh)))
+ !(tables->table= open_table(thd, tables, &new_frm_mem, &refresh, 0)))
{
free_root(&new_frm_mem, MYF(MY_KEEP_PREALLOC));
if (tables->view)
@@ -2003,7 +2062,7 @@
thd->current_tablenr= 0;
/* open_ltable can be used only for BASIC TABLEs */
table_list->required_type= FRMTYPE_TABLE;
- while (!(table= open_table(thd, table_list, thd->mem_root, &refresh)) &&
+ while (!(table= open_table(thd, table_list, thd->mem_root, &refresh, 0)) &&
refresh)
;
--- 1.154/sql/sql_lex.cc 2005-07-14 10:20:51 +02:00
+++ 1.155/sql/sql_lex.cc 2005-07-18 10:03:56 +02:00
@@ -145,7 +145,7 @@
lex->found_semicolon= 0;
lex->safe_to_cache_query= 1;
lex->time_zone_tables_used= 0;
- lex->leaf_tables_insert= lex->proc_table= lex->query_tables= 0;
+ lex->leaf_tables_insert= lex->query_tables= 0;
lex->query_tables_last= &lex->query_tables;
lex->variables_used= 0;
lex->select_lex.parent_lex= lex;
@@ -165,7 +165,7 @@
lex->current_select= &lex->select_lex;
lex->yacc_yyss=lex->yacc_yyvs=0;
lex->ignore_space=test(thd->variables.sql_mode & MODE_IGNORE_SPACE);
- lex->sql_command=SQLCOM_END;
+ lex->sql_command= lex->orig_sql_command= SQLCOM_END;
lex->duplicates= DUP_ERROR;
lex->ignore= 0;
lex->sphead= NULL;
@@ -557,6 +557,15 @@
lex->next_state= MY_LEX_START; // Allow signed numbers
if (c == ',')
lex->tok_start=lex->ptr; // Let tok_start point at next item
+ /*
+ Check for a placeholder: it should not precede a possible identifier
+ because of binlogging: when a placeholder is replaced with
+ its value in a query for the binlog, the query must stay
+ grammatically correct.
+ */
+ else if (c == '?' && ((THD*) yythd)->command == COM_STMT_PREPARE &&
+ !ident_map[cs, yyPeek()])
+ return(PARAM_MARKER);
return((int) c);
case MY_LEX_IDENT_OR_NCHAR:
--- 1.188/sql/sql_lex.h 2005-07-14 10:20:52 +02:00
+++ 1.189/sql/sql_lex.h 2005-07-18 10:03:56 +02:00
@@ -720,7 +720,6 @@
function)
*/
TABLE_LIST **query_tables_last;
- TABLE_LIST *proc_table; /* refer to mysql.proc if it was opened by VIEW */
/* store original leaf_tables for INSERT SELECT and PS/SP */
TABLE_LIST *leaf_tables_insert;
/* Partition info structure filled in by PARTITION BY parse part */
--- 1.350/sql/sql_select.cc 2005-07-14 17:17:42 +02:00
+++ 1.351/sql/sql_select.cc 2005-07-18 10:03:57 +02:00
@@ -1927,12 +1927,6 @@
}
-Cursor::~Cursor()
-{
- if (is_open())
- close(FALSE);
-}
-
/*********************************************************************/
/*
@@ -5187,11 +5181,17 @@
DBUG_ASSERT(item->type() == Item::FIELD_ITEM);
Item_field *not_null_item= (Item_field*)item;
JOIN_TAB *referred_tab= not_null_item->field->table->reginfo.join_tab;
- Item_func_isnotnull *notnull;
+ Item *notnull;
if (!(notnull= new Item_func_isnotnull(not_null_item)))
DBUG_VOID_RETURN;
-
- notnull->quick_fix_field();
+ /*
+ We need to do full fix_fields() call here in order to have correct
+ notnull->const_item(). This is needed e.g. by test_quick_select
+ when it is called from make_join_select after this function is
+ called.
+ */
+ if (notnull->fix_fields(join->thd, ¬null))
+ DBUG_VOID_RETURN;
DBUG_EXECUTE("where",print_where(notnull,
referred_tab->table->alias););
add_cond_and_fix(&referred_tab->select_cond, notnull);
--- 1.92/sql/sql_select.h 2005-07-14 00:30:57 +02:00
+++ 1.93/sql/sql_select.h 2005-07-18 10:03:57 +02:00
@@ -409,7 +409,7 @@
void set_unit(SELECT_LEX_UNIT *unit_arg) { unit= unit_arg; }
Cursor(THD *thd);
- ~Cursor();
+ ~Cursor() {}
};
--- 1.257/sql/sql_table.cc 2005-07-14 16:02:47 +02:00
+++ 1.258/sql/sql_table.cc 2005-07-18 10:03:57 +02:00
@@ -753,10 +753,15 @@
Convert the default value from client character
set into the column character set if necessary.
*/
- if (sql_field->def)
+ if (sql_field->def && cs != sql_field->def->collation.collation)
{
- sql_field->def=
- sql_field->def->safe_charset_converter(cs);
+ if (!(sql_field->def=
+ sql_field->def->safe_charset_converter(cs)))
+ {
+ /* Could not convert */
+ my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name);
+ DBUG_RETURN(-1);
+ }
}
if (sql_field->sql_type == FIELD_TYPE_SET)
@@ -1828,7 +1833,7 @@
create_info, *extra_fields, *keys, 0,
select_field_count))
{
- if (!(table= open_table(thd, create_table, thd->mem_root, (bool*) 0)))
+ if (!(table= open_table(thd, create_table, thd->mem_root, (bool*)0, 0)))
quick_rm_table(create_info->db_type, create_table->db,
table_case_name(create_info, create_table->table_name));
}
@@ -3692,7 +3697,7 @@
bzero((void*) &tbl, sizeof(tbl));
tbl.db= new_db;
tbl.table_name= tbl.alias= tmp_name;
- new_table= open_table(thd, &tbl, thd->mem_root, 0);
+ new_table= open_table(thd, &tbl, thd->mem_root, 0, 0);
}
else
{
--- 1.165/sql/sql_update.cc 2005-07-14 12:28:16 +02:00
+++ 1.166/sql/sql_update.cc 2005-07-18 10:03:58 +02:00
@@ -349,6 +349,8 @@
break;
}
}
+ else
+ table->file->unlock_row();
}
if (thd->killed && !error)
error= 1; // Aborted
--- 1.401/sql/sql_yacc.yy 2005-07-14 16:02:48 +02:00
+++ 1.402/sql/sql_yacc.yy 2005-07-18 10:03:58 +02:00
@@ -472,6 +472,7 @@
%token PARTITION_SYM
%token PARTITIONS_SYM
%token PASSWORD
+%token PARAM_MARKER
%token PHASE_SYM
%token POINTFROMTEXT
%token POINT_SYM
@@ -7362,23 +7363,15 @@
;
param_marker:
- '?'
+ PARAM_MARKER
{
THD *thd=YYTHD;
LEX *lex= thd->lex;
- if (thd->command == COM_STMT_PREPARE)
- {
- Item_param *item= new Item_param((uint) (lex->tok_start -
- (uchar *) thd->query));
- if (!($$= item) || lex->param_list.push_back(item))
- {
- my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
- YYABORT;
- }
- }
- else
+ Item_param *item= new Item_param((uint) (lex->tok_start -
+ (uchar *) thd->query));
+ if (!($$= item) || lex->param_list.push_back(item))
{
- yyerror(ER(ER_SYNTAX_ERROR));
+ my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
YYABORT;
}
}
--- 1.102/sql/table.h 2005-07-13 11:48:04 +02:00
+++ 1.103/sql/table.h 2005-07-18 10:03:59 +02:00
@@ -21,6 +21,7 @@
class GRANT_TABLE;
class st_select_lex_unit;
class st_select_lex;
+class partition_info;
class COND_EQUAL;
/* Order clause list element */
@@ -96,6 +97,9 @@
typedef struct st_table_share
{
+#ifdef HAVE_PARTITION_DB
+ partition_info *part_info; /* Partition related information */
+#endif
/* hash of field names (contains pointers to elements of field array) */
HASH name_hash; /* hash of field names */
MEM_ROOT mem_root;
@@ -203,6 +207,8 @@
ORDER *group;
const char *alias; /* alias or table name */
uchar *null_flags;
+ MY_BITMAP *read_set;
+ MY_BITMAP *write_set;
query_id_t query_id;
ha_rows quick_rows[MAX_KEY];
@@ -256,6 +262,7 @@
my_bool auto_increment_field_not_null;
my_bool insert_or_update; /* Can be used by the handler */
my_bool alias_name_used; /* true if table_name is alias */
+ my_bool get_fields_in_item_tree; /* Signal to fix_field */
REGINFO reginfo; /* field connections */
MEM_ROOT mem_root;
--- 1.39/sql/share/errmsg.txt 2005-07-13 12:20:38 +02:00
+++ 1.40/sql/share/errmsg.txt 2005-07-18 10:06:48 +02:00
@@ -5370,3 +5370,81 @@
eng "Scale may not be larger than the precision (column '%-.64s')."
ER_WRONG_LOCK_OF_SYSTEM_TABLE
eng "You can't combine write-locking of system '%-.64s.%-.64s' table with other tables"
+ER_PARTITION_REQUIRES_VALUES_ERROR
+ eng "%s PARTITIONING requires definition of VALUES %s for each partition"
+ER_PARTITION_WRONG_VALUES_ERROR
+ eng "Only %s PARTITIONING can use VALUES %s in partition definition"
+ER_PARTITION_MAXVALUE_ERROR
+ eng "MAXVALUE can only be used in last partition definition"
+ER_PARTITION_SUBPARTITION_ERROR
+ eng "Subpartitions can only be hash partitions and by key"
+ swe "Subpartitioner kan bara vara hash och key partitioner"
+ER_PARTITION_WRONG_NO_PART_ERROR
+ eng "Wrong number of partitions defined, mismatch with previous setting"
+ER_PARTITION_WRONG_NO_SUBPART_ERROR
+ eng "Wrong number of subpartitions defined, mismatch with previous setting"
+ER_CONST_EXPR_IN_PARTITION_FUNC_ERROR
+ eng "Constant/Random expression in (sub)partitioning function is not allowed"
+ER_NO_CONST_EXPR_IN_RANGE_OR_LIST_ERROR
+ eng "Expression in RANGE/LIST VALUES must be constant"
+ER_FIELD_NOT_FOUND_PART_ERROR
+ eng "Field in list of fields for partition function not found in table"
+ER_LIST_OF_FIELDS_ONLY_IN_HASH_ERROR
+ eng "List of fields is only allowed in KEY partitions"
+ER_INCONSISTENT_PARTITION_INFO_ERROR
+ eng "The partition info in the frm file is not consistent with what can be written into the frm file"
+ER_PARTITION_FUNC_NOT_ALLOWED_ERROR
+ eng "The %s function returns the wrong type"
+ swe "%s-funktionen returnerar felaktig typ"
+ER_PARTITIONS_MUST_BE_DEFINED_ERROR
+ eng "For %s partitions each partition must be defined"
+ER_RANGE_NOT_INCREASING_ERROR
+ eng "VALUES LESS THAN value must be strictly increasing for each partition"
+ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR
+ eng "VALUES %s value must be of same type as partition function"
+ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR
+ eng "Multiple definition of same constant in list partitioning"
+ swe "Multipel definition av samma konstant i list partitionering"
+ER_PARTITION_ENTRY_ERROR
+ eng "Partitioning can not be used stand-alone in query"
+ER_MIX_HANDLER_ERROR
+ eng "The mix of handlers in the partitions is not allowed in this version in MySQL"
+ER_PARTITION_NOT_DEFINED_ERROR
+ eng "For the partitioned engine it is necessary to define all %s"
+ER_TOO_MANY_PARTITIONS_ERROR
+ eng "Too many partitions were defined"
+ER_SUBPARTITION_ERROR
+ eng "It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning"
+ER_CANT_CREATE_HANDLER_FILE
+ eng "Failed to create specific handler file"
+ swe "Misslyckades med att skapa specifik fil i lagringsmotor"
+ER_BLOB_FIELD_IN_PART_FUNC_ERROR
+ eng "A BLOB field is not allowed in partition function"
+ER_CHAR_SET_IN_PART_FIELD_ERROR
+ eng "VARCHAR only allowed if binary collation for partition functions"
+ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF
+ eng "A %s need to include all fields in the partition function"
+ER_NO_PARTS_ERROR
+ eng "Number of %s = 0 is not an allowed value"
--- 1.82/sql/sp.cc 2005-07-13 12:20:38 +02:00
+++ 1.83/sql/sp.cc 2005-07-18 10:03:55 +02:00
@@ -799,7 +799,7 @@
}
}
- table->file->ha_index_init(0);
+ table->file->ha_index_init(0, 1);
if ((res= table->file->index_first(table->record[0])))
{
res= (res == HA_ERR_END_OF_FILE) ? 0 : SP_INTERNAL_ERROR;
@@ -849,7 +849,7 @@
goto err;
ret= SP_OK;
- table->file->ha_index_init(0);
+ table->file->ha_index_init(0, 1);
if (! table->file->index_read(table->record[0],
key, keylen, HA_READ_KEY_EXACT))
{
| Thread |
|---|
| • bk commit into 5.1 tree (mronstrom:1.1887) | mikael | 21 Jul |