mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
Merge 10.4 into 10.5
This commit is contained in:
commit
344e59904d
5 changed files with 78 additions and 15 deletions
|
@ -3480,3 +3480,24 @@ Warnings:
|
||||||
Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a` AS `a`,3 AS `d`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`c` AS `c` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t1`.`a` = 3 and `test`.`t1`.`pk` <= 2
|
Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a` AS `a`,3 AS `d`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`c` AS `c` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t1`.`a` = 3 and `test`.`t1`.`pk` <= 2
|
||||||
drop view v1;
|
drop view v1;
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
|
#
|
||||||
|
# MDEV-25679: view / derived table defined as ordered select with LIMIT
|
||||||
|
#
|
||||||
|
create table t1 (a int);
|
||||||
|
insert into t1 values (3), (7), (1);
|
||||||
|
create view v1 as (select a from t1 limit 2) order by a desc;
|
||||||
|
(select a from t1 limit 2) order by a desc;
|
||||||
|
a
|
||||||
|
7
|
||||||
|
3
|
||||||
|
select * from v1;
|
||||||
|
a
|
||||||
|
7
|
||||||
|
3
|
||||||
|
select * from ((select a from t1 limit 2) order by a desc) dt;
|
||||||
|
a
|
||||||
|
3
|
||||||
|
7
|
||||||
|
drop view v1;
|
||||||
|
drop table t1;
|
||||||
|
# End of 10.2 tests
|
||||||
|
|
|
@ -2273,3 +2273,20 @@ eval explain extended $q;
|
||||||
|
|
||||||
drop view v1;
|
drop view v1;
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-25679: view / derived table defined as ordered select with LIMIT
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
create table t1 (a int);
|
||||||
|
insert into t1 values (3), (7), (1);
|
||||||
|
|
||||||
|
create view v1 as (select a from t1 limit 2) order by a desc;
|
||||||
|
(select a from t1 limit 2) order by a desc;
|
||||||
|
select * from v1;
|
||||||
|
select * from ((select a from t1 limit 2) order by a desc) dt;
|
||||||
|
|
||||||
|
drop view v1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
--echo # End of 10.2 tests
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
|
Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
|
||||||
Copyright (C) 2014, 2020, MariaDB Corporation.
|
Copyright (C) 2014, 2021, MariaDB Corporation.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it under
|
This program is free software; you can redistribute it and/or modify it under
|
||||||
the terms of the GNU General Public License as published by the Free Software
|
the terms of the GNU General Public License as published by the Free Software
|
||||||
|
@ -96,6 +96,7 @@ static bool init_crypt_key(crypt_info_t* info, bool upgrade = false)
|
||||||
<< info->key_version << " failed (" << rc
|
<< info->key_version << " failed (" << rc
|
||||||
<< "). Maybe the key or the required encryption "
|
<< "). Maybe the key or the required encryption "
|
||||||
"key management plugin was not found.";
|
"key management plugin was not found.";
|
||||||
|
info->key_version = ENCRYPTION_KEY_VERSION_INVALID;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,6 +116,7 @@ static bool init_crypt_key(crypt_info_t* info, bool upgrade = false)
|
||||||
if (err != MY_AES_OK || dst_len != MY_AES_BLOCK_SIZE) {
|
if (err != MY_AES_OK || dst_len != MY_AES_BLOCK_SIZE) {
|
||||||
ib::error() << "Getting redo log crypto key failed: err = "
|
ib::error() << "Getting redo log crypto key failed: err = "
|
||||||
<< err << ", len = " << dst_len;
|
<< err << ", len = " << dst_len;
|
||||||
|
info->key_version = ENCRYPTION_KEY_VERSION_INVALID;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,6 +293,7 @@ ATTRIBUTE_COLD bool log_crypt_101_read_block(byte* buf, lsn_t start_lsn)
|
||||||
for (const crypt_info_t* const end = info + infos_used; info < end;
|
for (const crypt_info_t* const end = info + infos_used; info < end;
|
||||||
info++) {
|
info++) {
|
||||||
if (info->key_version
|
if (info->key_version
|
||||||
|
&& info->key_version != ENCRYPTION_KEY_VERSION_INVALID
|
||||||
&& info->checkpoint_no == checkpoint_no) {
|
&& info->checkpoint_no == checkpoint_no) {
|
||||||
goto found;
|
goto found;
|
||||||
}
|
}
|
||||||
|
@ -302,6 +305,9 @@ ATTRIBUTE_COLD bool log_crypt_101_read_block(byte* buf, lsn_t start_lsn)
|
||||||
/* MariaDB Server 10.1 would use the first key if it fails to
|
/* MariaDB Server 10.1 would use the first key if it fails to
|
||||||
find a key for the current checkpoint. */
|
find a key for the current checkpoint. */
|
||||||
info = infos;
|
info = infos;
|
||||||
|
if (info->key_version == ENCRYPTION_KEY_VERSION_INVALID) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
found:
|
found:
|
||||||
byte dst[OS_FILE_LOG_BLOCK_SIZE];
|
byte dst[OS_FILE_LOG_BLOCK_SIZE];
|
||||||
uint dst_len;
|
uint dst_len;
|
||||||
|
|
|
@ -580,6 +580,7 @@ dberr_t trx_rseg_array_init()
|
||||||
bool wsrep_xid_in_rseg_found = false;
|
bool wsrep_xid_in_rseg_found = false;
|
||||||
#endif
|
#endif
|
||||||
mtr_t mtr;
|
mtr_t mtr;
|
||||||
|
dberr_t err = DB_SUCCESS;
|
||||||
|
|
||||||
for (ulint rseg_id = 0; rseg_id < TRX_SYS_N_RSEGS; rseg_id++) {
|
for (ulint rseg_id = 0; rseg_id < TRX_SYS_N_RSEGS; rseg_id++) {
|
||||||
mtr.start();
|
mtr.start();
|
||||||
|
@ -609,10 +610,11 @@ dberr_t trx_rseg_array_init()
|
||||||
ut_ad(rseg->id == rseg_id);
|
ut_ad(rseg->id == rseg_id);
|
||||||
ut_ad(!trx_sys.rseg_array[rseg_id]);
|
ut_ad(!trx_sys.rseg_array[rseg_id]);
|
||||||
trx_sys.rseg_array[rseg_id] = rseg;
|
trx_sys.rseg_array[rseg_id] = rseg;
|
||||||
if (dberr_t err = trx_rseg_mem_restore(
|
if ((err = trx_rseg_mem_restore(
|
||||||
rseg, max_trx_id, &mtr)) {
|
rseg, max_trx_id, &mtr))
|
||||||
|
!= DB_SUCCESS) {
|
||||||
mtr.commit();
|
mtr.commit();
|
||||||
return err;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef WITH_WSREP
|
#ifdef WITH_WSREP
|
||||||
if (!wsrep_sys_xid.is_null() &&
|
if (!wsrep_sys_xid.is_null() &&
|
||||||
|
@ -633,6 +635,21 @@ dberr_t trx_rseg_array_init()
|
||||||
mtr.commit();
|
mtr.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (err != DB_SUCCESS) {
|
||||||
|
for (ulint rseg_id = 0; rseg_id < TRX_SYS_N_RSEGS; rseg_id++) {
|
||||||
|
if (trx_rseg_t*& rseg = trx_sys.rseg_array[rseg_id]) {
|
||||||
|
while (trx_undo_t* u= UT_LIST_GET_FIRST(
|
||||||
|
rseg->undo_list)) {
|
||||||
|
UT_LIST_REMOVE(rseg->undo_list, u);
|
||||||
|
ut_free(u);
|
||||||
|
}
|
||||||
|
trx_rseg_mem_free(rseg);
|
||||||
|
rseg = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef WITH_WSREP
|
#ifdef WITH_WSREP
|
||||||
if (!wsrep_sys_xid.is_null()) {
|
if (!wsrep_sys_xid.is_null()) {
|
||||||
/* Upgrade from a version prior to 10.3.5,
|
/* Upgrade from a version prior to 10.3.5,
|
||||||
|
|
|
@ -852,18 +852,11 @@ trx_undo_mem_create_at_db_start(trx_rseg_t *rseg, ulint id, uint32_t page_no,
|
||||||
const uint16_t type = mach_read_from_2(TRX_UNDO_PAGE_HDR
|
const uint16_t type = mach_read_from_2(TRX_UNDO_PAGE_HDR
|
||||||
+ TRX_UNDO_PAGE_TYPE
|
+ TRX_UNDO_PAGE_TYPE
|
||||||
+ block->frame);
|
+ block->frame);
|
||||||
switch (type) {
|
if (UNIV_UNLIKELY(type > 2)) {
|
||||||
case 0:
|
corrupted_type:
|
||||||
case 2: /* TRX_UNDO_UPDATE */
|
|
||||||
break;
|
|
||||||
case 1: /* TRX_UNDO_INSERT */
|
|
||||||
sql_print_error("InnoDB: upgrade from older version than"
|
|
||||||
" MariaDB 10.3 requires clean shutdown");
|
|
||||||
goto corrupted;
|
|
||||||
default:
|
|
||||||
sql_print_error("InnoDB: unsupported undo header type %u",
|
sql_print_error("InnoDB: unsupported undo header type %u",
|
||||||
type);
|
type);
|
||||||
corrupted:
|
corrupted:
|
||||||
mtr.commit();
|
mtr.commit();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -883,12 +876,21 @@ trx_undo_mem_create_at_db_start(trx_rseg_t *rseg, ulint id, uint32_t page_no,
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case TRX_UNDO_ACTIVE:
|
case TRX_UNDO_ACTIVE:
|
||||||
case TRX_UNDO_PREPARED:
|
case TRX_UNDO_PREPARED:
|
||||||
break;
|
if (UNIV_LIKELY(type != 1)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sql_print_error("InnoDB: upgrade from older version than"
|
||||||
|
" MariaDB 10.3 requires clean shutdown");
|
||||||
|
goto corrupted;
|
||||||
default:
|
default:
|
||||||
sql_print_error("InnoDB: unsupported undo header state %u",
|
sql_print_error("InnoDB: unsupported undo header state %u",
|
||||||
state);
|
state);
|
||||||
goto corrupted;
|
goto corrupted;
|
||||||
case TRX_UNDO_TO_PURGE:
|
case TRX_UNDO_TO_PURGE:
|
||||||
|
if (UNIV_UNLIKELY(type == 1)) {
|
||||||
|
goto corrupted_type;
|
||||||
|
}
|
||||||
|
/* fall through */
|
||||||
case TRX_UNDO_CACHED:
|
case TRX_UNDO_CACHED:
|
||||||
trx_id_t id = mach_read_from_8(TRX_UNDO_TRX_NO + undo_header);
|
trx_id_t id = mach_read_from_8(TRX_UNDO_TRX_NO + undo_header);
|
||||||
if (id >> 48) {
|
if (id >> 48) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue