Commit d1e57a0f authored by Sergey Petrunia's avatar Sergey Petrunia

Merge

parents 95c3e4e1 bbb45c15
CREATE TABLE t1_will_crash (a INT, KEY (a)) ENGINE=MyISAM;
INSERT INTO t1_will_crash VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11);
FLUSH TABLES;
# replacing t1.MYI with a corrupt + unclosed one created by doing:
# 'create table t1 (a int key(a))' head -c1024 t1.MYI > corrupt_t1.MYI
SELECT * FROM t1_will_crash;
a
1
2
3
4
5
6
7
8
9
10
11
Warnings:
Error 145 Table './test/t1_will_crash' is marked as crashed and should be repaired
Error 1194 Table 't1_will_crash' is marked as crashed and should be repaired
Error 1034 1 client is using or hasn't closed the table properly
Error 1034 Size of indexfile is: 1024 Should be: 2048
Error 1034 Size of datafile is: 77 Should be: 7
Error 1034 Number of rows changed from 1 to 11
DROP TABLE t1_will_crash;
CREATE TABLE t1_will_crash (a INT, KEY (a))
ENGINE=MyISAM
PARTITION BY HASH(a)
PARTITIONS 3;
INSERT INTO t1_will_crash VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11);
FLUSH TABLES;
# replacing t1#P#p1.MYI with a corrupt + unclosed one created by doing:
# 'create table t1 (a int key(a)) partition by hash (a) partitions 3'
# head -c1024 t1#P#p1.MYI > corrupt_t1#P#p1.MYI
SELECT * FROM t1_will_crash;
a
1
2
3
4
5
6
7
8
9
10
11
Warnings:
Error 145 Table './test/t1_will_crash#P#p1' is marked as crashed and should be repaired
Error 1194 Table 't1_will_crash' is marked as crashed and should be repaired
Error 1034 1 client is using or hasn't closed the table properly
Error 1034 Size of indexfile is: 1024 Should be: 2048
Error 1034 Size of datafile is: 28 Should be: 7
Error 1034 Number of rows changed from 1 to 4
DROP TABLE t1_will_crash;
# test the auto-recover (--myisam-recover) of partitioned myisam tables
--source include/have_partition.inc
--disable_warnings
--disable_query_log
drop table if exists t1_will_crash;
--enable_query_log
--enable_warnings
CREATE TABLE t1_will_crash (a INT, KEY (a)) ENGINE=MyISAM;
INSERT INTO t1_will_crash VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11);
FLUSH TABLES;
--echo # replacing t1.MYI with a corrupt + unclosed one created by doing:
--echo # 'create table t1 (a int key(a))' head -c1024 t1.MYI > corrupt_t1.MYI
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1_will_crash.MYI
--copy_file std_data/corrupt_t1.MYI $MYSQLTEST_VARDIR/master-data/test/t1_will_crash.MYI
SELECT * FROM t1_will_crash;
DROP TABLE t1_will_crash;
CREATE TABLE t1_will_crash (a INT, KEY (a))
ENGINE=MyISAM
PARTITION BY HASH(a)
PARTITIONS 3;
INSERT INTO t1_will_crash VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11);
FLUSH TABLES;
--echo # replacing t1#P#p1.MYI with a corrupt + unclosed one created by doing:
--echo # 'create table t1 (a int key(a)) partition by hash (a) partitions 3'
--echo # head -c1024 t1#P#p1.MYI > corrupt_t1#P#p1.MYI
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p1.MYI
--copy_file std_data/corrupt_t1#P#p1.MYI $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p1.MYI
SELECT * FROM t1_will_crash;
DROP TABLE t1_will_crash;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
Verify that example engine is not installed.
SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='EXAMPLE';
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
Get binlog position before install plugin.
Install example engine.
INSTALL PLUGIN example SONAME 'ha_example.so';
Get binlog position after install plugin.
Compute the difference of the binlog positions.
Should be zero as install plugin should not be replicated.
Delta
0
Verify that example engine is installed.
SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='EXAMPLE';
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
EXAMPLE YES Example storage engine NO NO NO
connection slave: Verify that example engine is not installed.
SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='EXAMPLE';
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
connection master: Uninstall example engine.
Get binlog position before uninstall plugin.
UNINSTALL PLUGIN example;
Get binlog position after uninstall plugin.
Compute the difference of the binlog positions.
Should be zero as uninstall plugin should not be replicated.
Delta
0
Verify that example engine is not installed.
SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='EXAMPLE';
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
End of test
#
# Bug#35807 - INSTALL PLUGIN replicates row-based, but not stmt-based
#
# The test verifies that INSTALL PLUGIN and UNINSTALL PLUGIN
# work with replication.
#
# The test tries to install and uninstall a plugin on master,
# and verifies that it does not affect the slave,
# and that it does not add anything to the binlog.
--source include/not_embedded.inc
--source include/have_log_bin.inc
# Dynamic loading of Example does not work on Windows currently.
--source include/not_windows.inc
--source include/have_example_plugin.inc
# Initialize replication.
--source include/master-slave.inc
--echo Verify that example engine is not installed.
SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='EXAMPLE';
--echo Get binlog position before install plugin.
let $before_pos = query_get_value("SHOW MASTER STATUS", Position, 1);
--echo Install example engine.
INSTALL PLUGIN example SONAME 'ha_example.so';
--echo Get binlog position after install plugin.
let $after_pos = query_get_value("SHOW MASTER STATUS", Position, 1);
--echo Compute the difference of the binlog positions.
--echo Should be zero as install plugin should not be replicated.
--disable_query_log
eval SELECT $after_pos - $before_pos AS Delta;
--enable_query_log
--echo Verify that example engine is installed.
SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='EXAMPLE';
# Wait for slave to catch up with master.
sync_slave_with_master;
#
--echo connection slave: Verify that example engine is not installed.
connection slave;
SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='EXAMPLE';
#
--echo connection master: Uninstall example engine.
connection master;
--echo Get binlog position before uninstall plugin.
let $before_pos = query_get_value("SHOW MASTER STATUS", Position, 1);
UNINSTALL PLUGIN example;
--echo Get binlog position after uninstall plugin.
let $after_pos = query_get_value("SHOW MASTER STATUS", Position, 1);
--echo Compute the difference of the binlog positions.
--echo Should be zero as uninstall plugin should not be replicated.
--disable_query_log
eval SELECT $after_pos - $before_pos AS Delta;
--enable_query_log
--echo Verify that example engine is not installed.
SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='EXAMPLE';
# Wait for slave to catch up with master.
sync_slave_with_master;
#
# Cleanup
--source include/master-slave-end.inc
--echo End of test
......@@ -70,8 +70,8 @@ uint sf_malloc_prehunc=0, /* If you have problem with core- */
sf_malloc_endhunc=0, /* dump when malloc-message.... */
/* set theese to 64 or 128 */
sf_malloc_quick=0; /* set if no calls to sanity */
ulong sf_malloc_cur_memory= 0L; /* Current memory usage */
ulong sf_malloc_max_memory= 0L; /* Maximum memory usage */
size_t sf_malloc_cur_memory= 0L; /* Current memory usage */
size_t sf_malloc_max_memory= 0L; /* Maximum memory usage */
uint sf_malloc_count= 0; /* Number of times NEW() was called */
uchar *sf_min_adress= (uchar*) ~(unsigned long) 0L,
*sf_max_adress= (uchar*) 0L;
......
......@@ -44,8 +44,8 @@ struct st_irem
struct st_irem *next; /* Linked list of structures */
struct st_irem *prev; /* Other link */
char *filename; /* File in which memory was new'ed */
size_t datasize; /* Size requested */
uint32 linenum; /* Line number in above file */
uint32 datasize; /* Size requested */
uint32 SpecialValue; /* Underrun marker value */
};
......
......@@ -2494,6 +2494,8 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked)
err_handler:
while (file-- != m_file)
(*file)->close();
if (!is_clone)
bitmap_free(&(m_part_info->used_partitions));
DBUG_RETURN(error);
}
......
......@@ -1662,11 +1662,18 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name, const LEX_STRING *dl
goto deinit;
}
/*
We do not replicate the INSTALL PLUGIN statement. Disable binlogging
of the insert into the plugin table, so that it is not replicated in
row based mode.
*/
tmp_disable_binlog(thd);
table->use_all_columns();
restore_record(table, s->default_values);
table->field[0]->store(name->str, name->length, system_charset_info);
table->field[1]->store(dl->str, dl->length, files_charset_info);
error= table->file->ha_write_row(table->record[0]);
reenable_binlog(thd);
if (error)
{
table->file->print_error(error, MYF(0));
......@@ -1731,7 +1738,15 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name)
HA_READ_KEY_EXACT))
{
int error;
if ((error= table->file->ha_delete_row(table->record[0])))
/*
We do not replicate the UNINSTALL PLUGIN statement. Disable binlogging
of the delete from the plugin table, so that it is not replicated in
row based mode.
*/
tmp_disable_binlog(thd);
error= table->file->ha_delete_row(table->record[0]);
reenable_binlog(thd);
if (error)
{
table->file->print_error(error, MYF(0));
DBUG_RETURN(TRUE);
......
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