Commit d18d5364 authored by Sergei Golubchik's avatar Sergei Golubchik

merged

parents d1a2e16e 17d54f33
......@@ -134,7 +134,7 @@ our $default_vardir;
our $opt_usage;
our $opt_suites;
our $opt_suites_default= "main,binlog,rpl,rpl_ndb,ndb"; # Default suites to run
our $opt_suites_default= "main,binlog,rpl,rpl_ndb,ndb,maria"; # Default suites to run
our $opt_script_debug= 0; # Script debugging, enable with --script-debug
our $opt_verbose= 0; # Verbose output, enable with --verbose
......
......@@ -6,6 +6,7 @@ set session storage_engine=maria;
set global maria_page_checksum=0;
set global maria_log_file_size=4294967295;
drop table if exists t1,t2;
drop view if exists v1;
SET SQL_WARNINGS=1;
CREATE TABLE t1 (
STRING_DATA char(255) default NULL,
......@@ -2241,3 +2242,49 @@ lock table t1 write concurrent;
delete from t1;
ERROR 42000: The storage engine for the table doesn't support DELETE in WRITE CONCURRENT
drop table t1;
create table t1 (p int primary key, i int, a char(10), key k1(i), key k2(a))
engine maria;
insert into t1 values (1, 1, 'qqqq'), (2, 1, 'pppp'),
(3, 1, 'yyyy'), (4, 3, 'zzzz');
insert into t1 values (5, 3, 'yyyy'), (6, 3, 'yyyy'), (7, 0, NULL),
(8, 0, NULL);
select * from t1 where a='zzzz';
p i a
4 3 zzzz
select * from t1 where a='yyyy';
p i a
3 1 yyyy
5 3 yyyy
6 3 yyyy
select * from t1 where a is NULL;
p i a
7 0 NULL
8 0 NULL
select * from t1;
p i a
1 1 qqqq
2 1 pppp
3 1 yyyy
4 3 zzzz
5 3 yyyy
6 3 yyyy
7 0 NULL
8 0 NULL
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
create table t1 (f1 int unique, f2 int) engine=maria;
create table t2 (f3 int, f4 int) engine=maria;
create view v1 as select * from t1, t2 where f1= f3;
insert into t1 values (1,11), (2,22);
insert into v1 (f1) values (3) on duplicate key update f1= f3 + 10;
insert into v1 (f1) values (3) on duplicate key update f1= f3 + 10;
drop table t1,t2;
drop view v1;
CREATE TABLE t1 (id int, c varchar(10)) engine=maria;
INSERT INTO t1 VALUES (1,"1");
ALTER TABLE t1 CHANGE c d varchar(10);
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
drop table t1;
......@@ -17,6 +17,7 @@ set global maria_log_file_size=4294967295;
# Initialise
--disable_warnings
drop table if exists t1,t2;
drop view if exists v1;
--enable_warnings
SET SQL_WARNINGS=1;
......@@ -1540,3 +1541,46 @@ eval set global storage_engine=$default_engine, maria_page_checksum=$default_che
--enable_result_log
--enable_query_log
#
# Bug#39243 SELECT WHERE does not find row
# (Problem with skip_row)
#
create table t1 (p int primary key, i int, a char(10), key k1(i), key k2(a))
engine maria;
insert into t1 values (1, 1, 'qqqq'), (2, 1, 'pppp'),
(3, 1, 'yyyy'), (4, 3, 'zzzz');
insert into t1 values (5, 3, 'yyyy'), (6, 3, 'yyyy'), (7, 0, NULL),
(8, 0, NULL);
select * from t1 where a='zzzz';
select * from t1 where a='yyyy';
select * from t1 where a is NULL;
select * from t1;
check table t1;
drop table t1;
#
# Bug39248 INSERT ON DUPLICATE KEY UPDATE gives error if using a view
# Note that this only crashes when using
# --mysqld=--binlog-format=row --ps-protocol
#
create table t1 (f1 int unique, f2 int) engine=maria;
create table t2 (f3 int, f4 int) engine=maria;
create view v1 as select * from t1, t2 where f1= f3;
insert into t1 values (1,11), (2,22);
insert into v1 (f1) values (3) on duplicate key update f1= f3 + 10;
insert into v1 (f1) values (3) on duplicate key update f1= f3 + 10;
drop table t1,t2;
drop view v1;
#
# BUG#39399 ALTER TABLE renaming column: affected_rows > 0
#
CREATE TABLE t1 (id int, c varchar(10)) engine=maria;
INSERT INTO t1 VALUES (1,"1");
--enable_info
ALTER TABLE t1 CHANGE c d varchar(10);
--disable_info
drop table t1;
......@@ -1191,6 +1191,9 @@ bool mysql_insert(THD *thd,TABLE_LIST *table,List<Item> &fields,
List<List_item> &values, List<Item> &update_fields,
List<Item> &update_values, enum_duplicates flag,
bool ignore);
void upgrade_lock_type_for_insert(THD *thd, thr_lock_type *lock_type,
enum_duplicates duplic,
bool is_multi_insert);
int check_that_all_fields_are_given_values(THD *thd, TABLE *entry,
TABLE_LIST *table_list);
void prepare_triggers_for_insert_stmt(TABLE *table);
......
......@@ -4387,8 +4387,8 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
/* Also used for indicating that prelocking is need */
TABLE_LIST **query_tables_last_own;
bool safe_to_ignore_table;
DBUG_ENTER("open_tables");
/*
temporary mem_root for new .frm parsing.
TODO: variables for size
......
......@@ -387,10 +387,9 @@ void prepare_triggers_for_insert_stmt(TABLE *table)
downgrade the lock in handler::store_lock() method.
*/
static
void upgrade_lock_type(THD *thd, thr_lock_type *lock_type,
enum_duplicates duplic,
bool is_multi_insert)
void upgrade_lock_type_for_insert(THD *thd, thr_lock_type *lock_type,
enum_duplicates duplic,
bool is_multi_insert)
{
if (duplic == DUP_UPDATE ||
duplic == DUP_REPLACE && *lock_type == TL_WRITE_CONCURRENT_INSERT)
......@@ -587,8 +586,8 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
Upgrade lock type if the requested lock is incompatible with
the current connection mode or table operation.
*/
upgrade_lock_type(thd, &table_list->lock_type, duplic,
values_list.elements > 1);
upgrade_lock_type_for_insert(thd, &table_list->lock_type, duplic,
values_list.elements > 1);
/*
We can't write-delayed into a table locked with LOCK TABLES:
......
......@@ -1068,6 +1068,8 @@ static bool mysql_test_insert(Prepared_statement *stmt,
if (insert_precheck(thd, table_list))
goto error;
upgrade_lock_type_for_insert(thd, &table_list->lock_type, duplic,
values_list.elements > 1);
/*
open temporary memory pool for temporary data allocated by derived
tables & preparation procedure
......
......@@ -1021,7 +1021,6 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
bool parse_status;
bool result, view_is_mergeable;
TABLE_LIST *view_main_select_tables;
DBUG_ENTER("mysql_make_view");
DBUG_PRINT("info", ("table: 0x%lx (%s)", (ulong) table, table->table_name));
......
......@@ -2605,10 +2605,9 @@ enum row_type ha_maria::get_row_type() const
}
static enum data_file_type maria_row_type(HA_CREATE_INFO *info,
my_bool ignore_transactional)
static enum data_file_type maria_row_type(HA_CREATE_INFO *info)
{
if (info->transactional == HA_CHOICE_YES && ! ignore_transactional)
if (info->transactional == HA_CHOICE_YES)
return BLOCK_RECORD;
switch (info->row_type) {
case ROW_TYPE_FIXED: return STATIC_RECORD;
......@@ -2641,7 +2640,7 @@ int ha_maria::create(const char *name, register TABLE *table_arg,
}
}
/* Note: BLOCK_RECORD is used if table is transactional */
row_type= maria_row_type(ha_create_info, 0);
row_type= maria_row_type(ha_create_info);
if (ha_create_info->transactional == HA_CHOICE_YES &&
ha_create_info->row_type != ROW_TYPE_PAGE &&
ha_create_info->row_type != ROW_TYPE_NOT_USED &&
......@@ -2825,15 +2824,15 @@ bool ha_maria::check_if_incompatible_data(HA_CREATE_INFO *create_info,
if (create_info->auto_increment_value != stats.auto_increment_value ||
create_info->data_file_name != data_file_name ||
create_info->index_file_name != index_file_name ||
(maria_row_type(create_info, 1) != data_file_type &&
(maria_row_type(create_info) != data_file_type &&
create_info->row_type != ROW_TYPE_DEFAULT) ||
table_changes == IS_EQUAL_NO ||
table_changes & IS_EQUAL_PACK_LENGTH) // Not implemented yet
return COMPATIBLE_DATA_NO;
if ((options & (HA_OPTION_PACK_RECORD | HA_OPTION_CHECKSUM |
if ((options & (HA_OPTION_CHECKSUM |
HA_OPTION_DELAY_KEY_WRITE)) !=
(create_info->table_options & (HA_OPTION_PACK_RECORD | HA_OPTION_CHECKSUM |
(create_info->table_options & (HA_OPTION_CHECKSUM |
HA_OPTION_DELAY_KEY_WRITE)))
return COMPATIBLE_DATA_NO;
return COMPATIBLE_DATA_YES;
......
......@@ -931,7 +931,7 @@ uint _ma_get_static_key(MARIA_KEY *key, uint page_flag, uint nod_flag,
/**
Skip over static length key from key-block
@fn _ma_skip_pack_key()
@fn _ma_skip_static_key()
@param key Keyinfo and buffer that can be used
@param nod_flag If nod: Length of node pointer, else zero.
@param key Points at key
......@@ -1049,6 +1049,7 @@ uint _ma_get_pack_key(MARIA_KEY *int_key, uint page_flag,
}
else
{
/* Key that is not packed against previous key */
if (keyseg->flag & HA_NULL_PART)
{
if (!length--) /* Null part */
......@@ -1121,6 +1122,9 @@ uint _ma_get_pack_key(MARIA_KEY *int_key, uint page_flag,
@param nod_flag If nod: Length of node pointer, else zero.
@param key Points at key
@note
This is in principle a simpler version of _ma_get_pack_key()
@retval pointer to next key
*/
......@@ -1150,6 +1154,14 @@ uchar *_ma_skip_pack_key(MARIA_KEY *key, uint page_flag,
page+= length;
continue;
}
if ((keyseg->flag & HA_NULL_PART) && length)
{
/*
Keys that can have null use length+1 as the length for date as the
number 0 is reserved for keys that have a NULL value
*/
length--;
}
page+= length;
}
else
......@@ -1846,11 +1858,14 @@ _ma_calc_var_key_length(const MARIA_KEY *key, uint nod_flag,
prefix byte(s) The high bit is set if this is a prefix for the prev key
length Packed length if the previous was a prefix byte
[length] data bytes ('length' bytes)
[data_length] data bytes ('length' bytes)
next-key-seg Next key segments
If the first segment can have NULL:
The length is 0 for NULLS and 1+length for not null columns.
If key was packed
data_length is length of rest of key
If key was not packed
The data_length is 0 for NULLS and 1+data_length for not null columns
*/
int
......
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