Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDEV-35151 DDL recovery for high-level indexes #3520

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
1054d9f
MDEV-35092 Server crash, hang or ASAN errors in mysql_create_frm_imag…
vuvova Oct 8, 2024
4851c9c
MDEV-35104 Invalid (old?) table or database name upon DDL on table wi…
vuvova Oct 8, 2024
4a7d5ad
MDEV-35105 Assertion `tab->join->order' fails upon vector search with…
vuvova Oct 9, 2024
d8b17e7
10.11: MDEV-34062: Implement innodb_log_file_mmap on 64-bit systems
dr-m Sep 26, 2024
3455b75
10.11: MDEV-34907 Bogus assertion failure and busy work while parsing…
dr-m Sep 27, 2024
3ae5228
10.11: MDEV-34450 os_file_write_func() is an overkill for ib_logfile0
dr-m Sep 30, 2024
5fbe012
10.11: MDEV-34850: Busy work while parsing FILE_ records
dr-m Oct 4, 2024
53a8fc7
MDEV-33410 VECTOR data type
vuvova Oct 13, 2024
2d97a18
MDEV-35141 Server crashes in Field_vector::report_wrong_value upon st…
vuvova Oct 15, 2024
eda25a9
MDEV-35147 Inconsistent NULL handling in vector type
vuvova Oct 15, 2024
bbcb487
MDEV-35150 Column containing non-vector tables can be modified to VEC…
vuvova Oct 15, 2024
80cc1a8
MDEV-35158 Assertion `res->length() > 0 && res->length() % 4 == 0' fa…
vuvova Oct 15, 2024
65e08ca
Vec_ToText was underestimating max_length of the result
vuvova Oct 15, 2024
6062da1
cleanup: remove String::append_float
vuvova Oct 15, 2024
a98ceb5
MDEV-35159 Assertion `tab->join->select_limit < (~ (ha_rows) 0)' fail…
vuvova Oct 16, 2024
c1f2fd4
fixup! MDEV-35092
vuvova Oct 17, 2024
f1a1e4f
add MYSQL_TYPE_VECTOR for MySQL compatibility
vuvova Oct 16, 2024
f6e14d4
MDEV-35160 RBR does not work with vector type, ER_SLAVE_CONVERSION_FA…
vuvova Oct 16, 2024
b438ae0
add MYSQL_TYPE_VECTOR for MySQL compatibility. protocol
vuvova Oct 16, 2024
57a66e1
MDEV-35178 Assertion failure in Field_vector::store upon INSERT IGNOR…
vuvova Oct 17, 2024
83503da
MDEV-35176 ASAN errors in Field_vector::store with optimizer_trace en…
vuvova Oct 17, 2024
1a59071
MDEV-35177 Unexpected ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, diagnostics…
vuvova Oct 17, 2024
b24e34e
MDEV-35182 crash in online_alter_end_trans with XA over vector indexes
vuvova Oct 17, 2024
1959d43
MDEV-35191 Assertion failure in Create_tmp_table::finalize upon DISTI…
vuvova Oct 18, 2024
763ec2a
Revert "add MYSQL_TYPE_VECTOR for MySQL compatibility. protocol"
vuvova Oct 19, 2024
540ad30
Revert "add MYSQL_TYPE_VECTOR for MySQL compatibility"
vuvova Oct 19, 2024
d8447d9
MDEV-35160 RBR does not work with vector type, ER_SLAVE_CONVERSION_FA…
vuvova Oct 19, 2024
8f2be85
MDEV-35177 Unexpected ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, diagnostics…
vuvova Oct 19, 2024
4dfa605
MDEV-35204 mysqlbinlog --verbose fails on row events with vector type
vuvova Oct 19, 2024
9452b2e
MDEV-35195 Assertion `tab->join->order' fails upon vector search with…
vuvova Oct 19, 2024
f9f651f
MDEV-35203 ASAN errors or assertion failures in row_sel_convert_mysql…
vuvova Oct 19, 2024
3a3e8fa
MDEV-35194 non-BNL join fails on assertion
vuvova Oct 19, 2024
20673d6
MDEV-35212 Server crashes in Item_func_vec_fromtext::val_str upon que…
vuvova Oct 19, 2024
643f036
MDEV-35210 Vector type cannot store values which VEC_FromText produce…
vuvova Oct 19, 2024
99dd28d
MDEV-35205 Server crash in online alter upon concurrent ALTER and DML…
vuvova Oct 20, 2024
93b15e9
MDEV-35213 Server crash or assertion failure upon query with high val…
vuvova Oct 20, 2024
c290163
MDEV-35215 ASAN errors in Item_func_vec_fromtext::val_str upon VEC_FR…
vuvova Oct 20, 2024
670f3a6
MDEV-34919 - Aria crashes with high-level (vector) indexes
svoj Oct 10, 2024
3869f7a
DDL recovery for high-level indexes
svoj Sep 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cmake/os/WindowsCache.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ SET(HAVE_GETIFADDRS CACHE INTERNAL "")
SET(HAVE_GETCWD 1 CACHE INTERNAL "")
SET(HAVE_GETHOSTBYADDR_R CACHE INTERNAL "")
SET(HAVE_GETHRTIME CACHE INTERNAL "")
SET(HAVE_GETPAGESIZE CACHE INTERNAL "")
SET(HAVE_GETPASS CACHE INTERNAL "")
SET(HAVE_GETMNTENT CACHE INTERNAL "")
SET(HAVE_GETMNTENT_IN_SYS_MNTAB CACHE INTERNAL "")
Expand Down
1 change: 0 additions & 1 deletion config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@
#cmakedefine HAVE_GETCWD 1
#cmakedefine HAVE_GETHOSTBYADDR_R 1
#cmakedefine HAVE_GETHRTIME 1
#cmakedefine HAVE_GETPAGESIZE 1
#cmakedefine HAVE_GETPAGESIZES 1
#cmakedefine HAVE_GETPASS 1
#cmakedefine HAVE_GETPASSPHRASE 1
Expand Down
1 change: 0 additions & 1 deletion configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,6 @@ CHECK_SYMBOL_EXISTS(madvise "sys/mman.h" HAVE_DECL_MADVISE)
CHECK_SYMBOL_EXISTS(getpagesizes "sys/mman.h" HAVE_GETPAGESIZES)
CHECK_SYMBOL_EXISTS(tzname "time.h" HAVE_TZNAME)
CHECK_SYMBOL_EXISTS(lrand48 "stdlib.h" HAVE_LRAND48)
CHECK_SYMBOL_EXISTS(getpagesize "unistd.h" HAVE_GETPAGESIZE)
CHECK_SYMBOL_EXISTS(TIOCGWINSZ "sys/ioctl.h" GWINSZ_IN_SYS_IOCTL)
CHECK_SYMBOL_EXISTS(FIONREAD "sys/ioctl.h" FIONREAD_IN_SYS_IOCTL)
CHECK_SYMBOL_EXISTS(TIOCSTAT "sys/ioctl.h" TIOCSTAT_IN_SYS_IOCTL)
Expand Down
150 changes: 130 additions & 20 deletions extra/mariabackup/xtrabackup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ lsn_t checkpoint_lsn_start;
lsn_t checkpoint_no_start;
/** whether log_copying_thread() is active; protected by recv_sys.mutex */
static bool log_copying_running;
/** for --backup, target LSN to copy the log to; protected by recv_sys.mutex */
lsn_t metadata_to_lsn;

