Commit e384299e authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.7 into 10.8

parents 02de93d1 1e54a971
--- /Users/shulga/projects/mariadb/server-10.6/mysql-test/main/opt_trace.result 2021-07-21 19:17:11.000000000 +0700
+++ /Users/shulga/projects/mariadb/server-10.6/mysql-test/main/opt_trace.reject 2021-07-21 19:17:48.000000000 +0700
@@ -2829,14 +2829,6 @@
}
},
{
- "transformation": {
- "select_id": 2,
- "from": "IN (SELECT)",
- "to": "semijoin",
- "chosen": true
- }
- },
- {
"expanded_query": "/* select#2 */ select t10.pk from t10"
}
]
@@ -4402,14 +4394,6 @@
}
},
{
- "transformation": {
- "select_id": 2,
- "from": "IN (SELECT)",
- "to": "semijoin",
- "chosen": true
- }
- },
- {
"expanded_query": "/* select#2 */ select t_inner_1.a from t1 t_inner_1 join t1 t_inner_2"
}
]
@@ -4852,14 +4836,6 @@
}
},
{
- "transformation": {
- "select_id": 2,
- "from": "IN (SELECT)",
- "to": "semijoin",
- "chosen": true
- }
- },
- {
"expanded_query": "/* select#2 */ select t_inner_1.a from t2 t_inner_2 join t1 t_inner_1"
}
]
@@ -4879,14 +4855,6 @@
}
},
{
- "transformation": {
- "select_id": 3,
- "from": "IN (SELECT)",
- "to": "semijoin",
- "chosen": true
- }
- },
- {
"expanded_query": "/* select#3 */ select t_inner_3.a from t2 t_inner_3 join t1 t_inner_4"
}
]
@@ -6432,14 +6400,6 @@
}
},
{
- "transformation": {
- "select_id": 2,
- "from": "IN (SELECT)",
- "to": "semijoin",
- "chosen": true
- }
- },
- {
"expanded_query": "/* select#2 */ select t_inner_1.a from t2 t_inner_2 join t1 t_inner_1"
}
]
@@ -6459,14 +6419,6 @@
}
},
{
- "transformation": {
- "select_id": 3,
- "from": "IN (SELECT)",
- "to": "semijoin",
- "chosen": true
- }
- },
- {
"expanded_query": "/* select#3 */ select t_inner_3.a from t2 t_inner_3 join t1 t_inner_4"
}
]
--source include/not_embedded.inc
--source include/have_sequence.inc
--source include/protocol.inc
SELECT table_name, column_name FROM information_schema.columns where table_name="OPTIMIZER_TRACE";
set optimizer_trace="enabled=on";
show variables like 'optimizer_trace';
......
......@@ -717,6 +717,15 @@ int check_and_do_in_subquery_rewrites(JOIN *join)
if (arena)
thd->restore_active_arena(arena, &backup);
in_subs->is_registered_semijoin= TRUE;
}
/*
Print the transformation into trace. Do it when we've just set
is_registered_semijoin=TRUE above, and also do it when we've already
had it set.
*/
if (in_subs->is_registered_semijoin)
{
OPT_TRACE_TRANSFORM(thd, trace_wrapper, trace_transform,
select_lex->select_number,
"IN (SELECT)", "semijoin");
......
......@@ -2544,7 +2544,8 @@ fil_ibd_load(uint32_t space_id, const char *filename, fil_space_t *&space)
/* Read and validate the first page of the tablespace.
Assign a tablespace name based on the tablespace type. */
switch (file.validate_for_recovery()) {
switch (file.validate_for_recovery(
static_cast<uint32_t>(space_id))) {
os_offset_t minimum_size;
case DB_SUCCESS:
deferred_space = file.m_defer;
......
......@@ -386,10 +386,11 @@ exist and be successfully opened. We initially open it in read-only mode
because we just want to read the SpaceID. However, if the first page is
corrupt and needs to be restored from the doublewrite buffer, we will
reopen it in write mode and ry to restore that page.
@param space_id space id to validate for recovery
@retval DB_SUCCESS if tablespace is valid, DB_ERROR if not.
m_is_valid is also set true on success, else false. */
dberr_t
Datafile::validate_for_recovery()
Datafile::validate_for_recovery(uint32_t space_id)
{
dberr_t err;
......@@ -432,15 +433,23 @@ Datafile::validate_for_recovery()
}
}
if (m_space_id == UINT32_MAX) {
return DB_SUCCESS; /* empty file */
const bool empty_tablespace = (m_space_id == UINT32_MAX);
if (empty_tablespace && space_id) {
/* Set space id to find out whether
the page exist in double write buffer */
m_space_id = space_id;
}
if (restore_from_doublewrite()) {
if (m_defer) {
if (!m_defer) {
return DB_CORRUPTION;
}
if (!empty_tablespace) {
return err;
}
return(DB_CORRUPTION);
/* InnoDB may rebuild the file from redo log */
m_space_id = UINT32_MAX;
return DB_SUCCESS; /* empty file */
}
/* Free the previously read first page and then re-validate. */
......@@ -768,10 +777,13 @@ Datafile::restore_from_doublewrite()
in the doublewrite buffer, then the recovery is going to fail
now. Hence this is treated as an error. */
if (!m_defer) {
ib::error()
<< "Corrupted page " << page_id
<< " of datafile '" << m_filepath
<< "' could not be found in the doublewrite buffer.";
<< "' could not be found in the "
<< "doublewrite buffer.";
}
return(true);
}
......
......@@ -207,9 +207,10 @@ class Datafile {
However, if the first page is corrupt and needs to be restored
from the doublewrite buffer, we will reopen it in write mode and
ry to restore that page.
@param space_id space id to validate for recovery
@retval DB_SUCCESS if tablespace is valid, DB_ERROR if not.
m_is_valid is also set true on success, else false. */
dberr_t validate_for_recovery()
dberr_t validate_for_recovery(uint32_t space_id=0)
MY_ATTRIBUTE((warn_unused_result));
/** Checks the consistency of the first page of a datafile when the
......
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