1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

Merge with 5.1 to get bug fix for LP#613408 Memory corruption with (M)aria storage engine and virtual columns

Fixed test case to test for virtual columns
This commit is contained in:
Michael Widenius
2010-08-07 18:03:04 +03:00
20 changed files with 101 additions and 15 deletions

View File

@ -164,7 +164,7 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"character-sets-dir", 'c', "Directory for character set files.",
&charsets_dir, &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0,
(char**) &charsets_dir, (char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0,
0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", &default_charset,

View File

@ -600,7 +600,7 @@ static struct my_option my_long_options[] =
&debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"delimiter", 'F',
"Delimiter to use in SQL statements supplied in file or command line.",
&delimiter, &delimiter, 0, GET_STR, REQUIRED_ARG,
(char**) &delimiter, (char**) &delimiter, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"detach", OPT_SLAP_DETACH,
"Detach (close and reopen) connections after X number of requests.",

View File

@ -4537,7 +4537,7 @@ sub mysqld_stop {
name => "mysqladmin shutdown ".$mysqld->name(),
path => $exe_mysqladmin,
args => \$args,
error => "/dev/null",
error => "$opt_vardir/log/mysqladmin.err",
);
}

View File

@ -2613,3 +2613,14 @@ INSERT t1 ( f1 , f2 , f3 , f4 ) VALUES ( 0 , f2 , 8 , f3 ) ;
INSERT t1 ( f4 , f2 ) VALUES ( 4 , 92 ) ;
DELETE FROM t1 WHERE v3 = 173 OR v4 = 9 ;
drop table t1;
CREATE TABLE t1 (
f1 CHAR(255) BINARY ,
f2 CHAR(255) BINARY NOT NULL DEFAULT '0',
f3 CHAR(255) BINARY NOT NULL ,
f4 CHAR(255) BINARY NOT NULL DEFAULT '0' ,
v3 CHAR(255) BINARY AS ( ( f1 NOT LIKE '%' ) ) PERSISTENT,
KEY (v3)
) ENGINE=Maria;
INSERT INTO t1 ( f1 , f2 , f3 , f4 ) SELECT f1 , f4 , f1 , f4 FROM t1;
DELETE FROM t1;
drop table t1;

View File

@ -1893,6 +1893,23 @@ INSERT t1 ( f4 , f2 ) VALUES ( 4 , 92 ) ;
DELETE FROM t1 WHERE v3 = 173 OR v4 = 9 ;
drop table t1;
#
# Test for LP#61465 Memory corruption with (M)aria storage engine and
# virtual columns
#
CREATE TABLE t1 (
f1 CHAR(255) BINARY ,
f2 CHAR(255) BINARY NOT NULL DEFAULT '0',
f3 CHAR(255) BINARY NOT NULL ,
f4 CHAR(255) BINARY NOT NULL DEFAULT '0' ,
v3 CHAR(255) BINARY AS ( ( f1 NOT LIKE '%' ) ) PERSISTENT,
KEY (v3)
) ENGINE=Maria;
INSERT INTO t1 ( f1 , f2 , f3 , f4 ) SELECT f1 , f4 , f1 , f4 FROM t1;
DELETE FROM t1;
drop table t1;
#
# End of test
#

View File

@ -1,3 +1,5 @@
-- source include/not_windows.inc
-- echo # Activate master-slave replication
-- source include/master-slave.inc

View File

@ -1,3 +1,5 @@
-- source include/not_windows.inc
-- echo # Activate master-slave replication
-- source include/master-slave.inc

View File

@ -1,3 +1,5 @@
--source include/not_windows.inc
source include/have_innodb.inc;
SELECT sleep(2);
set global log_slow_verbosity=innodb;

View File

@ -1,3 +1,5 @@
-- source include/not_windows.inc
source include/have_innodb.inc;
SET GLOBAL SLOW_QUERY_LOG=OFF;

View File

@ -1,3 +1,5 @@
-- source include/not_windows.inc
source include/have_innodb.inc;
SELECT sleep(2);

View File

@ -1,3 +1,4 @@
source include/not_windows.inc;
source include/have_innodb.inc;
SELECT sleep(1);