uint xtrabackup_parallel;

Expand Down Expand Up @@ -235,7 +237,6 @@ my_bool opt_encrypted_backup;
/* === metadata of backup === */
char metadata_type[30] = ""; /*[full-backuped|log-applied|incremental]*/
static lsn_t metadata_from_lsn;
lsn_t metadata_to_lsn;
static lsn_t metadata_last_lsn;

static ds_file_t* dst_log_file;
Expand Down Expand Up @@ -281,9 +282,6 @@ my_bool xtrabackup_incremental_force_scan = FALSE;
*/
ulong xtrabackup_innodb_force_recovery = 0;

/* The flushed lsn which is read from data files */
lsn_t flushed_lsn= 0;

ulong xb_open_files_limit= 0;
char *xb_plugin_dir;
char *xb_plugin_load;
Expand Down Expand Up @@ -1329,6 +1327,9 @@ enum options_xtrabackup
OPT_INNODB_BUFFER_POOL_FILENAME,
OPT_INNODB_LOCK_WAIT_TIMEOUT,
OPT_INNODB_LOG_BUFFER_SIZE,
#ifdef HAVE_INNODB_MMAP
OPT_INNODB_LOG_FILE_MMAP,
#endif
#if defined __linux__ || defined _WIN32
OPT_INNODB_LOG_FILE_BUFFERING,
#endif
Expand Down Expand Up @@ -1892,6 +1893,13 @@ struct my_option xb_server_options[] =
(G_PTR*) &log_sys.buf_size, (G_PTR*) &log_sys.buf_size, 0,
GET_UINT, REQUIRED_ARG, 2U << 20,
2U << 20, log_sys.buf_size_max, 0, 4096, 0},
#ifdef HAVE_INNODB_MMAP
{"innodb_log_file_mmap", OPT_INNODB_LOG_FILE_SIZE,
"Whether ib_logfile0 should be memory-mapped",
(G_PTR*) &log_sys.log_mmap,
(G_PTR*) &log_sys.log_mmap, 0, GET_BOOL, NO_ARG,
log_sys.log_mmap_default, 0, 0, 0, 0, 0},
#endif
#if defined __linux__ || defined _WIN32
{"innodb_log_file_buffering", OPT_INNODB_LOG_FILE_BUFFERING,
"Whether the file system cache for ib_logfile0 is enabled during --backup",
Expand Down Expand Up @@ -3389,25 +3397,128 @@ static my_bool xtrabackup_copy_datafile(ds_ctxt *ds_data,
return(FALSE);
}

#ifdef HAVE_INNODB_MMAP
static int
xtrabackup_copy_mmap_snippet(ds_file_t *ds, const byte *start, const byte *end)
{
if (UNIV_UNLIKELY(start > end))
{
if (int r= ds_write(ds, start, log_sys.buf + log_sys.file_size - start))
return r;
start= log_sys.buf + log_sys.START_OFFSET;
}
return ds_write(ds, start, end - start);
}

/** Copy memory-mapped log until the end of the log is reached
or the log_copying_stop signal is received
@return whether the operation failed */
static bool xtrabackup_copy_mmap_logfile()
{
mysql_mutex_assert_owner(&recv_sys.mutex);
recv_sys.offset= size_t(log_sys.calc_lsn_offset(recv_sys.lsn));
recv_sys.len= size_t(log_sys.file_size);
const size_t seq_offset{log_sys.is_encrypted() ? 8U + 5U : 5U};
const char one{'\1'};

for (unsigned retry_count{0};;)
{
recv_sys_t::parse_mtr_result r;
const byte *start= &log_sys.buf[recv_sys.offset];

if (recv_sys.parse_mmap<recv_sys_t::store::BACKUP>(false) ==
recv_sys_t::OK)
{
const byte *end;

do
{
/* Set the sequence bit (the backed-up log will not wrap around) */
size_t seqo= recv_sys.offset - seq_offset;
if (seqo < log_sys.START_OFFSET)
seqo+= log_sys.file_size - log_sys.START_OFFSET;
const byte *seq= &log_sys.buf[seqo];
ut_ad(*seq == log_sys.get_sequence_bit(recv_sys.lsn - seq_offset));
if (!*seq)
{
if (xtrabackup_copy_mmap_snippet(dst_log_file, start, seq) ||
ds_write(dst_log_file, &one, 1))
goto write_error;
start = seq + 1;
}
}
while ((r= recv_sys.parse_mmap<recv_sys_t::store::BACKUP>(false)) ==
recv_sys_t::OK);

end= &log_sys.buf[recv_sys.offset];

if (xtrabackup_copy_mmap_snippet(dst_log_file, start, end))
{
write_error:
msg("Error: write to ib_logfile0 failed");
return true;
}

start= end;

pthread_cond_broadcast(&scanned_lsn_cond);

if (r == recv_sys_t::GOT_EOF)
break;

retry_count= 0;
}
else
{
if (metadata_to_lsn)
{
if (metadata_to_lsn <= recv_sys.lsn)
return false;
}
else if (xtrabackup_throttle && io_ticket-- < 0)
mysql_cond_wait(&wait_throttle, &recv_sys.mutex);

if (!retry_count++)
msg("Retrying read of log at LSN=" LSN_PF, recv_sys.lsn);
else if (retry_count == 100)
break;
else
{
timespec abstime;
set_timespec_nsec(abstime, 1000000ULL /* 1 ms */);
if (!mysql_cond_timedwait(&log_copying_stop, &recv_sys.mutex,
&abstime))
return true;
}
}
}

if (verbose)
msg(">> log scanned up to (" LSN_PF ")", recv_sys.lsn);
return false;
}
#endif

/** Copy redo log until the current end of the log is reached
@return whether the operation failed */
@return whether the operation failed */
static bool xtrabackup_copy_logfile()
{
mysql_mutex_assert_owner(&recv_sys.mutex);
DBUG_EXECUTE_IF("log_checksum_mismatch", return false;);

ut_a(dst_log_file);
ut_ad(recv_sys.is_initialised());

#ifdef HAVE_INNODB_MMAP
if (log_sys.is_mmap())
return xtrabackup_copy_mmap_logfile();
#endif
const size_t sequence_offset{log_sys.is_encrypted() ? 8U + 5U : 5U};
const size_t block_size_1{log_sys.write_size - 1};

ut_ad(!log_sys.is_pmem());

{
recv_sys.offset= size_t(recv_sys.lsn - log_sys.get_first_lsn()) &
block_size_1;
recv_sys.len= 0;
}
recv_sys.offset= size_t(recv_sys.lsn - log_sys.get_first_lsn()) &
block_size_1;
recv_sys.len= 0;

for (unsigned retry_count{0};;)
{
Expand Down Expand Up @@ -3442,7 +3553,8 @@ static bool xtrabackup_copy_logfile()
if (log_sys.buf[recv_sys.offset] <= 1)
break;

if (recv_sys.parse_mtr<false>(false) == recv_sys_t::OK)
if (recv_sys.parse_mtr<recv_sys_t::store::BACKUP>(false) ==
recv_sys_t::OK)
{
do
{
Expand All @@ -3452,7 +3564,8 @@ static bool xtrabackup_copy_logfile()
sequence_offset));
*seq= 1;
}
while ((r= recv_sys.parse_mtr<false>(false)) == recv_sys_t::OK);
while ((r= recv_sys.parse_mtr<recv_sys_t::store::BACKUP>(false)) ==
recv_sys_t::OK);

if (ds_write(dst_log_file, log_sys.buf + start_offset,
recv_sys.offset - start_offset))
Expand Down Expand Up @@ -5328,9 +5441,8 @@ static bool xtrabackup_backup_func()
goto fail;
}

if (!log_sys.create()) {
goto fail;
}
log_sys.create();

/* get current checkpoint_lsn */
{
log_sys.latch.wr_lock(SRW_LOCK_CALL);
Expand Down Expand Up @@ -6681,9 +6793,7 @@ static bool xtrabackup_prepare_func(char** argv)
}

recv_sys.create();
if (!log_sys.create()) {
goto error;
}
log_sys.create();
recv_sys.recovery_on = true;

xb_fil_io_init();
Expand Down
4 changes: 0 additions & 4 deletions include/my_sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -1069,11 +1069,7 @@ extern int my_win_pclose(FILE*);
#endif

/* my_getpagesize */
#ifdef HAVE_GETPAGESIZE
#define my_getpagesize() getpagesize()
#else
int my_getpagesize(void);
#endif

int my_msync(int, void *, size_t, int);

Expand Down
2 changes: 1 addition & 1 deletion libmysqld/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/sql_mode.cc
../sql/sql_type_string.cc
../sql/sql_type_json.cc
../sql/sql_type_geom.cc
../sql/sql_type_geom.cc ../sql/sql_type_vector.cc
../sql/table_cache.cc ../sql/mf_iocache_encr.cc
../sql/wsrep_dummy.cc ../sql/encryption.cc
../sql/item_windowfunc.cc ../sql/sql_window.cc
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/main/blackhole.result
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ DROP TABLE `t`;
#
# MDEV-35035 Assertion failure in ha_blackhole::position upon INSERT into blackhole table with vector index
#
create table t (a int, v blob not null, vector index (v)) engine=blackhole;
create table t (a int, v vector(1) not null, vector index (v)) engine=blackhole;
insert into t values (1,x'00000000');
drop table t;
# End of 11.7 tests
2 changes: 1 addition & 1 deletion mysql-test/main/blackhole.test
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ DROP TABLE `t`;
--echo #
--echo # MDEV-35035 Assertion failure in ha_blackhole::position upon INSERT into blackhole table with vector index
--echo #
create table t (a int, v blob not null, vector index (v)) engine=blackhole;
create table t (a int, v vector(1) not null, vector index (v)) engine=blackhole;
insert into t values (1,x'00000000');
drop table t;

Expand Down
2 changes: 1 addition & 1 deletion mysql-test/main/plugin.result
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=EXAMPLE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci `VAROPT`=33
) ENGINE=EXAMPLE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci `varopt`=33
drop table t1;
SET @@SQL_MODE=@OLD_SQL_MODE;
select 1;
Expand Down
Loading