Commit 470aa2c0 authored by unknown's avatar unknown

Merge host.loc:/work/bugs/5.0-bugteam-30059

into  host.loc:/work/bk/5.0-bugteam

parents 5a1b7ddb ef4b6200
...@@ -115,3 +115,39 @@ SET myisam_repair_threads=@@global.myisam_repair_threads; ...@@ -115,3 +115,39 @@ SET myisam_repair_threads=@@global.myisam_repair_threads;
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size; SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
DROP TABLE t1; DROP TABLE t1;
End of 4.1 tests End of 4.1 tests
# Test with a saved table from 4.1
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 9 Fixed 2 5 10 21474836479 1024 0 NULL # # NULL latin1_swedish_ci NULL
SELECT * FROM t1;
id
1
2
# Run CHECK TABLE, it should indicate table need a REPAIR TABLE
CHECK TABLE t1 FOR UPGRADE;
Table Op Msg_type Msg_text
test.t1 check error Table upgrade required. Please do "REPAIR TABLE `t1`" to fix it!
# REPAIR old table USE_FRM should fail
REPAIR TABLE t1 USE_FRM;
Table Op Msg_type Msg_text
t1 repair error Failed reparing incompatible .FRM file
# Run REPAIR TABLE to upgrade .frm file
REPAIR TABLE t1;
Table Op Msg_type Msg_text
test.t1 repair status OK
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 10 Fixed 2 7 14 1970324836974591 1024 0 NULL # # NULL latin1_swedish_ci NULL
SELECT * FROM t1;
id
1
2
REPAIR TABLE t1 USE_FRM;
Table Op Msg_type Msg_text
test.t1 repair warning Number of rows changed from 0 to 2
test.t1 repair status OK
SELECT * FROM t1;
id
1
2
DROP TABLE t1;
...@@ -499,7 +499,7 @@ fetch c into var; ...@@ -499,7 +499,7 @@ fetch c into var;
close c; close c;
return var; return var;
end end
master-bin.000001 # Query 1 # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 as a master-bin.000001 # Query 1 # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `a`
master-bin.000001 # Query 1 # use `test`; create table t1 (a int) master-bin.000001 # Query 1 # use `test`; create table t1 (a int)
master-bin.000001 # Query 1 # use `test`; insert into t1 (a) values (f1()) master-bin.000001 # Query 1 # use `test`; insert into t1 (a) values (f1())
master-bin.000001 # Query 1 # use `test`; drop view v1 master-bin.000001 # Query 1 # use `test`; drop view v1
......
...@@ -47,11 +47,11 @@ show binlog events limit 1,100; ...@@ -47,11 +47,11 @@ show binlog events limit 1,100;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Query 1 # use `test`; create table t1 (a int) slave-bin.000001 # Query 1 # use `test`; create table t1 (a int)
slave-bin.000001 # Query 1 # use `test`; insert into t1 values (1) slave-bin.000001 # Query 1 # use `test`; insert into t1 values (1)
slave-bin.000001 # Query 1 # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select a from t1 slave-bin.000001 # Query 1 # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`a` AS `a` from `test`.`t1`
slave-bin.000001 # Query 1 # use `test`; insert into v1 values (2) slave-bin.000001 # Query 1 # use `test`; insert into v1 values (2)
slave-bin.000001 # Query 1 # use `test`; update v1 set a=3 where a=1 slave-bin.000001 # Query 1 # use `test`; update v1 set a=3 where a=1
slave-bin.000001 # Query 1 # use `test`; delete from v1 where a=2 slave-bin.000001 # Query 1 # use `test`; delete from v1 where a=2
slave-bin.000001 # Query 1 # use `test`; ALTER ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select a as b from t1 slave-bin.000001 # Query 1 # use `test`; ALTER ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`a` AS `b` from `test`.`t1`
slave-bin.000001 # Query 1 # use `test`; drop view v1 slave-bin.000001 # Query 1 # use `test`; drop view v1
slave-bin.000001 # Query 1 # use `test`; drop table t1 slave-bin.000001 # Query 1 # use `test`; drop table t1
...@@ -112,4 +112,18 @@ CREATE VIEW v1 AS SELECT * FROM t1; ...@@ -112,4 +112,18 @@ CREATE VIEW v1 AS SELECT * FROM t1;
ERROR 42S01: Table 'v1' already exists ERROR 42S01: Table 'v1' already exists
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a INT);
# create view as output from mysqldump 10.11 (5.0.62)
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` < 3) */
/*!50002 WITH CASCADED CHECK OPTION */;
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` < 3) WITH CASCADED CHECK OPTION
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` < 3) WITH CASCADED CHECK OPTION
DROP VIEW v1;
DROP TABLE t1;
End of 5.0 tests End of 5.0 tests
...@@ -113,3 +113,33 @@ SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size; ...@@ -113,3 +113,33 @@ SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
DROP TABLE t1; DROP TABLE t1;
--echo End of 4.1 tests --echo End of 4.1 tests
#
# BUG#36055 - mysql_upgrade doesn't really 'upgrade' tables
#
--echo # Test with a saved table from 4.1
--copy_file std_data/bug36055.frm $MYSQLTEST_VARDIR/master-data/test/t1.frm
--copy_file std_data/bug36055.MYD $MYSQLTEST_VARDIR/master-data/test/t1.MYD
--copy_file std_data/bug36055.MYI $MYSQLTEST_VARDIR/master-data/test/t1.MYI
--replace_column 12 # 13 #
SHOW TABLE STATUS LIKE 't1';
SELECT * FROM t1;
--echo # Run CHECK TABLE, it should indicate table need a REPAIR TABLE
CHECK TABLE t1 FOR UPGRADE;
--echo # REPAIR old table USE_FRM should fail
REPAIR TABLE t1 USE_FRM;
--echo # Run REPAIR TABLE to upgrade .frm file
REPAIR TABLE t1;
--replace_column 12 # 13 #
SHOW TABLE STATUS LIKE 't1';
SELECT * FROM t1;
REPAIR TABLE t1 USE_FRM;
SELECT * FROM t1;
DROP TABLE t1;
...@@ -161,4 +161,22 @@ DROP VIEW v1; ...@@ -161,4 +161,22 @@ DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
sync_slave_with_master; sync_slave_with_master;
#
# Bug#32575 Parse error of stmt with extended comments on slave side
# Verify that 'CREATE VIEW' with comments is properly logged to binlog
connection master;
CREATE TABLE t1 (a INT);
--echo # create view as output from mysqldump 10.11 (5.0.62)
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` < 3) */
/*!50002 WITH CASCADED CHECK OPTION */;
SHOW CREATE VIEW v1;
sync_slave_with_master;
SHOW CREATE VIEW v1;
connection master;
DROP VIEW v1;
DROP TABLE t1;
sync_slave_with_master;
--echo End of 5.0 tests --echo End of 5.0 tests
...@@ -1980,6 +1980,8 @@ int handler::ha_check_for_upgrade(HA_CHECK_OPT *check_opt) ...@@ -1980,6 +1980,8 @@ int handler::ha_check_for_upgrade(HA_CHECK_OPT *check_opt)
} }
} }
} }
if (table->s->frm_version != FRM_VER_TRUE_VARCHAR)
return HA_ADMIN_NEEDS_ALTER;
return check_for_upgrade(check_opt); return check_for_upgrade(check_opt);
} }
......
...@@ -2118,6 +2118,13 @@ static int prepare_for_repair(THD* thd, TABLE_LIST *table_list, ...@@ -2118,6 +2118,13 @@ static int prepare_for_repair(THD* thd, TABLE_LIST *table_list,
const char **ext= table->file->bas_ext(); const char **ext= table->file->bas_ext();
MY_STAT stat_info; MY_STAT stat_info;
if (table->s->frm_version != FRM_VER_TRUE_VARCHAR)
{
error= send_check_errmsg(thd, table_list, "repair",
"Failed reparing incompatible .FRM file");
goto end;
}
/* /*
Check if this is a table type that stores index and data separately, Check if this is a table type that stores index and data separately,
like ISAM or MyISAM. We assume fixed order of engine file name like ISAM or MyISAM. We assume fixed order of engine file name
......
...@@ -649,7 +649,11 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, ...@@ -649,7 +649,11 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
buff.append(')'); buff.append(')');
} }
buff.append(STRING_WITH_LEN(" AS ")); buff.append(STRING_WITH_LEN(" AS "));
buff.append(views->source.str, views->source.length); buff.append(views->query.str, views->query.length);
if (views->with_check == VIEW_CHECK_LOCAL)
buff.append(STRING_WITH_LEN(" WITH LOCAL CHECK OPTION"));
else if (views->with_check == VIEW_CHECK_CASCADED)
buff.append(STRING_WITH_LEN(" WITH CASCADED CHECK OPTION"));
Query_log_event qinfo(thd, buff.ptr(), buff.length(), 0, FALSE); Query_log_event qinfo(thd, buff.ptr(), buff.length(), 0, FALSE);
mysql_bin_log.write(&qinfo); mysql_bin_log.write(&qinfo);
...@@ -926,8 +930,6 @@ loop_out: ...@@ -926,8 +930,6 @@ loop_out:
} }
DBUG_RETURN(0); DBUG_RETURN(0);
err: err:
view->query.str= NULL;
view->query.length= 0;
view->md5.str= NULL; view->md5.str= NULL;
view->md5.length= 0; view->md5.length= 0;
DBUG_RETURN(error); DBUG_RETURN(error);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment