Below is the list of changes that have just been committed into a local
5.0 repository of root. When root 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@stripped, 2006-08-11 18:28:39+08:00, dli@stripped +4 -0
Merge dli@stripped:/home/bk/mysql-5.0-ndb-bj
into dev3-76.dev.cn.tlan:/home/lisj/mysql/mysql-5.0/bug-19047
MERGE: 1.2205.15.1
sql/sql_base.cc@stripped, 2006-08-11 18:28:17+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.345.1.1
sql/sql_lex.h@stripped, 2006-08-11 18:28:17+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.222.1.2
sql/sql_view.cc@stripped, 2006-08-11 18:28:34+08:00, dli@stripped +17 -58
MERGE: 1.89.4.1
sql/table.cc@stripped, 2006-08-11 18:28:17+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.227.1.3
# 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: dli
# Host: dev3-76.dev.cn.tlan
# Root: /home/lisj/mysql/mysql-5.0/bug-19047/RESYNC
--- 1.346/sql/sql_base.cc 2006-08-11 18:28:45 +08:00
+++ 1.347/sql/sql_base.cc 2006-08-11 18:28:45 +08:00
@@ -34,7 +34,8 @@
static int open_unireg_entry(THD *thd, TABLE *entry, const char *db,
const char *name, const char *alias,
- TABLE_LIST *table_list, MEM_ROOT *mem_root);
+ TABLE_LIST *table_list, MEM_ROOT *mem_root,
+ uint flags);
static void free_cache_entry(TABLE *entry);
static void mysql_rm_tmp_tables(void);
static bool open_new_frm(THD *thd, const char *path, const char *alias,
@@ -1108,7 +1109,7 @@
key_length=(uint) (strmov(strmov(key,db)+1,table_name)-key)+1;
if (open_unireg_entry(thd, table, db, table_name, table_name, 0,
- thd->mem_root) ||
+ thd->mem_root, 0) ||
!(table->s->table_cache_key= memdup_root(&table->mem_root, (char*) key,
key_length)))
{
@@ -1311,7 +1312,7 @@
VOID(pthread_mutex_lock(&LOCK_open));
if (!open_unireg_entry(thd, table, table_list->db,
table_list->table_name,
- alias, table_list, mem_root))
+ alias, table_list, mem_root, 0))
{
DBUG_ASSERT(table_list->view != 0);
VOID(pthread_mutex_unlock(&LOCK_open));
@@ -1391,6 +1392,7 @@
else
{
TABLE_SHARE *share;
+ int error;
/* Free cache if too big */
while (open_cache.records > table_cache_size && unused_tables)
VOID(hash_delete(&open_cache,(byte*) unused_tables)); /* purecov: tested */
@@ -1401,9 +1403,12 @@
VOID(pthread_mutex_unlock(&LOCK_open));
DBUG_RETURN(NULL);
}
- if (open_unireg_entry(thd, table, table_list->db, table_list->table_name,
- alias, table_list, mem_root) ||
- (!table_list->view &&
+ error= open_unireg_entry(thd, table, table_list->db,
+ table_list->table_name,
+ alias, table_list, mem_root,
+ (flags & OPEN_VIEW_NO_PARSE));
+ if ((error > 0) ||
+ (!table_list->view && !error &&
!(table->s->table_cache_key= memdup_root(&table->mem_root,
(char*) key,
key_length))))
@@ -1413,8 +1418,15 @@
VOID(pthread_mutex_unlock(&LOCK_open));
DBUG_RETURN(NULL);
}
- if (table_list->view)
+ if (table_list->view || error < 0)
{
+ /*
+ VIEW not really opened, only frm were read.
+ Set 1 as a flag here
+ */
+ if (error < 0)
+ table_list->view= (st_lex*)1;
+
my_free((gptr)table, MYF(0));
VOID(pthread_mutex_unlock(&LOCK_open));
DBUG_RETURN(0); // VIEW
@@ -1521,7 +1533,7 @@
safe_mutex_assert_owner(&LOCK_open);
if (open_unireg_entry(table->in_use, &tmp, db, table_name,
- table->alias, 0, table->in_use->mem_root))
+ table->alias, 0, table->in_use->mem_root, 0))
goto end;
free_io_cache(table);
@@ -1851,6 +1863,8 @@
alias Alias name
table_desc TABLE_LIST descriptor (used with views)
mem_root temporary mem_root for parsing
+ flags the OPEN_VIEW_NO_PARSE flag to be passed to
+ openfrm()/open_new_frm()
NOTES
Extra argument for open is taken from thd->open_options
@@ -1861,7 +1875,8 @@
*/
static int open_unireg_entry(THD *thd, TABLE *entry, const char *db,
const char *name, const char *alias,
- TABLE_LIST *table_desc, MEM_ROOT *mem_root)
+ TABLE_LIST *table_desc, MEM_ROOT *mem_root,
+ uint flags)
{
char path[FN_REFLEN];
int error;
@@ -1873,14 +1888,16 @@
(uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE |
HA_GET_INDEX | HA_TRY_READ_ONLY |
NO_ERR_ON_NEW_FRM),
- READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD,
+ READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD |
+ (flags & OPEN_VIEW_NO_PARSE),
thd->open_options, entry)) &&
(error != 5 ||
(fn_format(path, path, 0, reg_ext, MY_UNPACK_FILENAME),
open_new_frm(thd, path, alias, db, name,
(uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE |
HA_GET_INDEX | HA_TRY_READ_ONLY),
- READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD,
+ READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD |
+ (flags & OPEN_VIEW_NO_PARSE),
thd->open_options, entry, table_desc, mem_root))))
{
@@ -1962,7 +1979,7 @@
}
if (error == 5)
- DBUG_RETURN(0); // we have just opened VIEW
+ DBUG_RETURN((flags & OPEN_VIEW_NO_PARSE)? -1 : 0); // we have just opened VIEW
/*
We can't mark all tables in 'mysql' database as system since we don't
@@ -5379,7 +5396,8 @@
my_error(ER_WRONG_OBJECT, MYF(0), db, table_name, "BASE TABLE");
goto err;
}
- if (mysql_make_view(thd, parser, table_desc))
+ if (mysql_make_view(thd, parser, table_desc,
+ (prgflag & OPEN_VIEW_NO_PARSE)))
goto err;
}
else
--- 1.224/sql/sql_lex.h 2006-08-11 18:28:45 +08:00
+++ 1.225/sql/sql_lex.h 2006-08-11 18:28:45 +08:00
@@ -375,7 +375,7 @@
friend class st_select_lex_unit;
friend bool mysql_new_select(struct st_lex *lex, bool move_down);
friend bool mysql_make_view(THD *thd, File_parser *parser,
- TABLE_LIST *table);
+ TABLE_LIST *table, uint flags);
private:
void fast_exclude();
};
--- 1.230/sql/table.cc 2006-08-11 18:28:45 +08:00
+++ 1.231/sql/table.cc 2006-08-11 18:28:45 +08:00
@@ -121,6 +121,8 @@
// caller can't process new .frm
goto err;
}
+ if (prgflag & OPEN_VIEW_NO_PARSE)
+ goto err;
share->blob_ptr_size= sizeof(char*);
outparam->db_stat= db_stat;
--- 1.93/sql/sql_view.cc 2006-08-11 18:28:45 +08:00
+++ 1.94/sql/sql_view.cc 2006-08-11 18:28:45 +08:00
@@ -179,23 +179,15 @@
fill_defined_view_parts (THD *thd, TABLE_LIST *view)
{
LEX *lex= thd->lex;
- bool free_view= 1;
+ bool not_used;
TABLE_LIST decoy;
- if (view->view)
- free_view= 0;
memcpy (&decoy, view, sizeof (TABLE_LIST));
- if ((decoy.table= open_table(thd, &decoy, thd->mem_root, NULL, 0)))
+ if (!open_table(thd, &decoy, thd->mem_root, ¬_used, OPEN_VIEW_NO_PARSE) &&
+ !decoy.view)
{
- /* It's a table */
- my_free((gptr)decoy.table, MYF(0));
- my_error(ER_WRONG_OBJECT, MYF(0), view->db, view->table_name, "VIEW");
return TRUE;
}
- if (!decoy.view)
- /* An error while opening the view occurs, caller will handle it */
- return FALSE;
-
if (!lex->definer)
{
view->definer.host= decoy.definer.host;
@@ -207,11 +199,6 @@
if (lex->create_view_suid == VIEW_SUID_DEFAULT)
lex->create_view_suid= decoy.view_suid ?
VIEW_SUID_DEFINER : VIEW_SUID_INVOKER;
- if (free_view)
- {
- delete decoy.view;
- lex->cleanup_after_one_table_open();
- }
return FALSE;
}
@@ -740,10 +727,8 @@
view->query.str= (char*)str.ptr();
view->query.length= str.length()-1; // we do not need last \0
view->source.str= thd->query + thd->lex->create_view_select_start;
- view->source.length= (char *)skip_rear_comments((uchar *)view->source.str,
- (uchar *)thd->query +
- thd->query_length) -
- view->source.str;
+ view->source.length= (thd->query_length -
+ thd->lex->create_view_select_start);
view->file_version= 1;
view->calc_md5(md5);
view->md5.str= md5;
@@ -830,13 +815,14 @@
thd Thread handler
parser parser object
table TABLE_LIST structure for filling
-
+ flags flags
RETURN
0 ok
1 error
*/
-bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table)
+bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
+ uint flags)
{
SELECT_LEX *end, *view_select;
LEX *old_lex, *lex;
@@ -927,6 +913,10 @@
table->db, table->table_name);
get_default_definer(thd, &table->definer);
}
+ if (flags & OPEN_VIEW_NO_PARSE)
+ {
+ DBUG_RETURN(FALSE);
+ }
/*
Save VIEW parameters, which will be wiped out by derived table
@@ -1297,11 +1287,8 @@
DBUG_ENTER("mysql_drop_view");
char path[FN_REFLEN];
TABLE_LIST *view;
- frm_type_enum type;
+ bool type= 0;
db_type not_used;
- String non_existant_views;
- char *wrong_object_db= NULL, *wrong_object_name= NULL;
- bool error= FALSE;
for (view= views; view; view= view->next_local)
{
@@ -1309,9 +1296,8 @@
view->table_name, reg_ext, NullS);
(void) unpack_filename(path, path);
VOID(pthread_mutex_lock(&LOCK_open));
- type= FRMTYPE_ERROR;
- if (access(path, F_OK) ||
- FRMTYPE_VIEW != (type= mysql_frm_type(thd, path, ¬_used)))
+ if (access(path, F_OK) ||
+ (type= (mysql_frm_type(thd, path, ¬_used) != FRMTYPE_VIEW)))
{
char name[FN_REFLEN];
my_snprintf(name, sizeof(name), "%s.%s", view->db, view->table_name);
@@ -1323,46 +1309,25 @@
VOID(pthread_mutex_unlock(&LOCK_open));
continue;
}
- if (type == FRMTYPE_TABLE)
- {
- if (!wrong_object_name)
- {
- wrong_object_db= view->db;
- wrong_object_name= view->table_name;
- }
- }
+ if (type)
+ my_error(ER_WRONG_OBJECT, MYF(0), view->db, view->table_name, "VIEW");
else
- {
- if (non_existant_views.length())
- non_existant_views.append(',');
- non_existant_views.append(String(view->table_name,system_charset_info));
- }
- VOID(pthread_mutex_unlock(&LOCK_open));
- continue;
+ my_error(ER_BAD_TABLE_ERROR, MYF(0), name);
+ goto err;
}
if (my_delete(path, MYF(MY_WME)))
- error= TRUE;
+ goto err;
query_cache_invalidate3(thd, view, 0);
sp_cache_invalidate();
VOID(pthread_mutex_unlock(&LOCK_open));
}
- if (error)
- {
- DBUG_RETURN(TRUE);
- }
- if (wrong_object_name)
- {
- my_error(ER_WRONG_OBJECT, MYF(0), wrong_object_db, wrong_object_name,
- "VIEW");
- DBUG_RETURN(TRUE);
- }
- if (non_existant_views.length())
- {
- my_error(ER_BAD_TABLE_ERROR, MYF(0), non_existant_views.c_ptr());
- DBUG_RETURN(TRUE);
- }
send_ok(thd);
DBUG_RETURN(FALSE);
+
+err:
+ VOID(pthread_mutex_unlock(&LOCK_open));
+ DBUG_RETURN(TRUE);
+
}
| Thread |
|---|
| • bk commit into 5.0 tree (dli:1.2243) | dli | 11 Aug |