Commit 24c9785a authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.2 into bb-10.2-ext

parents 5b697c5a 40bf5c95
......@@ -2401,8 +2401,15 @@ xtrabackup_copy_logfile(copy_logfile copy)
log_mutex_enter();
lsn_t lsn = log_group_read_log_seg(log_sys->buf, &log_sys->log,
start_lsn, end_lsn);
lsn_t lsn= start_lsn;
for(int retries= 0; retries < 100; retries++) {
if (log_group_read_log_seg(log_sys->buf, &log_sys->log,
&lsn, end_lsn)){
break;
}
msg("Retrying read of a redo log block");
my_sleep(1000);
}
start_lsn = xtrabackup_copy_log(copy, start_lsn, lsn);
......
......@@ -3274,5 +3274,21 @@ row_number() over (partition by i order by i) i
1 2
DROP TABLE t1;
#
# MDEV-13384: "window" seems like a reserved column name but it's not listed as one
#
# Currently we allow window as an identifier, except for table aliases.
#
CREATE TABLE door (id INT, window VARCHAR(10));
SELECT id
FROM door as window;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'window' at line 2
SELECT id, window
FROM door;
id window
SELECT id, window
FROM door as window;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'window' at line 2
DROP TABLE door;
#
# Start of 10.3 tests
#
CREATE TABLE t(i INT) ENGINE INNODB;
INSERT INTO t VALUES(1);
# xtrabackup backup
FOUND 1 /Invalid log block checksum/ in backup.log
INSERT INTO t VALUES(2);
# xtrabackup prepare
# shutdown server
# remove datadir
# xtrabackup move back
# restart server
SELECT * FROM t;
i
1
DROP TABLE t;
--source include/have_debug.inc
CREATE TABLE t(i INT) ENGINE INNODB;
INSERT INTO t VALUES(1);
echo # xtrabackup backup;
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log;
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,log_intermittent_checksum_mismatch > $backuplog;
--enable_result_log
--let SEARCH_RANGE = 10000000
--let SEARCH_PATTERN=Invalid log block checksum
--let SEARCH_FILE=$backuplog
--source include/search_pattern_in_file.inc
remove_file $backuplog;
INSERT INTO t VALUES(2);
echo # xtrabackup prepare;
--disable_result_log
exec $XTRABACKUP --prepare --target-dir=$targetdir;
-- source include/restart_and_restore.inc
--enable_result_log
SELECT * FROM t;
DROP TABLE t;
rmdir $targetdir;
......@@ -2037,6 +2037,27 @@ EXECUTE stmt;
DROP TABLE t1;
--echo #
--echo # MDEV-13384: "window" seems like a reserved column name but it's not listed as one
--echo #
--echo # Currently we allow window as an identifier, except for table aliases.
--echo #
CREATE TABLE door (id INT, window VARCHAR(10));
--error ER_PARSE_ERROR
SELECT id
FROM door as window;
SELECT id, window
FROM door;
--error ER_PARSE_ERROR
SELECT id, window
FROM door as window;
DROP TABLE door;
--echo #
--echo # Start of 10.3 tests
--echo #
......@@ -1616,7 +1616,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
IDENT_sys TEXT_STRING_sys TEXT_STRING_literal
opt_component key_cache_name
sp_opt_label BIN_NUM TEXT_STRING_filesystem ident_or_empty
opt_constraint constraint opt_ident
opt_constraint constraint opt_ident ident_table_alias
sp_decl_ident
sp_block_label opt_place opt_db
......@@ -1805,7 +1805,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%type <Lex_length_and_dec> precision opt_precision float_options
%type <symbol> keyword keyword_sp
%type <symbol> keyword keyword_sp keyword_alias
keyword_sp_data_type
keyword_sp_not_data_type
......@@ -11611,7 +11611,7 @@ table_alias:
opt_table_alias:
/* empty */ { $$=0; }
| table_alias ident
| table_alias ident_table_alias
{
$$= (LEX_CSTRING*) thd->memdup(&$2,sizeof(LEX_STRING));
if ($$ == NULL)
......@@ -14528,6 +14528,16 @@ TEXT_STRING_filesystem:
$$.length= to.length;
}
}
ident_table_alias:
IDENT_sys { $$= $1; }
| keyword_alias
{
$$.str= thd->strmake($1.str, $1.length);
if ($$.str == NULL)
MYSQL_YYABORT;
$$.length= $1.length;
}
;
ident:
......@@ -14642,8 +14652,8 @@ user: user_maybe_role
}
;
/* Keyword that we allow for identifiers (except SP labels) */
keyword:
/* Keywords which we allow as table aliases. */
keyword_alias:
keyword_sp {}
| keyword_sp_verb_clause{}
| ASCII_SYM {}
......@@ -14706,6 +14716,10 @@ keyword:
| UPGRADE_SYM {}
;
/* Keyword that we allow for identifiers (except SP labels) */
keyword: keyword_alias | WINDOW_SYM {};
/*
* Keywords that we allow for labels in SPs.
* Anything that's the beginning of a statement or characteristics
......
......@@ -99,14 +99,15 @@ recv_sys_debug_free(void);
/** Read a log segment to a buffer.
@param[out] buf buffer
@param[in] group redo log files
@param[in] start_lsn read area start
@param[in, out] start_lsn in : read area start, out: the last read valid lsn
@param[in] end_lsn read area end
@return valid end_lsn */
lsn_t
@param[out] invalid_block - invalid, (maybe incompletely written) block encountered
@return false, if invalid block encountered (e.g checksum mismatch), true otherwise */
bool
log_group_read_log_seg(
byte* buf,
const log_group_t* group,
lsn_t start_lsn,
lsn_t* start_lsn,
lsn_t end_lsn);
/********************************************************//**
......
......@@ -1979,6 +1979,7 @@ logs_empty_and_mark_files_at_shutdown(void)
goto wait_suspend_loop;
case SRV_PURGE:
case SRV_WORKER:
ut_ad(!"purge was not shut down");
srv_purge_wakeup();
thread_name = "purge thread";
goto wait_suspend_loop;
......
......@@ -608,28 +608,29 @@ recv_sys_debug_free(void)
/** Read a log segment to a buffer.
@param[out] buf buffer
@param[in] group redo log files
@param[in] start_lsn read area start
@param[in, out] start_lsn in : read area start, out: the last read valid lsn
@param[in] end_lsn read area end
@return valid end_lsn */
lsn_t
@param[out] invalid_block - invalid, (maybe incompletely written) block encountered
@return false, if invalid block encountered (e.g checksum mismatch), true otherwise */
bool
log_group_read_log_seg(
byte* buf,
const log_group_t* group,
lsn_t start_lsn,
lsn_t *start_lsn,
lsn_t end_lsn)
{
ulint len;
lsn_t source_offset;
bool success = true;
ut_ad(log_mutex_own());
ut_ad(!(start_lsn % OS_FILE_LOG_BLOCK_SIZE));
ut_ad(!(*start_lsn % OS_FILE_LOG_BLOCK_SIZE));
ut_ad(!(end_lsn % OS_FILE_LOG_BLOCK_SIZE));
loop:
source_offset = log_group_calc_lsn_offset(start_lsn, group);
source_offset = log_group_calc_lsn_offset(*start_lsn, group);
ut_a(end_lsn - start_lsn <= ULINT_MAX);
len = (ulint) (end_lsn - start_lsn);
ut_a(end_lsn - *start_lsn <= ULINT_MAX);
len = (ulint) (end_lsn - *start_lsn);
ut_ad(len != 0);
......@@ -659,16 +660,16 @@ log_group_read_log_seg(
for (ulint l = 0; l < len; l += OS_FILE_LOG_BLOCK_SIZE,
buf += OS_FILE_LOG_BLOCK_SIZE,
start_lsn += OS_FILE_LOG_BLOCK_SIZE) {
(*start_lsn) += OS_FILE_LOG_BLOCK_SIZE) {
const ulint block_number = log_block_get_hdr_no(buf);
if (block_number != log_block_convert_lsn_to_no(start_lsn)) {
if (block_number != log_block_convert_lsn_to_no(*start_lsn)) {
/* Garbage or an incompletely written log block.
We will not report any error, because this can
happen when InnoDB was killed while it was
writing redo log. We simply treat this as an
abrupt end of the redo log. */
end_lsn = start_lsn;
end_lsn = *start_lsn;
break;
}
......@@ -676,6 +677,13 @@ log_group_read_log_seg(
ulint crc = log_block_calc_checksum_crc32(buf);
ulint cksum = log_block_get_checksum(buf);
DBUG_EXECUTE_IF("log_intermittent_checksum_mismatch", {
static int block_counter;
if (block_counter++ == 0) {
cksum = crc + 1;
}
});
if (crc != cksum) {
ib::error() << "Invalid log block checksum."
<< " block: " << block_number
......@@ -683,30 +691,33 @@ log_group_read_log_seg(
<< log_block_get_checkpoint_no(buf)
<< " expected: " << crc
<< " found: " << cksum;
end_lsn = start_lsn;
end_lsn = *start_lsn;
success = false;
break;
}
if (group->is_encrypted()) {
log_crypt(buf, start_lsn,
log_crypt(buf, *start_lsn,
OS_FILE_LOG_BLOCK_SIZE, true);
}
}
}
if (recv_sys->report(ut_time())) {
ib::info() << "Read redo log up to LSN=" << start_lsn;
ib::info() << "Read redo log up to LSN=" << *start_lsn;
sd_notifyf(0, "STATUS=Read redo log up to LSN=" LSN_PF,
start_lsn);
*start_lsn);
}
if (start_lsn != end_lsn) {
if (*start_lsn != end_lsn) {
goto loop;
}
return(start_lsn);
return(success);
}
/********************************************************//**
Copies a log segment from the most up-to-date log group to the other log
groups, so that they all contain the latest log data. Also writes the info
......@@ -721,10 +732,10 @@ recv_synchronize_groups()
/* Read the last recovered log block to the recovery system buffer:
the block is always incomplete */
const lsn_t start_lsn = ut_uint64_align_down(recovered_lsn,
lsn_t start_lsn = ut_uint64_align_down(recovered_lsn,
OS_FILE_LOG_BLOCK_SIZE);
log_group_read_log_seg(log_sys->buf, &log_sys->log,
start_lsn, start_lsn + OS_FILE_LOG_BLOCK_SIZE);
&start_lsn, start_lsn + OS_FILE_LOG_BLOCK_SIZE);
/* Update the fields in the group struct to correspond to
recovered_lsn */
......@@ -2903,8 +2914,9 @@ recv_group_scan_log_recs(
start_lsn = ut_uint64_align_down(end_lsn,
OS_FILE_LOG_BLOCK_SIZE);
end_lsn = log_group_read_log_seg(
log_sys->buf, group, start_lsn,
end_lsn = start_lsn;
log_group_read_log_seg(
log_sys->buf, group, &end_lsn,
start_lsn + RECV_SCAN_SIZE);
} while (end_lsn != start_lsn
&& !recv_scan_log_recs(
......
......@@ -2980,8 +2980,11 @@ srv_purge_wakeup()
{
ut_ad(!srv_read_only_mode);
if (srv_force_recovery < SRV_FORCE_NO_BACKGROUND) {
if (srv_force_recovery >= SRV_FORCE_NO_BACKGROUND) {
return;
}
do {
srv_release_threads(SRV_PURGE, 1);
if (srv_n_purge_threads > 1) {
......@@ -2989,7 +2992,9 @@ srv_purge_wakeup()
srv_release_threads(SRV_WORKER, n_workers);
}
}
} while (!srv_running
&& (srv_sys.n_threads_active[SRV_WORKER]
|| srv_sys.n_threads_active[SRV_PURGE]));
}
/** Check if tablespace is being truncated.
......
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