Commit 0e76c1ba authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.5 into 10.6

parents bda40ccb 1ff6b6f0
...@@ -500,9 +500,8 @@ void lock_sys_t::close() ...@@ -500,9 +500,8 @@ void lock_sys_t::close()
requesting record lock are brute force (BF). If they are check is requesting record lock are brute force (BF). If they are check is
this BF-BF wait correct and if not report BF wait and assert. this BF-BF wait correct and if not report BF wait and assert.
@param[in] lock_rec other waiting record lock @param lock other waiting lock
@param[in] trx trx requesting conflicting record lock @param trx transaction requesting conflicting lock
@param[in] type_mode lock type mode of requesting trx
*/ */
static void wsrep_assert_no_bf_bf_wait(const lock_t *lock, const trx_t *trx, static void wsrep_assert_no_bf_bf_wait(const lock_t *lock, const trx_t *trx,
const unsigned type_mode = LOCK_NONE) const unsigned type_mode = LOCK_NONE)
......
...@@ -4468,10 +4468,9 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn) ...@@ -4468,10 +4468,9 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
ut_d(mysql_mutex_unlock(&buf_pool.flush_list_mutex)); ut_d(mysql_mutex_unlock(&buf_pool.flush_list_mutex));
if (srv_force_recovery >= SRV_FORCE_NO_LOG_REDO) { if (srv_force_recovery >= SRV_FORCE_NO_LOG_REDO) {
sql_print_information("InnoDB: innodb_force_recovery=6"
ib::info() << "innodb_force_recovery=6 skips redo log apply"; " skips redo log apply");
return err;
return(DB_SUCCESS);
} }
mysql_mutex_lock(&log_sys.mutex); mysql_mutex_lock(&log_sys.mutex);
...@@ -4487,13 +4486,9 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn) ...@@ -4487,13 +4486,9 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
ut_ad(RECV_SCAN_SIZE <= srv_log_buffer_size); ut_ad(RECV_SCAN_SIZE <= srv_log_buffer_size);
ut_ad(recv_sys.pages.empty()); ut_ad(recv_sys.pages.empty());
contiguous_lsn = checkpoint_lsn; contiguous_lsn = checkpoint_lsn;
switch (log_sys.log.format) { switch (log_sys.log.format) {
case 0:
mysql_mutex_unlock(&log_sys.mutex);
return DB_SUCCESS;
default: default:
if (end_lsn == 0) { if (end_lsn == 0) {
break; break;
...@@ -4503,8 +4498,13 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn) ...@@ -4503,8 +4498,13 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
break; break;
} }
recv_sys.set_corrupt_log(); recv_sys.set_corrupt_log();
err_exit:
err = DB_ERROR;
/* fall through */
func_exit:
case 0:
mysql_mutex_unlock(&log_sys.mutex); mysql_mutex_unlock(&log_sys.mutex);
return(DB_ERROR); return err;
} }
size_t sizeof_checkpoint; size_t sizeof_checkpoint;
...@@ -4521,14 +4521,15 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn) ...@@ -4521,14 +4521,15 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
ut_ad(!recv_sys.is_corrupt_fs() || !srv_force_recovery); ut_ad(!recv_sys.is_corrupt_fs() || !srv_force_recovery);
if (srv_read_only_mode && recv_needed_recovery) { if (srv_read_only_mode && recv_needed_recovery) {
mysql_mutex_unlock(&log_sys.mutex); read_only:
return(DB_READ_ONLY); err = DB_READ_ONLY;
goto func_exit;
} }
if (recv_sys.is_corrupt_log() && !srv_force_recovery) { if (recv_sys.is_corrupt_log() && !srv_force_recovery) {
mysql_mutex_unlock(&log_sys.mutex); sql_print_warning("InnoDB: Log scan aborted at LSN " LSN_PF,
ib::warn() << "Log scan aborted at LSN " << contiguous_lsn; contiguous_lsn);
return(DB_ERROR); goto err_exit;
} }
/* If we fail to open a tablespace while looking for FILE_CHECKPOINT, we /* If we fail to open a tablespace while looking for FILE_CHECKPOINT, we
...@@ -4536,14 +4537,12 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn) ...@@ -4536,14 +4537,12 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
would not be able to open an encrypted tablespace and the flag could be would not be able to open an encrypted tablespace and the flag could be
set. */ set. */
if (recv_sys.is_corrupt_fs()) { if (recv_sys.is_corrupt_fs()) {
mysql_mutex_unlock(&log_sys.mutex); goto err_exit;
return DB_ERROR;
} }
if (recv_sys.mlog_checkpoint_lsn == 0) { if (recv_sys.mlog_checkpoint_lsn == 0) {
lsn_t scan_lsn = log_sys.log.scanned_lsn; lsn_t scan_lsn = log_sys.log.scanned_lsn;
if (!srv_read_only_mode && scan_lsn != checkpoint_lsn) { if (!srv_read_only_mode && scan_lsn != checkpoint_lsn) {
mysql_mutex_unlock(&log_sys.mutex);
ib::error err; ib::error err;
err << "Missing FILE_CHECKPOINT"; err << "Missing FILE_CHECKPOINT";
if (end_lsn) { if (end_lsn) {
...@@ -4551,7 +4550,7 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn) ...@@ -4551,7 +4550,7 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
} }
err << " between the checkpoint " << checkpoint_lsn err << " between the checkpoint " << checkpoint_lsn
<< " and the end " << scan_lsn << "."; << " and the end " << scan_lsn << ".";
return(DB_ERROR); goto err_exit;
} }
log_sys.log.scanned_lsn = checkpoint_lsn; log_sys.log.scanned_lsn = checkpoint_lsn;
...@@ -4562,8 +4561,7 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn) ...@@ -4562,8 +4561,7 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
if ((recv_sys.is_corrupt_log() && !srv_force_recovery) if ((recv_sys.is_corrupt_log() && !srv_force_recovery)
|| recv_sys.is_corrupt_fs()) { || recv_sys.is_corrupt_fs()) {
mysql_mutex_unlock(&log_sys.mutex); goto err_exit;
return(DB_ERROR);
} }
} }
...@@ -4593,19 +4591,17 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn) ...@@ -4593,19 +4591,17 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
} }
if (!recv_needed_recovery) { if (!recv_needed_recovery) {
sql_print_information(
ib::info() "InnoDB: The log sequence number " LSN_PF
<< "The log sequence number " << flush_lsn " in the system tablespace does not match"
<< " in the system tablespace does not match" " the log sequence number " LSN_PF
" the log sequence number " " in the ib_logfile0!",
<< checkpoint_lsn << " in the " flush_lsn, checkpoint_lsn);
<< LOG_FILE_NAME << "!";
if (srv_read_only_mode) { if (srv_read_only_mode) {
ib::error() << "innodb_read_only" sql_print_error("InnoDB: innodb_read_only"
" prevents crash recovery"; " prevents crash recovery");
mysql_mutex_unlock(&log_sys.mutex); goto read_only;
return(DB_READ_ONLY);
} }
recv_needed_recovery = true; recv_needed_recovery = true;
...@@ -4626,8 +4622,7 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn) ...@@ -4626,8 +4622,7 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
rescan, missing_tablespace); rescan, missing_tablespace);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
mysql_mutex_unlock(&log_sys.mutex); goto func_exit;
return(err);
} }
/* If there is any missing tablespace and rescan is needed /* If there is any missing tablespace and rescan is needed
...@@ -4656,8 +4651,7 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn) ...@@ -4656,8 +4651,7 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
rescan, missing_tablespace); rescan, missing_tablespace);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
mysql_mutex_unlock(&log_sys.mutex); goto func_exit;
return err;
} }
rescan = true; rescan = true;
...@@ -4681,8 +4675,7 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn) ...@@ -4681,8 +4675,7 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
if ((recv_sys.is_corrupt_log() if ((recv_sys.is_corrupt_log()
&& !srv_force_recovery) && !srv_force_recovery)
|| recv_sys.is_corrupt_fs()) { || recv_sys.is_corrupt_fs()) {
mysql_mutex_unlock(&log_sys.mutex); goto err_exit;
return(DB_ERROR);
} }
ut_ad(contiguous_lsn <= recv_sys.recovered_lsn); ut_ad(contiguous_lsn <= recv_sys.recovered_lsn);
...@@ -4700,26 +4693,26 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn) ...@@ -4700,26 +4693,26 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
ut_ad(!rescan || recv_sys.pages.empty()); ut_ad(!rescan || recv_sys.pages.empty());
} }
if (log_sys.is_physical() if (!log_sys.is_physical()) {
&& (log_sys.log.scanned_lsn < checkpoint_lsn } else if (recv_sys.recovered_lsn < checkpoint_lsn
|| log_sys.log.scanned_lsn < recv_max_page_lsn)) { || recv_sys.recovered_lsn < end_lsn) {
sql_print_error("InnoDB: The log was only scanned up to "
ib::error() << "We scanned the log up to " LSN_PF ", while the current LSN at the "
<< log_sys.log.scanned_lsn "time of the latest checkpoint " LSN_PF
<< ". A checkpoint was at " << checkpoint_lsn << " and" " was " LSN_PF "!",
" the maximum LSN on a database page was " recv_sys.recovered_lsn,
<< recv_max_page_lsn << ". It is possible that the" checkpoint_lsn, end_lsn);
" database is now corrupt!"; goto err_exit;
} } else if (log_sys.log.scanned_lsn < checkpoint_lsn
|| log_sys.log.scanned_lsn < end_lsn
if (recv_sys.recovered_lsn < checkpoint_lsn) { || log_sys.log.scanned_lsn < recv_max_page_lsn) {
mysql_mutex_unlock(&log_sys.mutex); sql_print_error("InnoDB: We scanned the log up to " LSN_PF
". A checkpoint was at " LSN_PF
ib::error() << "Recovered only to lsn:" " and the maximum LSN on a database page was "
<< recv_sys.recovered_lsn LSN_PF ". It is possible that the"
<< " checkpoint_lsn: " << checkpoint_lsn; " database is now corrupt!",
log_sys.log.scanned_lsn, checkpoint_lsn,
return(DB_ERROR); recv_max_page_lsn);
} }
log_sys.next_checkpoint_lsn = checkpoint_lsn; log_sys.next_checkpoint_lsn = checkpoint_lsn;
...@@ -4751,20 +4744,19 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn) ...@@ -4751,20 +4744,19 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
log_sys.next_checkpoint_no = ++checkpoint_no; log_sys.next_checkpoint_no = ++checkpoint_no;
DBUG_EXECUTE_IF("before_final_redo_apply", DBUG_EXECUTE_IF("before_final_redo_apply", goto err_exit;);
mysql_mutex_unlock(&log_sys.mutex);
return DB_ERROR;);
mysql_mutex_lock(&recv_sys.mutex); mysql_mutex_lock(&recv_sys.mutex);
recv_sys.apply_log_recs = true; recv_sys.apply_log_recs = true;
recv_no_ibuf_operations = false; recv_no_ibuf_operations = false;
ut_d(recv_no_log_write = srv_operation == SRV_OPERATION_RESTORE ut_d(recv_no_log_write = srv_operation == SRV_OPERATION_RESTORE
|| srv_operation == SRV_OPERATION_RESTORE_EXPORT); || srv_operation == SRV_OPERATION_RESTORE_EXPORT);
if (srv_operation == SRV_OPERATION_NORMAL) { if (srv_operation == SRV_OPERATION_NORMAL) {
err = recv_rename_files(); err = recv_rename_files();
} }
mysql_mutex_unlock(&recv_sys.mutex);
recv_lsn_checks_on = true; recv_lsn_checks_on = true;
mysql_mutex_unlock(&recv_sys.mutex);
/* The database is now ready to start almost normal processing of user /* The database is now ready to start almost normal processing of user
transactions: transaction rollbacks and the application of the log transactions: transaction rollbacks and the application of the log
...@@ -4773,9 +4765,7 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn) ...@@ -4773,9 +4765,7 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
&& !srv_force_recovery) { && !srv_force_recovery) {
err = DB_CORRUPTION; err = DB_CORRUPTION;
} }
goto func_exit;
mysql_mutex_unlock(&log_sys.mutex);
return err;
} }
bool recv_dblwr_t::validate_page(const page_id_t page_id, bool recv_dblwr_t::validate_page(const page_id_t page_id,
......
...@@ -1512,6 +1512,7 @@ int spider_db_append_key_hint( ...@@ -1512,6 +1512,7 @@ int spider_db_append_key_hint(
if (str->reserve( if (str->reserve(
hint_str_len - 2 + SPIDER_SQL_INDEX_USE_LEN + hint_str_len - 2 + SPIDER_SQL_INDEX_USE_LEN +
SPIDER_SQL_OPEN_PAREN_LEN + SPIDER_SQL_CLOSE_PAREN_LEN)) SPIDER_SQL_OPEN_PAREN_LEN + SPIDER_SQL_CLOSE_PAREN_LEN))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
hint_str += 2; hint_str += 2;
str->q_append(SPIDER_SQL_INDEX_USE_STR, SPIDER_SQL_INDEX_USE_LEN); str->q_append(SPIDER_SQL_INDEX_USE_STR, SPIDER_SQL_INDEX_USE_LEN);
str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
...@@ -1524,10 +1525,11 @@ int spider_db_append_key_hint( ...@@ -1524,10 +1525,11 @@ int spider_db_append_key_hint(
if (str->reserve( if (str->reserve(
hint_str_len - 3 + SPIDER_SQL_INDEX_IGNORE_LEN + hint_str_len - 3 + SPIDER_SQL_INDEX_IGNORE_LEN +
SPIDER_SQL_OPEN_PAREN_LEN + SPIDER_SQL_CLOSE_PAREN_LEN)) SPIDER_SQL_OPEN_PAREN_LEN + SPIDER_SQL_CLOSE_PAREN_LEN))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
hint_str += 3; hint_str += 3;
str->q_append(SPIDER_SQL_INDEX_IGNORE_STR, SPIDER_SQL_INDEX_IGNORE_LEN); str->q_append(SPIDER_SQL_INDEX_IGNORE_STR, SPIDER_SQL_INDEX_IGNORE_LEN);
str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
str->q_append(hint_str, hint_str_len - 2); str->q_append(hint_str, hint_str_len - 3);
str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN); str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
} else if (str->reserve(hint_str_len + SPIDER_SQL_SPACE_LEN)) } else if (str->reserve(hint_str_len + SPIDER_SQL_SPACE_LEN))
DBUG_RETURN(HA_ERR_OUT_OF_MEM); DBUG_RETURN(HA_ERR_OUT_OF_MEM);
......
...@@ -7686,8 +7686,8 @@ int spider_mbase_share::convert_key_hint_str() ...@@ -7686,8 +7686,8 @@ int spider_mbase_share::convert_key_hint_str()
roop_count < (int) table_share->keys; roop_count++, tmp_key_hint++) roop_count < (int) table_share->keys; roop_count++, tmp_key_hint++)
{ {
tmp_key_hint->length(0); tmp_key_hint->length(0);
if (tmp_key_hint->append(spider_share->key_hint->ptr(), if (tmp_key_hint->append(spider_share->key_hint[roop_count].ptr(),
spider_share->key_hint->length(), system_charset_info)) spider_share->key_hint[roop_count].length(), system_charset_info))
DBUG_RETURN(HA_ERR_OUT_OF_MEM); DBUG_RETURN(HA_ERR_OUT_OF_MEM);
} }
} else { } else {
......
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