View File

@ -1,3 +1,4 @@
source include/not_windows.inc;
source include/have_innodb.inc;
SELECT sleep(2);

View File

@ -1,3 +1,4 @@
source include/not_windows.inc;
source include/have_innodb.inc;
SET GLOBAL SLOW_QUERY_LOG=OFF;

View File

@ -1,3 +1,4 @@
source include/not_windows.inc;
source include/have_innodb.inc;
SELECT sleep(1);

View File

@ -1,3 +1,5 @@
--source include/not_windows.inc
SET CHARACTER SET utf8;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
SHOW VARIABLES like 'character_sets_dir';

View File

@ -1 +1 @@
--log-output=file --slow-query-log --log-long-format --log-queries-not-using-indexes --myisam-recover="" --general-log --general-log-file="foo" --slow-query-log-file=""
--log-output=file --slow-query-log --log-long-format --log-queries-not-using-indexes --myisam-recover="" --general-log --general-log-file="foo" --slow-query-log-file="" --long_query_time=20

View File

@ -4410,8 +4410,7 @@ static my_bool read_long_data2(MARIA_HA *info, uchar *to, ulong length,
MARIA_EXTENT_CURSOR *extent,
uchar **data, uchar **end_of_data)
{
uint left_length;
left_length= (uint) (*end_of_data - *data);
uint left_length= (uint) (*end_of_data - *data);
DBUG_ENTER("read_long_data2");
DBUG_PRINT("enter", ("length: %lu left_length: %u",
length, left_length));

View File

@ -2270,10 +2270,14 @@ static int initialize_variables_for_repair(HA_CHECK *param,
MARIA_SORT_INFO *sort_info,
MARIA_SORT_PARAM *sort_param,
MARIA_HA *info,
my_bool rep_quick)
my_bool rep_quick,
MARIA_SHARE *org_share)
{
MARIA_SHARE *share= info->s;
/* Ro allow us to restore state and check how state changed */
memcpy(org_share, share, sizeof(*share));
/* Repair code relies on share->state.state so we have to update it here */
if (share->lock.update_status)
(*share->lock.update_status)(info);
@ -2333,6 +2337,23 @@ static int initialize_variables_for_repair(HA_CHECK *param,
}
/*
During initialize_variables_for_repair and related functions we set some
variables to values that makes sence during repair.
This function restores these values to their original values so that we can
use the handler in MariaDB without having to close and open the table.
*/
static void restore_table_state_after_repair(MARIA_HA *info,
MARIA_SHARE *org_share)
{
maria_versioning(info, info->s->have_versioning);
info->s->lock_key_trees= org_share->lock_key_trees;
}
/**
@brief Drop all indexes
@ -2481,11 +2502,11 @@ int maria_repair(HA_CHECK *param, register MARIA_HA *info,
char llbuff[22],llbuff2[22];
MARIA_SORT_INFO sort_info;
MARIA_SORT_PARAM sort_param;
my_bool block_record, scan_inited= 0,
reenable_logging= share->now_transactional;
my_bool block_record, scan_inited= 0, reenable_logging= 0;
enum data_file_type org_data_file_type= share->data_file_type;
myf sync_dir= ((share->now_transactional && !share->temporary) ?
MY_SYNC_DIR : 0);
MARIA_SHARE backup_share;
DBUG_ENTER("maria_repair");
got_error= 1;
@ -2498,10 +2519,10 @@ int maria_repair(HA_CHECK *param, register MARIA_HA *info,
}
if (initialize_variables_for_repair(param, &sort_info, &sort_param, info,
rep_quick))
rep_quick, &backup_share))
goto err;
if (reenable_logging)
if ((reenable_logging= share->now_transactional))
_ma_tmp_disable_logging_for_table(info, 0);
sort_param.current_filepos= sort_param.filepos= new_header_length=
@ -2780,6 +2801,7 @@ err:
/* If caller had disabled logging it's not up to us to re-enable it */
if (reenable_logging)
_ma_reenable_logging_for_table(info, FALSE);
restore_table_state_after_repair(info, &backup_share);
my_free(sort_param.rec_buff, MYF(MY_ALLOW_ZERO_PTR));
my_free(sort_param.record,MYF(MY_ALLOW_ZERO_PTR));
@ -3550,7 +3572,8 @@ int maria_repair_by_sort(HA_CHECK *param, register MARIA_HA *info,
ulonglong key_map;
myf sync_dir= ((share->now_transactional && !share->temporary) ?
MY_SYNC_DIR : 0);
my_bool scan_inited= 0;
my_bool scan_inited= 0, reenable_logging= 0;
MARIA_SHARE backup_share;
DBUG_ENTER("maria_repair_by_sort");
LINT_INIT(key_map);
@ -3564,9 +3587,12 @@ int maria_repair_by_sort(HA_CHECK *param, register MARIA_HA *info,
}
if (initialize_variables_for_repair(param, &sort_info, &sort_param, info,
rep_quick))
rep_quick, &backup_share))
goto err;
if ((reenable_logging= share->now_transactional))
_ma_tmp_disable_logging_for_table(info, 0);
org_header_length= share->pack.header_length;
new_header_length= (param->testflag & T_UNPACK) ? 0 : org_header_length;
sort_param.filepos= new_header_length;
@ -3972,6 +3998,11 @@ err:
share->state.changed&= ~(STATE_NOT_OPTIMIZED_ROWS | STATE_NOT_ZEROFILLED |
STATE_NOT_MOVABLE);
/* If caller had disabled logging it's not up to us to re-enable it */
if (reenable_logging)
_ma_reenable_logging_for_table(info, FALSE);
restore_table_state_after_repair(info, &backup_share);
my_free(sort_param.rec_buff, MYF(MY_ALLOW_ZERO_PTR));
my_free(sort_param.record,MYF(MY_ALLOW_ZERO_PTR));
my_free(sort_info.key_block, MYF(MY_ALLOW_ZERO_PTR));
@ -4042,10 +4073,12 @@ int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info,
IO_CACHE new_data_cache; /* For non-quick repair. */
IO_CACHE_SHARE io_share;
MARIA_SORT_INFO sort_info;
MARIA_SHARE backup_share;
ulonglong key_map;
pthread_attr_t thr_attr;
myf sync_dir= ((share->now_transactional && !share->temporary) ?
MY_SYNC_DIR : 0);
my_bool reenable_logging= 0;
DBUG_ENTER("maria_repair_parallel");
LINT_INIT(key_map);
@ -4059,9 +4092,12 @@ int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info,
}
if (initialize_variables_for_repair(param, &sort_info, &tmp_sort_param, info,
rep_quick))
rep_quick, &backup_share))
goto err;
if ((reenable_logging= share->now_transactional))
_ma_tmp_disable_logging_for_table(info, 0);
new_header_length= ((param->testflag & T_UNPACK) ? 0 :
share->pack.header_length);
@ -4489,6 +4525,11 @@ err:
pthread_cond_destroy (&sort_info.cond);
pthread_mutex_destroy(&sort_info.mutex);
/* If caller had disabled logging it's not up to us to re-enable it */
if (reenable_logging)
_ma_reenable_logging_for_table(info, FALSE);
restore_table_state_after_repair(info, &backup_share);
my_free(sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR));
my_free(sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR));
my_free(sort_param,MYF(MY_ALLOW_ZERO_PTR));

View File

@ -678,6 +678,7 @@ void maria_versioning(MARIA_HA *info, my_bool versioning)
info->lock.type= versioning ? TL_WRITE_CONCURRENT_INSERT : TL_WRITE;
_ma_block_get_status((void*) info, versioning);
info->lock.type= save_lock_type;
info->state= info->state_start= &info->s->state.common;
}
}

View File

@ -176,7 +176,8 @@ int trnman_init(TrID initial_trid)
trnman_active_transactions= 0;
trnman_committed_transactions= 0;
trnman_allocated_transactions= 0;
dummy_transaction_object.min_read_from= ~(TrID) 0; /* for recovery */
/* This is needed for recovery and repair */
dummy_transaction_object.min_read_from= ~(TrID) 0;
pool= 0;
global_trid_generator= initial_trid;