Commit e9b8b76f authored by Vicențiu Ciorbaru's avatar Vicențiu Ciorbaru

Merge branch '10.2' into 10.3

parents 08d8bce5 5da6ffe2
......@@ -3866,6 +3866,32 @@ NULL
DROP VIEW v1;
DROP TABLE t1,t2;
#
# MDEV-25032 Window functions without column references get removed from ORDER BY
#
create table t1 (id int, score double);
insert into t1 values
(1, 5),
(1, 6),
(1, 6),
(1, 6),
(1, 7),
(1, 8.1),
(1, 9),
(1, 10);
select id, row_number() over () rn
from t1
order by rn desc;
id rn
1 8
1 7
1 6
1 5
1 4
1 3
1 2
1 1
drop table t1;
#
# End of 10.2 tests
#
#
......
......@@ -2522,6 +2522,26 @@ SELECT NTH_VALUE(i1, i1) OVER (PARTITION BY i1) FROM v1;
DROP VIEW v1;
DROP TABLE t1,t2;
--echo #
--echo # MDEV-25032 Window functions without column references get removed from ORDER BY
--echo #
create table t1 (id int, score double);
insert into t1 values
(1, 5),
(1, 6),
(1, 6),
(1, 6),
(1, 7),
(1, 8.1),
(1, 9),
(1, 10);
select id, row_number() over () rn
from t1
order by rn desc;
drop table t1;
--echo #
--echo # End of 10.2 tests
--echo #
......
......@@ -3872,6 +3872,32 @@ NULL
DROP VIEW v1;
DROP TABLE t1,t2;
#
# MDEV-25032 Window functions without column references get removed from ORDER BY
#
create table t1 (id int, score double);
insert into t1 values
(1, 5),
(1, 6),
(1, 6),
(1, 6),
(1, 7),
(1, 8.1),
(1, 9),
(1, 10);
select id, row_number() over () rn
from t1
order by rn desc;
id rn
1 8
1 7
1 6
1 5
1 4
1 3
1 2
1 1
drop table t1;
#
# End of 10.2 tests
#
#
......
......@@ -3318,3 +3318,20 @@ c1 c2
9 3
DROP TABLE t1;
DROP TABLE t2;
#
# MDEV-24748 Extern field check missing
# in btr_index_rec_validate()
#
CREATE TABLE t1 (pk INT, c1 char(255),
c2 char(255), c3 char(255), c4 char(255),
c5 char(255), c6 char(255), c7 char(255),
c8 char(255), primary key (pk)
) CHARACTER SET utf32 ENGINE=InnoDB;
INSERT INTO t1 VALUES
(1, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'),
(2, 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p');
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
ALTER TABLE t1 FORCE;
DROP TABLE t1;
......@@ -2593,3 +2593,21 @@ SELECT * FROM t2;
DROP TABLE t1;
DROP TABLE t2;
--echo #
--echo # MDEV-24748 Extern field check missing
--echo # in btr_index_rec_validate()
--echo #
CREATE TABLE t1 (pk INT, c1 char(255),
c2 char(255), c3 char(255), c4 char(255),
c5 char(255), c6 char(255), c7 char(255),
c8 char(255), primary key (pk)
) CHARACTER SET utf32 ENGINE=InnoDB;
INSERT INTO t1 VALUES
(1, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'),
(2, 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p');
CHECK TABLE t1;
ALTER TABLE t1 FORCE;
# Cleanup
DROP TABLE t1;
......@@ -13416,6 +13416,7 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond,
{
table_map order_tables=order->item[0]->used_tables();
if (order->item[0]->with_sum_func ||
order->item[0]->with_window_func ||
/*
If the outer table of an outer join is const (either by itself or
after applying WHERE condition), grouping on a field from such a
......
......@@ -4547,6 +4547,18 @@ btr_index_rec_validate(
rec_get_nth_field_offs(offsets, i, &len);
if (rec_offs_nth_extern(offsets, i)) {
const byte* data = rec_get_nth_field(
rec, offsets, i, &len);
len -= BTR_EXTERN_FIELD_REF_SIZE;
ulint extern_len = mach_read_from_4(
data + len + BTR_EXTERN_LEN + 4);
if (fixed_size == extern_len) {
continue;
}
}
/* Note that if fixed_size != 0, it equals the
length of a fixed-size column in the clustered index.
We should adjust it here.
......
......@@ -1000,15 +1000,14 @@ fil_space_extend_must_retry(
}
/*******************************************************************//**
Reserves the fil_system.mutex and tries to make sure we can open at least one
/** Reserves the fil_system.mutex and tries to make sure we can open at least one
file while holding it. This should be called before calling
fil_node_prepare_for_io(), because that function may need to open a file. */
fil_node_prepare_for_io(), because that function may need to open a file.
@param[in] space_id tablespace id
@return whether the tablespace is usable for io */
static
void
fil_mutex_enter_and_prepare_for_io(
/*===============================*/
ulint space_id) /*!< in: space id */
bool
fil_mutex_enter_and_prepare_for_io(ulint space_id)
{
for (ulint count = 0;;) {
mutex_enter(&fil_system.mutex);
......@@ -1021,7 +1020,7 @@ fil_mutex_enter_and_prepare_for_io(
fil_space_t* space = fil_space_get_by_id(space_id);
if (space == NULL) {
break;
return false;
}
fil_node_t* node = UT_LIST_GET_LAST(space->chain);
......@@ -1036,6 +1035,10 @@ fil_mutex_enter_and_prepare_for_io(
the insert buffer. The insert buffer is in
tablespace 0, and we cannot end up waiting in
this function. */
} else if (space->is_stopping() && !space->is_being_truncated) {
/* If the tablespace is being deleted then InnoDB
shouldn't prepare the tablespace for i/o */
return false;
} else if (!node || node->is_open()) {
/* If the file is already open, no need to do
anything; if the space does not exist, we handle the
......@@ -1107,6 +1110,8 @@ fil_mutex_enter_and_prepare_for_io(
break;
}
return true;
}
/** Try to extend a tablespace if it is smaller than the specified size.
......@@ -1123,7 +1128,10 @@ fil_space_extend(
bool success;
do {
fil_mutex_enter_and_prepare_for_io(space->id);
if (!fil_mutex_enter_and_prepare_for_io(space->id)) {
success = false;
break;
}
} while (fil_space_extend_must_retry(
space, UT_LIST_GET_LAST(space->chain), size,
&success));
......@@ -1478,7 +1486,9 @@ fil_space_t* fil_system_t::read_page0(ulint id)
/* It is possible that the tablespace is dropped while we are
not holding the mutex. */
fil_mutex_enter_and_prepare_for_io(id);
if (!fil_mutex_enter_and_prepare_for_io(id)) {
return NULL;
}
fil_space_t* space = fil_space_get_by_id(id);
......
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