Skip to content

Commit 22d4556

Browse files
committed
Merge branch '10.8' into 10.9
2 parents bfdc4ff + 75d631f commit 22d4556

File tree

574 files changed

+10528
-4203
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

574 files changed

+10528
-4203
lines changed

client/mysqldump.c

Lines changed: 25 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ static ulonglong opt_system= 0ULL;
148148
static my_bool insert_pat_inited= 0, debug_info_flag= 0, debug_check_flag= 0,
149149
select_field_names_inited= 0;
150150
static ulong opt_max_allowed_packet, opt_net_buffer_length;
151+
static double opt_max_statement_time= 0.0;
151152
static MYSQL mysql_connection,*mysql=0;
152153
static DYNAMIC_STRING insert_pat, select_field_names;
153154
static char *opt_password=0,*current_user=0,
@@ -164,6 +165,7 @@ static my_bool server_supports_switching_charsets= TRUE;
164165
static ulong opt_compatible_mode= 0;
165166
#define MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL 1
166167
#define MYSQL_OPT_MASTER_DATA_COMMENTED_SQL 2
168+
#define MYSQL_OPT_MAX_STATEMENT_TIME 0
167169
#define MYSQL_OPT_SLAVE_DATA_EFFECTIVE_SQL 1
168170
#define MYSQL_OPT_SLAVE_DATA_COMMENTED_SQL 2
169171
static uint opt_mysql_port= 0, opt_master_data;
@@ -475,6 +477,10 @@ static struct my_option my_long_options[] =
475477
&opt_max_allowed_packet, &opt_max_allowed_packet, 0,
476478
GET_ULONG, REQUIRED_ARG, 24*1024*1024, 4096,
477479
(longlong) 2L*1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
480+
{"max-statement-time", MYSQL_OPT_MAX_STATEMENT_TIME,
481+
"Max statement execution time. If unset, overrides server default with 0.",
482+
&opt_max_statement_time, &opt_max_statement_time, 0, GET_DOUBLE,
483+
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
478484
{"net_buffer_length", OPT_NET_BUFFER_LENGTH,
479485
"The buffer size for TCP/IP and socket communication.",
480486
&opt_net_buffer_length, &opt_net_buffer_length, 0,
@@ -3219,9 +3225,8 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
32193225
if (strcmp(field->name, "View") == 0)
32203226
{
32213227
char *scv_buff= NULL;
3222-
my_ulonglong n_cols;
32233228

3224-
verbose_msg("-- It's a view, create dummy table for view\n");
3229+
verbose_msg("-- It's a view, create dummy view for view\n");
32253230

32263231
/* save "show create" statement for later */
32273232
if ((row= mysql_fetch_row(result)) && (scv_buff=row[1]))
@@ -3230,9 +3235,9 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
32303235
mysql_free_result(result);
32313236

32323237
/*
3233-
Create a table with the same name as the view and with columns of
3238+
Create a view with the same name as the view and with columns of
32343239
the same name in order to satisfy views that depend on this view.
3235-
The table will be removed when the actual view is created.
3240+
The view will be removed when the actual view is created.
32363241
32373242
The properties of each column, are not preserved in this temporary
32383243
table, because they are not necessary.
@@ -3264,23 +3269,9 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
32643269
else
32653270
my_free(scv_buff);
32663271

3267-
n_cols= mysql_num_rows(result);
3268-
if (0 != n_cols)
3272+
if (mysql_num_rows(result) != 0)
32693273
{
32703274

3271-
/*
3272-
The actual formula is based on the column names and how the .FRM
3273-
files are stored and is too volatile to be repeated here.
3274-
Thus we simply warn the user if the columns exceed a limit we
3275-
know works most of the time.
3276-
*/
3277-
if (n_cols >= 1000)
3278-
fprintf(stderr,
3279-
"-- Warning: Creating a stand-in table for view %s may"
3280-
" fail when replaying the dump file produced because "
3281-
"of the number of columns exceeding 1000. Exercise "
3282-
"caution when replaying the produced dump file.\n",
3283-
table);
32843275
if (opt_drop)
32853276
{
32863277
/*
@@ -3296,7 +3287,7 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
32963287
fprintf(sql_file,
32973288
"SET @saved_cs_client = @@character_set_client;\n"
32983289
"SET character_set_client = utf8;\n"
3299-
"/*!50001 CREATE TABLE %s (\n",
3290+
"/*!50001 CREATE VIEW %s AS SELECT\n",
33003291
result_table);
33013292

33023293
/*
@@ -3308,28 +3299,21 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
33083299
row= mysql_fetch_row(result);
33093300

33103301
/*
3311-
The actual column type doesn't matter anyway, since the table will
3302+
The actual column value doesn't matter anyway, since the view will
33123303
be dropped at run time.
3313-
We do tinyint to avoid hitting the row size limit.
33143304
*/
3315-
fprintf(sql_file, " %s tinyint NOT NULL",
3305+
fprintf(sql_file, " 1 AS %s",
33163306
quote_name(row[0], name_buff, 0));
33173307

33183308
while((row= mysql_fetch_row(result)))
33193309
{
33203310
/* col name, col type */
3321-
fprintf(sql_file, ",\n %s tinyint NOT NULL",
3311+
fprintf(sql_file, ",\n 1 AS %s",
33223312
quote_name(row[0], name_buff, 0));
33233313
}
33243314

3325-
/*
3326-
Stand-in tables are always MyISAM tables as the default
3327-
engine might have a column-limit that's lower than the
3328-
number of columns in the view, and MyISAM support is
3329-
guaranteed to be in the server anyway.
3330-
*/
33313315
fprintf(sql_file,
3332-
"\n) ENGINE=MyISAM */;\n"
3316+
" */;\n"
33333317
"SET character_set_client = @saved_cs_client;\n");
33343318

33353319
check_io(sql_file);
@@ -6852,15 +6836,8 @@ static my_bool get_view_structure(char *table, char* db)
68526836
"\n--\n-- Final view structure for view %s\n--\n\n",
68536837
fix_for_comment(result_table));
68546838

6855-
/* Table might not exist if this view was dumped with --tab. */
6856-
fprintf(sql_file, "/*!50001 DROP TABLE IF EXISTS %s*/;\n", opt_quoted_table);
6857-
if (opt_drop)
6858-
{
6859-
fprintf(sql_file, "/*!50001 DROP VIEW IF EXISTS %s*/;\n",
6860-
opt_quoted_table);
6861-
check_io(sql_file);
6862-
}
6863-
6839+
/* View might not exist if this view was dumped with --tab. */
6840+
fprintf(sql_file, "/*!50001 DROP VIEW IF EXISTS %s*/;\n", opt_quoted_table);
68646841

68656842
my_snprintf(query, sizeof(query),
68666843
"SELECT CHECK_OPTION, DEFINER, SECURITY_TYPE, "
@@ -7032,6 +7009,7 @@ static void dynstr_realloc_checked(DYNAMIC_STRING *str, ulong additional_size)
70327009

70337010
int main(int argc, char **argv)
70347011
{
7012+
char query[48];
70357013
char bin_log_name[FN_REFLEN];
70367014
int exit_code;
70377015
int consistent_binlog_pos= 0;
@@ -7073,6 +7051,13 @@ int main(int argc, char **argv)
70737051
if (!path)
70747052
write_header(md_result_file, *argv);
70757053

7054+
/* Set MAX_STATEMENT_TIME to 0 unless set in client */
7055+
my_snprintf(query, sizeof(query), "/*!100100 SET @@MAX_STATEMENT_TIME=%f */", opt_max_statement_time);
7056+
mysql_query(mysql, query);
7057+
7058+
/* Set server side timeout between client commands to server compiled-in default */
7059+
mysql_query(mysql, "/*!100100 SET WAIT_TIMEOUT=DEFAULT */");
7060+
70767061
/* Check if the server support multi source */
70777062
if (mysql_get_server_version(mysql) >= 100000)
70787063
{

client/mysqlimport.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -574,13 +574,15 @@ static void safe_exit(int error, MYSQL *mysql)
574574
if (mysql)
575575
mysql_close(mysql);
576576

577-
mysql_library_end();
578-
free_defaults(argv_to_free);
579-
my_free(opt_password);
580577
if (error)
581578
sf_leaking_memory= 1; /* dirty exit, some threads are still running */
582579
else
580+
{
581+
mysql_library_end();
582+
free_defaults(argv_to_free);
583+
my_free(opt_password);
583584
my_end(my_end_arg); /* clean exit */
585+
}
584586
exit(error);
585587
}
586588

cmake/cpack_rpm.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ ELSEIF(RPM MATCHES "fedora" OR RPM MATCHES "(rhel|centos)7")
271271
ALTERNATIVE_NAME("server" "mariadb-server")
272272
ALTERNATIVE_NAME("server" "mysql-compat-server")
273273
ALTERNATIVE_NAME("test" "mariadb-test")
274-
ELSEIF(RPM MATCHES "(rhel|centos)8")
274+
ELSEIF(RPM MATCHES "(rhel|centos|rocky)[89]")
275275
SET(epoch 3:)
276276
ALTERNATIVE_NAME("backup" "mariadb-backup")
277277
ALTERNATIVE_NAME("client" "mariadb")

extra/mariabackup/backup_copy.cc

Lines changed: 18 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,7 @@ datafile_read(datafile_cur_t *cursor)
581581
Check to see if a file exists.
582582
Takes name of the file to check.
583583
@return true if file exists. */
584+
static
584585
bool
585586
file_exists(const char *filename)
586587
{
@@ -1482,14 +1483,14 @@ bool backup_start(CorruptedPages &corrupted_pages)
14821483
if (!write_galera_info(mysql_connection)) {
14831484
return(false);
14841485
}
1486+
// copied from xtrabackup. what is it needed for here?
1487+
write_current_binlog_file(mysql_connection);
14851488
}
14861489

1487-
bool with_binlogs = opt_binlog_info == BINLOG_INFO_ON;
1490+
if (opt_binlog_info == BINLOG_INFO_ON) {
14881491

1489-
if (with_binlogs || opt_galera_info) {
1490-
if (!write_current_binlog_file(mysql_connection, with_binlogs)) {
1491-
return(false);
1492-
}
1492+
lock_binlog_maybe(mysql_connection);
1493+
write_binlog_info(mysql_connection);
14931494
}
14941495

14951496
if (have_flush_engine_logs && !opt_no_lock) {
@@ -1525,33 +1526,13 @@ void backup_release()
15251526

15261527
static const char *default_buffer_pool_file = "ib_buffer_pool";
15271528

1528-
static
1529-
const char * get_buffer_pool_filename(size_t *length)
1530-
{
1531-
/* If mariabackup is run for Galera, then the file
1532-
name is changed to the default so that the receiving
1533-
node can find this file and rename it according to its
1534-
settings, otherwise we keep the original file name: */
1535-
size_t dir_length = 0;
1536-
const char *dst_name = default_buffer_pool_file;
1537-
if (!opt_galera_info) {
1538-
dir_length = dirname_length(buffer_pool_filename);
1539-
dst_name = buffer_pool_filename + dir_length;
1540-
}
1541-
if (length) {
1542-
*length=dir_length;
1543-
}
1544-
return dst_name;
1545-
}
1546-
15471529
/** Finish after backup_start() and backup_release() */
15481530
bool backup_finish()
15491531
{
15501532
/* Copy buffer pool dump or LRU dump */
1551-
if (!opt_rsync) {
1533+
if (!opt_rsync && opt_galera_info) {
15521534
if (buffer_pool_filename && file_exists(buffer_pool_filename)) {
1553-
const char *dst_name = get_buffer_pool_filename(NULL);
1554-
copy_file(ds_data, buffer_pool_filename, dst_name, 0);
1535+
copy_file(ds_data, buffer_pool_filename, default_buffer_pool_file, 0);
15551536
}
15561537
if (file_exists("ib_lru_dump")) {
15571538
copy_file(ds_data, "ib_lru_dump", "ib_lru_dump", 0);
@@ -1601,6 +1582,7 @@ ibx_copy_incremental_over_full()
16011582
char path[FN_REFLEN];
16021583
int i;
16031584

1585+
DBUG_ASSERT(!opt_galera_info);
16041586
datadir_node_init(&node);
16051587

16061588
/* If we were applying an incremental change set, we need to make
@@ -1637,19 +1619,6 @@ ibx_copy_incremental_over_full()
16371619
if (!(ret = backup_files_from_datadir(xtrabackup_incremental_dir)))
16381620
goto cleanup;
16391621

1640-
/* copy buffer pool dump */
1641-
if (innobase_buffer_pool_filename) {
1642-
const char *src_name = get_buffer_pool_filename(NULL);
1643-
1644-
snprintf(path, sizeof(path), "%s/%s",
1645-
xtrabackup_incremental_dir,
1646-
src_name);
1647-
1648-
if (file_exists(path)) {
1649-
copy_file(ds_data, path, src_name, 0);
1650-
}
1651-
}
1652-
16531622
/* copy supplementary files */
16541623

16551624
for (i = 0; sup_files[i]; i++) {
@@ -1878,14 +1847,6 @@ copy_back()
18781847

18791848
datadir_node_init(&node);
18801849

1881-
/* If mariabackup is run for Galera, then the file
1882-
name is changed to the default so that the receiving
1883-
node can find this file and rename it according to its
1884-
settings, otherwise we keep the original file name: */
1885-
size_t dir_length;
1886-
const char *src_buffer_pool;
1887-
src_buffer_pool = get_buffer_pool_filename(&dir_length);
1888-
18891850
while (datadir_iter_next(it, &node)) {
18901851
const char *ext_list[] = {"backup-my.cnf",
18911852
"xtrabackup_binary", "xtrabackup_binlog_info",
@@ -1947,10 +1908,10 @@ copy_back()
19471908
continue;
19481909
}
19491910

1950-
/* skip buffer pool dump */
1951-
if (!strcmp(filename, src_buffer_pool)) {
1952-
continue;
1953-
}
1911+
/* skip buffer pool dump */
1912+
if (!strcmp(filename, default_buffer_pool_file)) {
1913+
continue;
1914+
}
19541915

19551916
/* skip innodb data files */
19561917
for (Tablespace::const_iterator iter(srv_sys_space.begin()),
@@ -1970,19 +1931,11 @@ copy_back()
19701931

19711932
/* copy buffer pool dump */
19721933

1973-
if (file_exists(src_buffer_pool)) {
1974-
char dst_dir[FN_REFLEN];
1975-
while (IS_TRAILING_SLASH(buffer_pool_filename, dir_length)) {
1976-
dir_length--;
1977-
}
1978-
memcpy(dst_dir, buffer_pool_filename, dir_length);
1979-
dst_dir[dir_length] = 0;
1980-
if (!(ret = copy_or_move_file(src_buffer_pool,
1981-
src_buffer_pool,
1982-
dst_dir, 1)))
1983-
{
1984-
goto cleanup;
1985-
}
1934+
if (file_exists(default_buffer_pool_file) &&
1935+
innobase_buffer_pool_filename) {
1936+
copy_or_move_file(default_buffer_pool_file,
1937+
innobase_buffer_pool_filename,
1938+
mysql_data_home, 0);
19861939
}
19871940

19881941
rocksdb_copy_back();

extra/mariabackup/backup_copy.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,6 @@ copy_file(ds_ctxt_t *datasink,
3232
const char *dst_file_path,
3333
uint thread_n);
3434

35-
/************************************************************************
36-
Check to see if a file exists.
37-
Takes name of the file to check.
38-
@return true if file exists. */
39-
bool
40-
file_exists(const char *filename);
41-
4235
/** Start --backup */
4336
bool backup_start(CorruptedPages &corrupted_pages);
4437
/** Release resources after backup_start() */

0 commit comments

Comments
 (0)