Skip to content

Commit e384299

Browse files
committed
Merge 10.7 into 10.8
2 parents 02de93d + 1e54a97 commit e384299

File tree

6 files changed

+34
-104
lines changed

6 files changed

+34
-104
lines changed

mysql-test/main/opt_trace,ps.rdiff

Lines changed: 0 additions & 92 deletions
This file was deleted.

mysql-test/main/opt_trace.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
--source include/not_embedded.inc
22
--source include/have_sequence.inc
3-
--source include/protocol.inc
43
SELECT table_name, column_name FROM information_schema.columns where table_name="OPTIMIZER_TRACE";
54
set optimizer_trace="enabled=on";
65
show variables like 'optimizer_trace';

sql/opt_subselect.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,15 @@ int check_and_do_in_subquery_rewrites(JOIN *join)
717717
if (arena)
718718
thd->restore_active_arena(arena, &backup);
719719
in_subs->is_registered_semijoin= TRUE;
720+
}
721+
722+
/*
723+
Print the transformation into trace. Do it when we've just set
724+
is_registered_semijoin=TRUE above, and also do it when we've already
725+
had it set.
726+
*/
727+
if (in_subs->is_registered_semijoin)
728+
{
720729
OPT_TRACE_TRANSFORM(thd, trace_wrapper, trace_transform,
721730
select_lex->select_number,
722731
"IN (SELECT)", "semijoin");

storage/innobase/fil/fil0fil.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2544,7 +2544,8 @@ fil_ibd_load(uint32_t space_id, const char *filename, fil_space_t *&space)
25442544

25452545
/* Read and validate the first page of the tablespace.
25462546
Assign a tablespace name based on the tablespace type. */
2547-
switch (file.validate_for_recovery()) {
2547+
switch (file.validate_for_recovery(
2548+
static_cast<uint32_t>(space_id))) {
25482549
os_offset_t minimum_size;
25492550
case DB_SUCCESS:
25502551
deferred_space = file.m_defer;

storage/innobase/fsp/fsp0file.cc

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -386,10 +386,11 @@ exist and be successfully opened. We initially open it in read-only mode
386386
because we just want to read the SpaceID. However, if the first page is
387387
corrupt and needs to be restored from the doublewrite buffer, we will
388388
reopen it in write mode and ry to restore that page.
389+
@param space_id space id to validate for recovery
389390
@retval DB_SUCCESS if tablespace is valid, DB_ERROR if not.
390391
m_is_valid is also set true on success, else false. */
391392
dberr_t
392-
Datafile::validate_for_recovery()
393+
Datafile::validate_for_recovery(uint32_t space_id)
393394
{
394395
dberr_t err;
395396

@@ -432,15 +433,23 @@ Datafile::validate_for_recovery()
432433
}
433434
}
434435

435-
if (m_space_id == UINT32_MAX) {
436-
return DB_SUCCESS; /* empty file */
436+
const bool empty_tablespace = (m_space_id == UINT32_MAX);
437+
if (empty_tablespace && space_id) {
438+
/* Set space id to find out whether
439+
the page exist in double write buffer */
440+
m_space_id = space_id;
437441
}
438442

439443
if (restore_from_doublewrite()) {
440-
if (m_defer) {
444+
if (!m_defer) {
445+
return DB_CORRUPTION;
446+
}
447+
if (!empty_tablespace) {
441448
return err;
442449
}
443-
return(DB_CORRUPTION);
450+
/* InnoDB may rebuild the file from redo log */
451+
m_space_id = UINT32_MAX;
452+
return DB_SUCCESS; /* empty file */
444453
}
445454

446455
/* Free the previously read first page and then re-validate. */
@@ -768,10 +777,13 @@ Datafile::restore_from_doublewrite()
768777
in the doublewrite buffer, then the recovery is going to fail
769778
now. Hence this is treated as an error. */
770779

771-
ib::error()
772-
<< "Corrupted page " << page_id
773-
<< " of datafile '" << m_filepath
774-
<< "' could not be found in the doublewrite buffer.";
780+
if (!m_defer) {
781+
ib::error()
782+
<< "Corrupted page " << page_id
783+
<< " of datafile '" << m_filepath
784+
<< "' could not be found in the "
785+
<< "doublewrite buffer.";
786+
}
775787

776788
return(true);
777789
}

storage/innobase/include/fsp0file.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,10 @@ class Datafile {
207207
However, if the first page is corrupt and needs to be restored
208208
from the doublewrite buffer, we will reopen it in write mode and
209209
ry to restore that page.
210+
@param space_id space id to validate for recovery
210211
@retval DB_SUCCESS if tablespace is valid, DB_ERROR if not.
211212
m_is_valid is also set true on success, else false. */
212-
dberr_t validate_for_recovery()
213+
dberr_t validate_for_recovery(uint32_t space_id=0)
213214
MY_ATTRIBUTE((warn_unused_result));
214215

215216
/** Checks the consistency of the first page of a datafile when the

0 commit comments

Comments
 (0)