Skip to content

Commit

Permalink
Merge 10.3 into 10.4
Browse files Browse the repository at this point in the history
  • Loading branch information
midenok committed Dec 2, 2019
2 parents 1d46923 + db32d94 commit 0b8b11b
Show file tree
Hide file tree
Showing 18 changed files with 278 additions and 38 deletions.
8 changes: 5 additions & 3 deletions cmake/cpack_rpm.cmake
Expand Up @@ -195,7 +195,7 @@ MACRO(ALTERNATIVE_NAME real alt)
SET(p "CPACK_RPM_${real}_PACKAGE_PROVIDES")
SET(${p} "${${p}} ${alt} = ${ver} ${alt}%{?_isa} = ${ver} config(${alt}) = ${ver}")
SET(o "CPACK_RPM_${real}_PACKAGE_OBSOLETES")
SET(${o} "${${o}} ${alt} ${alt}%{?_isa}")
SET(${o} "${${o}} ${alt}")
ENDMACRO(ALTERNATIVE_NAME)

ALTERNATIVE_NAME("devel" "mysql-devel")
Expand All @@ -215,8 +215,9 @@ ELSEIF(RPM MATCHES "fedora" OR RPM MATCHES "(rhel|centos)7")
ALTERNATIVE_NAME("server" "mariadb-server")
ALTERNATIVE_NAME("server" "mysql-compat-server")
ALTERNATIVE_NAME("test" "mariadb-test")
ELSEIF(RPM MATCHES "(rhel|centos)8")
SET(PYTHON_SHEBANG "/usr/bin/python3")
ENDIF()
IF(RPM MATCHES "fedora31" OR RPM MATCHES "(rhel|centos)8")
SET(PYTHON_SHEBANG "/usr/bin/python3" CACHE STRING "python shebang")
ENDIF()

# If we want to build build MariaDB-shared-compat,
Expand Down Expand Up @@ -249,6 +250,7 @@ IF(compat53 AND compat101)

STRING(REPLACE "\n" " " compat_provides "${compat_provides}")
STRING(REPLACE "\n" " " compat_obsoletes "${compat_obsoletes}")
STRING(REGEX REPLACE "[^ ]+\\([^ ]+ *" "" compat_obsoletes "${compat_obsoletes}")
SETA(CPACK_RPM_compat_PACKAGE_PROVIDES "${compat_provides}")
SETA(CPACK_RPM_compat_PACKAGE_OBSOLETES "${compat_obsoletes}")

