Below is the list of changes that have just been committed into a local
5.0 repository of uchum. When uchum 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, 2007-05-29 14:47:58+05:00, gshchepa@stripped +3 -0
Fixed bug #28244.
When the same VIEW was created at the master side twice,
malformed (truncated after the word 'AS') query string
as forwarded to client side, so error messages on the
master and client was different, and replication was
broken.
The mysql_register_view() was failed too early:
fields of `view' output argument of this function
call was not filled yet with correct data.
Checking of existence of VIEW .frm file has been
moved down to the place, when `view' argument is
completely filled with proper data.
mysql-test/r/rpl_view.result@stripped, 2007-05-29 14:32:32+05:00, gshchepa@stripped +7 -0
Updated test case for bug #28244.
mysql-test/t/rpl_view.test@stripped, 2007-05-29 14:32:17+05:00, gshchepa@stripped +14 -0
Updated test case for bug #28244.
sql/sql_view.cc@stripped, 2007-05-29 14:33:34+05:00, gshchepa@stripped +48 -48
Fixed bug #28244.
The mysql_register_view() was failed too early: `view' argument's
fields was not filled yet with data for query replication at that moment.
Checking of existence of VIEW .frm file has been moved to the place, when
`view' argument is completely filled with data.
# 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: gshchepa
# Host: gleb.loc
# Root: /home/uchum/work/bk/mysql-5.0-opt-28244
--- 1.8/mysql-test/r/rpl_view.result 2006-11-03 15:27:32 +04:00
+++ 1.9/mysql-test/r/rpl_view.result 2007-05-29 14:32:32 +05:00
@@ -106,4 +106,11 @@ a b
1 6
drop table t1;
drop view v1;
+CREATE TABLE t1(a INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE VIEW v1 AS SELECT * FROM t1;
+ERROR 42S01: Table 'v1' already exists
+DROP VIEW v1;
+DROP TABLE t1;
+End of 5.0 tests
End of 5.0 tests
--- 1.6/mysql-test/t/rpl_view.test 2006-09-21 03:59:41 +05:00
+++ 1.7/mysql-test/t/rpl_view.test 2007-05-29 14:32:17 +05:00
@@ -149,4 +149,18 @@ drop view v1;
sync_slave_with_master;
+#
+# BUG#28244 CREATE VIEW breaks replication when view exists
+#
+connection master;
+CREATE TABLE t1(a INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+--error ER_TABLE_EXISTS_ERROR
+CREATE VIEW v1 AS SELECT * FROM t1;
+DROP VIEW v1;
+DROP TABLE t1;
+sync_slave_with_master;
+
+--echo End of 5.0 tests
+
--echo End of 5.0 tests
--- 1.110/sql/sql_view.cc 2007-04-24 20:25:51 +05:00
+++ 1.111/sql/sql_view.cc 2007-05-29 14:33:34 +05:00
@@ -719,6 +719,54 @@ static int mysql_register_view(THD *thd,
if (!view->timestamp.str)
view->timestamp.str= view->timestamp_buffer;
+ /* fill structure */
+ 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((char *)view->source.str,
+ (char *)thd->query +
+ thd->query_length) -
+ view->source.str;
+ view->file_version= 1;
+ view->calc_md5(md5);
+ view->md5.str= md5;
+ view->md5.length= 32;
+ can_be_merged= lex->can_be_merged();
+ if (lex->create_view_algorithm == VIEW_ALGORITHM_MERGE &&
+ !lex->can_be_merged())
+ {
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_VIEW_MERGE,
+ ER(ER_WARN_VIEW_MERGE));
+ lex->create_view_algorithm= VIEW_ALGORITHM_UNDEFINED;
+ }
+ view->algorithm= lex->create_view_algorithm;
+ view->definer.user= lex->definer->user;
+ view->definer.host= lex->definer->host;
+ view->view_suid= lex->create_view_suid;
+ view->with_check= lex->create_view_check;
+ if ((view->updatable_view= (can_be_merged &&
+ view->algorithm != VIEW_ALGORITHM_TMPTABLE)))
+ {
+ /* TODO: change here when we will support UNIONs */
+ for (TABLE_LIST *tbl= (TABLE_LIST *)lex->select_lex.table_list.first;
+ tbl;
+ tbl= tbl->next_local)
+ {
+ if ((tbl->view && !tbl->updatable_view) || tbl->schema_table)
+ {
+ view->updatable_view= 0;
+ break;
+ }
+ for (TABLE_LIST *up= tbl; up; up= up->embedding)
+ {
+ if (up->outer_join)
+ {
+ view->updatable_view= 0;
+ goto loop_out;
+ }
+ }
+ }
+ }
/* check old .frm */
{
char path_buff[FN_REFLEN];
@@ -765,54 +813,6 @@ static int mysql_register_view(THD *thd,
{
my_error(ER_NO_SUCH_TABLE, MYF(0), view->db, view->alias);
DBUG_RETURN(-1);
- }
- }
- }
- /* fill structure */
- 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((char *)view->source.str,
- (char *)thd->query +
- thd->query_length) -
- view->source.str;
- view->file_version= 1;
- view->calc_md5(md5);
- view->md5.str= md5;
- view->md5.length= 32;
- can_be_merged= lex->can_be_merged();
- if (lex->create_view_algorithm == VIEW_ALGORITHM_MERGE &&
- !lex->can_be_merged())
- {
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_VIEW_MERGE,
- ER(ER_WARN_VIEW_MERGE));
- lex->create_view_algorithm= VIEW_ALGORITHM_UNDEFINED;
- }
- view->algorithm= lex->create_view_algorithm;
- view->definer.user= lex->definer->user;
- view->definer.host= lex->definer->host;
- view->view_suid= lex->create_view_suid;
- view->with_check= lex->create_view_check;
- if ((view->updatable_view= (can_be_merged &&
- view->algorithm != VIEW_ALGORITHM_TMPTABLE)))
- {
- /* TODO: change here when we will support UNIONs */
- for (TABLE_LIST *tbl= (TABLE_LIST *)lex->select_lex.table_list.first;
- tbl;
- tbl= tbl->next_local)
- {
- if ((tbl->view && !tbl->updatable_view) || tbl->schema_table)
- {
- view->updatable_view= 0;
- break;
- }
- for (TABLE_LIST *up= tbl; up; up= up->embedding)
- {
- if (up->outer_join)
- {
- view->updatable_view= 0;
- goto loop_out;
- }
}
}
}
| Thread |
|---|
| • bk commit into 5.0 tree (gshchepa:1.2506) BUG#28244 | gshchepa | 29 May |