Expand Down
1 change: 0 additions & 1 deletion include/lf.h
Expand Up @@ -65,7 +65,6 @@ typedef struct {
typedef struct {
void * volatile pin[LF_PINBOX_PINS];
LF_PINBOX *pinbox;
void **stack_ends_here;
void *purgatory;
uint32 purgatory_count;
uint32 volatile link;
Expand Down
14 changes: 14 additions & 0 deletions mysql-test/suite/versioning/r/partition.result
Expand Up @@ -599,3 +599,17 @@ x a
3 bar
4 bar
drop table t1;
#
# MDEV-21011 Table corruption reported for versioned partitioned table after DELETE: "Found a misplaced row"
#
create table t1 (a int) with system versioning
partition by system_time limit 3
(partition p1 history, partition p2 history, partition pn current);
insert into t1 values (1),(2),(3),(4);
delete from t1;
delete from t1;
check table t1;
Table Op Msg_type Msg_text
test.t1 check note Not supported for non-INTERVAL history partitions
test.t1 check note The storage engine for the table doesn't support check
drop table t1;
21 changes: 21 additions & 0 deletions mysql-test/suite/versioning/r/update.result
Expand Up @@ -276,3 +276,24 @@ update t1 set a= '2012-12-12';
update v set a= '2000-01-01' order by b limit 1;
drop view v;
drop table t1, t2;
#
# MDEV-20441 ER_CRASHED_ON_USAGE upon update on versioned Aria table
#
create or replace table t1 (a varchar(8))
engine=aria row_format=fixed
with system versioning;
insert into t1 (a) values ('foo');
update t1 set a = 'bar';
drop table t1;
#
# MDEV-21147 Assertion `marked_for_read()' upon UPDATE on versioned table via view
#
create or replace table t1 (
pk int, a char(8), b char(8),
primary key (pk)
) with system versioning;
create or replace view v1 as select * from t1;
insert into t1 values (1, null, 'd') , (2, null, 'i') ;
update v1 set a= null where b = '';
drop view v1;
drop table t1;
66 changes: 66 additions & 0 deletions mysql-test/suite/versioning/r/view.result
Expand Up @@ -160,6 +160,7 @@ period for system_time (row_start, row_end)
) with system versioning;
insert into t1 values (1), (2);
create or replace view v1 as select * from t1 where x > 1;
# update, delete
update v1 set x= x + 1;
select *, check_row(row_start, row_end) from t1 for system_time all order by x;
x check_row(row_start, row_end)
Expand Down Expand Up @@ -211,5 +212,70 @@ x check_row(row_start, row_end)
1 CURRENT ROW
2 HISTORICAL ROW
3 HISTORICAL ROW
# replace
create or replace table t1 (
x int primary key, y int,
row_start SYS_DATATYPE as row start invisible,
row_end SYS_DATATYPE as row end invisible,
period for system_time (row_start, row_end)
) with system versioning;
insert into t1 values (1, 0), (2, 0);
create or replace view v1 as select * from t1 where x > 1;
replace v1 values (1, 1);
replace v1 values (2, 1);
replace v1 values (3, 1);
# REPLACE ignores VIEW condition because itself doesn't use WHERE
select *, check_row(row_start, row_end) from t1 for system_time all order by x, row_end;
x y check_row(row_start, row_end)
1 0 HISTORICAL ROW
1 1 CURRENT ROW
2 0 HISTORICAL ROW
2 1 CURRENT ROW
3 1 CURRENT ROW
# insert-select, on duplicate key
insert v1 select * from t1 where x = 1 on duplicate key update x = v1.x - 1;
select *, check_row(row_start, row_end) from t1 for system_time all order by x, row_end;
x y check_row(row_start, row_end)
0 1 CURRENT ROW
1 0 HISTORICAL ROW
1 1 HISTORICAL ROW
2 0 HISTORICAL ROW
2 1 CURRENT ROW
3 1 CURRENT ROW
drop view v1, v2;
drop tables t1, t2;
#
# MDEV-21146 Assertion `m_lock_type == 2' in handler::ha_drop_table upon LOAD DATA
#
create table t1 (a int);
create view v1 as select * from t1;
create or replace table t1 (b int) with system versioning;
load data infile 'xx' into table v1;
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
drop view v1;
drop table t1;
#
# MDEV-21155 Assertion with versioned table upon DELETE from view of view after replacing first view
#
create table t1 (a int);
insert into t1 values (1);
create table t2 (
b int,
row_start SYS_DATATYPE as row start invisible,
row_end SYS_DATATYPE as row end invisible,
period for system_time (row_start, row_end)
) with system versioning;
insert into t2 values (2);
create view v1 as select * from t1;
create view v2 as select * from v1;
create or replace view v1 as select * from t2;
delete from v2;
select * from t1;
a
1
select *, check_row(row_start, row_end) from t2 for system_time all;
b check_row(row_start, row_end)
2 HISTORICAL ROW
drop view v2;
drop view v1;
drop table t1, t2;
15 changes: 15 additions & 0 deletions mysql-test/suite/versioning/t/partition.test
Expand Up @@ -530,4 +530,19 @@ update t1 set a= 'bar' limit 4;
select * from t1;
drop table t1;

--echo #
--echo # MDEV-21011 Table corruption reported for versioned partitioned table after DELETE: "Found a misplaced row"
--echo #
create table t1 (a int) with system versioning
partition by system_time limit 3
(partition p1 history, partition p2 history, partition pn current);
insert into t1 values (1),(2),(3),(4);
delete from t1;
delete from t1;
check table t1;

# cleanup
drop table t1;


--source suite/versioning/common_finish.inc
28 changes: 27 additions & 1 deletion mysql-test/suite/versioning/t/update.test
Expand Up @@ -157,7 +157,6 @@ replace t1 values (1,2),(1,3),(2,4);
--echo #
--echo # MDEV-14829 Assertion `0' failed in Protocol::end_statement upon concurrent UPDATE
--echo #

create or replace table t1 (pk int, a char(3), b char(3), primary key(pk))
engine=innodb with system versioning;

Expand Down Expand Up @@ -192,4 +191,31 @@ drop view v;
drop table t1, t2;
--enable_warnings

--echo #
--echo # MDEV-20441 ER_CRASHED_ON_USAGE upon update on versioned Aria table
--echo #
create or replace table t1 (a varchar(8))
engine=aria row_format=fixed
with system versioning;

insert into t1 (a) values ('foo');
update t1 set a = 'bar';
drop table t1;

--echo #
--echo # MDEV-21147 Assertion `marked_for_read()' upon UPDATE on versioned table via view
--echo #
create or replace table t1 (
pk int, a char(8), b char(8),
primary key (pk)
) with system versioning;

create or replace view v1 as select * from t1;
insert into t1 values (1, null, 'd') , (2, null, 'i') ;
update v1 set a= null where b = '';

# cleanup
drop view v1;
drop table t1;

source suite/versioning/common_finish.inc;
58 changes: 57 additions & 1 deletion mysql-test/suite/versioning/t/view.test
Expand Up @@ -136,6 +136,7 @@ eval create or replace table t1 (
) with system versioning;
insert into t1 values (1), (2);
create or replace view v1 as select * from t1 where x > 1;
--echo # update, delete
update v1 set x= x + 1;
select *, check_row(row_start, row_end) from t1 for system_time all order by x;
insert v1 values (4);
Expand All @@ -153,8 +154,63 @@ select *, check_row(row_start, row_end) from t2 for system_time all order by x;
delete v1, v2 from v1 join v2 where v1.x = v2.x + 2;
select *, check_row(row_start, row_end) from t1 for system_time all order by x;
select *, check_row(row_start, row_end) from t2 for system_time all order by x;

--echo # replace
--replace_result $sys_datatype_expl SYS_DATATYPE
eval create or replace table t1 (
x int primary key, y int,
row_start $sys_datatype_expl as row start invisible,
row_end $sys_datatype_expl as row end invisible,
period for system_time (row_start, row_end)
) with system versioning;
insert into t1 values (1, 0), (2, 0);
create or replace view v1 as select * from t1 where x > 1;
replace v1 values (1, 1);
replace v1 values (2, 1);
replace v1 values (3, 1);
--echo # REPLACE ignores VIEW condition because itself doesn't use WHERE
select *, check_row(row_start, row_end) from t1 for system_time all order by x, row_end;
--echo # insert-select, on duplicate key
insert v1 select * from t1 where x = 1 on duplicate key update x = v1.x - 1;
select *, check_row(row_start, row_end) from t1 for system_time all order by x, row_end;
drop view v1, v2;
drop tables t1, t2;

--echo #
--echo # MDEV-21146 Assertion `m_lock_type == 2' in handler::ha_drop_table upon LOAD DATA
--echo #
create table t1 (a int);
create view v1 as select * from t1;
create or replace table t1 (b int) with system versioning;
--error ER_VIEW_INVALID
load data infile 'xx' into table v1;

# cleanup
drop view v1;
drop table t1;

--echo #
--echo # MDEV-21155 Assertion with versioned table upon DELETE from view of view after replacing first view
--echo #
create table t1 (a int);
insert into t1 values (1);
--replace_result $sys_datatype_expl SYS_DATATYPE
eval create table t2 (
b int,
row_start $sys_datatype_expl as row start invisible,
row_end $sys_datatype_expl as row end invisible,
period for system_time (row_start, row_end)
) with system versioning;
insert into t2 values (2);
create view v1 as select * from t1;
create view v2 as select * from v1;
create or replace view v1 as select * from t2;
delete from v2;
select * from t1;
select *, check_row(row_start, row_end) from t2 for system_time all;

# cleanup
drop view v2;
drop view v1;
drop table t1, t2;

--source suite/versioning/common_finish.inc
14 changes: 5 additions & 9 deletions mysys/lf_alloc-pin.c
Expand Up @@ -151,7 +151,6 @@ void lf_pinbox_destroy(LF_PINBOX *pinbox)
*/
LF_PINS *lf_pinbox_get_pins(LF_PINBOX *pinbox)
{
struct st_my_thread_var *var;
uint32 pins, next, top_ver;
LF_PINS *el;
/*
Expand Down Expand Up @@ -194,12 +193,7 @@ LF_PINS *lf_pinbox_get_pins(LF_PINBOX *pinbox)
el->link= pins;
el->purgatory_count= 0;
el->pinbox= pinbox;
var= my_thread_var;
/*
Threads that do not call my_thread_init() should still be
able to use the LF_HASH.
*/
el->stack_ends_here= (var ? & var->stack_ends_here : NULL);

return el;
}

Expand Down Expand Up @@ -335,16 +329,18 @@ static void lf_pinbox_real_free(LF_PINS *pins)
void *list;
void **addr= NULL;
void *first= NULL, *last= NULL;
struct st_my_thread_var *var= my_thread_var;
void *stack_ends_here= var ? var->stack_ends_here : NULL;
LF_PINBOX *pinbox= pins->pinbox;

npins= pinbox->pins_in_array+1;

#ifdef HAVE_ALLOCA
if (pins->stack_ends_here != NULL)
if (stack_ends_here != NULL)
{
int alloca_size= sizeof(void *)*LF_PINBOX_PINS*npins;
/* create a sorted list of pinned addresses, to speed up searches */
if (available_stack_size(&pinbox, *pins->stack_ends_here) >
if (available_stack_size(&pinbox, stack_ends_here) >
alloca_size + ALLOCA_SAFETY_MARGIN)
{
struct st_harvester hv;
Expand Down
15 changes: 13 additions & 2 deletions sql/ha_partition.cc
Expand Up @@ -10830,8 +10830,8 @@ int ha_partition::indexes_are_disabled(void)
@param repair If true, move misplaced rows to correct partition.
@return Operation status.
@retval 0 Success
@retval != 0 Error
@retval HA_ADMIN_OK Success
@retval != HA_ADMIN_OK Error
*/

int ha_partition::check_misplaced_rows(uint read_part_id, bool do_repair)
Expand All @@ -10845,6 +10845,17 @@ int ha_partition::check_misplaced_rows(uint read_part_id, bool do_repair)

DBUG_ASSERT(m_file);

if (m_part_info->vers_info &&
read_part_id != m_part_info->vers_info->now_part->id &&
!m_part_info->vers_info->interval.is_set())
{
print_admin_msg(ha_thd(), MYSQL_ERRMSG_SIZE, "note",
table_share->db.str, table->alias,
opt_op_name[CHECK_PARTS],
"Not supported for non-INTERVAL history partitions");
DBUG_RETURN(HA_ADMIN_NOT_IMPLEMENTED);
}

if (do_repair)
{
/* We must read the full row, if we need to move it! */
Expand Down
2 changes: 1 addition & 1 deletion sql/proxy_protocol.cc
Expand Up @@ -470,7 +470,7 @@ static int compare_bits(const void *s1, const void *s2, int bit_count)
int byte_count= bit_count / 8;
if (byte_count && (result= memcmp(s1, s2, byte_count)))
return result;
int rem= byte_count % 8;
int rem= bit_count % 8;
if (rem)
{
// compare remaining bits i.e partial bytes.
Expand Down

0 comments on commit 0b8b11b

Please sign in to comment.