Skip to content
/ server Public

Commit 054a893

Browse files
committed
Merge branch '10.11' into 11.4
2 parents 40f7084 + 3218602 commit 054a893

31 files changed

+883
-259
lines changed

extra/mariabackup/aria_backup_client.cc

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,10 @@ class Table {
161161
File m_data_file = -1;
162162
MY_STAT m_data_file_stat;
163163
};
164-
Table() = default;
164+
Table()
165+
{
166+
bzero(&m_cap, sizeof(m_cap));
167+
}
165168
Table (Table &&other) = delete;
166169
Table & operator= (Table &&other) = delete;
167170
Table(const Table &) = delete;
@@ -222,6 +225,7 @@ class Table {
222225
};
223226

224227
Table::~Table() {
228+
aria_free_capabilities(&m_cap);
225229
(void)close();
226230
}
227231

@@ -298,7 +302,8 @@ bool Table::open(MYSQL *con, bool opt_no_lock, unsigned thread_num) {
298302
goto exit;
299303
}
300304
if (!have_capabilities) {
301-
if ((error= aria_get_capabilities(partition.m_index_file, &m_cap))) {
305+
if ((error= aria_get_capabilities(partition.m_index_file,
306+
m_full_name.c_str(), &m_cap))) {
302307
msg(thread_num, "aria_get_capabilities failed: %d", error);
303308
goto exit;
304309
}
@@ -343,6 +348,7 @@ bool Table::open(MYSQL *con, bool opt_no_lock, unsigned thread_num) {
343348
}
344349

345350
bool Table::close() {
351+
aria_free_capabilities(&m_cap);
346352
for (Partition &partition : m_partitions) {
347353
if (partition.m_index_file >= 0) {
348354
my_close(partition.m_index_file, MYF(MY_WME));
@@ -409,14 +415,17 @@ bool Table::copy(ds_ctxt_t *ds, bool is_index, unsigned thread_num) {
409415
{
410416
if (error == HA_ERR_END_OF_FILE)
411417
break;
412-
msg(thread_num, "error: aria_read %s failed: %d",
413-
is_index ? "index" : "data", error);
418+
msg(thread_num, "error: aria_read %s from %s failed "
419+
"with error %d",
420+
is_index ? "index" : "data", full_name.c_str(),
421+
error);
414422
goto err;
415423
}
416424
xtrabackup_io_throttling();
417425
if ((error = ds_write(dst_file, copy_buffer, length))) {
418-
msg(thread_num, "error: aria_write failed: %d", error);
419-
goto err;
426+
msg(thread_num, "error: aria_write to %s failed "
427+
"with error: %d", dst_path, error);
428+
goto err;
420429
}
421430
}
422431

extra/mariabackup/backup_mysql.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,7 @@ bool get_mysql_vars(MYSQL *connection)
548548
xb_load_list_string(ignore_db_dirs, ",", register_ignore_db_dirs_filter);
549549

550550
out:
551+
free_mysql_variables(mysql_vars);
551552

552553
return (ret);
553554
}
@@ -1515,7 +1516,9 @@ write_galera_info(ds_ctxt *datasink, MYSQL *connection)
15151516
domain_id ? domain_id : domain_id55);
15161517

15171518
cleanup:
1519+
free_mysql_variables(vars);
15181520
free_mysql_variables(status);
1521+
free_mysql_variables(value);
15191522

15201523
return(result);
15211524
}

extra/mariabackup/encryption_plugin.cc

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
extern struct st_maria_plugin *mysql_optional_plugins[];
3030
extern struct st_maria_plugin *mysql_mandatory_plugins[];
3131
static void encryption_plugin_init(int argc, char **argv);
32+
void initialize_default_encryption();
3233

3334
extern char *xb_plugin_load;
3435
extern char *xb_plugin_dir;
@@ -140,7 +141,10 @@ void encryption_plugin_backup_init(MYSQL *mysql)
140141
}
141142
mysql_free_result(result);
142143
if (!plugin_load.length())
144+
{
145+
initialize_default_encryption();
143146
return;
147+
}
144148

145149
oss << "plugin_load=" << plugin_load.c_str() + 1 << std::endl;
146150

@@ -248,3 +252,45 @@ static void encryption_plugin_init(int argc, char **argv)
248252
plugin_init(&argc, argv, PLUGIN_INIT_SKIP_PLUGIN_TABLE);
249253
}
250254

255+
256+
/*
257+
Setup encryption_handler with default encryption to avoid crashes when
258+
calling encryption_get_key
259+
*/
260+
uint no_get_key(uint, uint, uchar*, uint*)
261+
{
262+
return ENCRYPTION_KEY_VERSION_INVALID;
263+
}
264+
uint no_key(uint)
265+
{
266+
return ENCRYPTION_KEY_VERSION_INVALID;
267+
}
268+
269+
static int ctx_init(void *ctx, const unsigned char* key, unsigned int klen,
270+
const unsigned char* iv, unsigned int ivlen, int flags,
271+
unsigned int key_id, unsigned int key_version)
272+
{
273+
return my_aes_crypt_init(ctx, MY_AES_CBC, flags, key, klen, iv, ivlen);
274+
}
275+
276+
static unsigned int get_length(unsigned int slen, unsigned int key_id,
277+
unsigned int key_version)
278+
{
279+
return my_aes_get_size(MY_AES_CBC, slen);
280+
}
281+
282+
uint ctx_size(unsigned int, unsigned int)
283+
{
284+
return MY_AES_CTX_SIZE;
285+
}
286+
287+
void initialize_default_encryption()
288+
{
289+
encryption_handler.encryption_ctx_size_func= ctx_size;
290+
encryption_handler.encryption_ctx_init_func= ctx_init;
291+
encryption_handler.encryption_ctx_update_func= my_aes_crypt_update;
292+
encryption_handler.encryption_ctx_finish_func= my_aes_crypt_finish;
293+
encryption_handler.encryption_encrypted_length_func= get_length;
294+
encryption_handler.encryption_key_get_func= no_get_key;
295+
encryption_handler.encryption_key_get_latest_version_func= no_key;
296+
}

extra/mariabackup/xtrabackup.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5507,6 +5507,7 @@ static bool xtrabackup_backup_func()
55075507
if (fil_system.is_initialised()) {
55085508
innodb_shutdown();
55095509
}
5510+
backup_datasinks.destroy();
55105511
return(false);
55115512
}
55125513

include/aria_backup.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,15 @@
1515

1616
/* Interfaces for doing backups of Aria tables */
1717

18+
#ifndef ARIA_BACKUP_INCLUDED
19+
1820
C_MODE_START
1921

2022
typedef struct st_aria_table_capabilities
2123
{
2224
my_off_t header_size;
25+
MARIA_CRYPT_DATA *crypt_data;
26+
uint crypt_page_header_space;
2327
ulong bitmap_pages_covered;
2428
uint block_size;
2529
uint keypage_header;
@@ -32,11 +36,15 @@ typedef struct st_aria_table_capabilities
3236
/* s3 capabilities */
3337
ulong s3_block_size;
3438
uint8 compression;
39+
char filename[FN_REFLEN];
3540
} ARIA_TABLE_CAPABILITIES;
3641

37-
int aria_get_capabilities(File kfile, ARIA_TABLE_CAPABILITIES *cap);
42+
int aria_get_capabilities(File kfile, const char *table_name, ARIA_TABLE_CAPABILITIES *cap);
43+
void aria_free_capabilities(ARIA_TABLE_CAPABILITIES *cap);
3844
int aria_read_index(File kfile, ARIA_TABLE_CAPABILITIES *cap, ulonglong block,
3945
uchar *buffer);
4046
int aria_read_data(File dfile, ARIA_TABLE_CAPABILITIES *cap, ulonglong block,
4147
uchar *buffer, size_t *bytes_read);
4248
C_MODE_END
49+
50+
#endif /* ARIA_BACKUP_INCLUDED */
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
connection node_2;
2+
connection node_1;
3+
#
4+
# 1. LOCK TABLE and INSERT
5+
#
6+
connection node_1;
7+
CREATE TABLE t1 (
8+
id varchar(100),
9+
PRIMARY KEY (id)) engine=innodb;
10+
CREATE TABLE t2 (
11+
id varchar(100) , a varchar(100),
12+
PRIMARY KEY (id,a),
13+
KEY a (a),
14+
CONSTRAINT FOREIGN KEY (a) REFERENCES t1 (id)
15+
) ENGINE=InnoDB;
16+
CREATE TABLE t3 (
17+
a varchar(100),
18+
b varchar(100) ,
19+
PRIMARY KEY (a, b),
20+
CONSTRAINT FOREIGN KEY (a) REFERENCES t2 (a)
21+
) ENGINE=InnoDB;
22+
LOCK TABLES t1 WRITE;
23+
INSERT INTO t1 VALUES ('a');
24+
UNLOCK TABLES;
25+
connection node_2;
26+
select * from t1;
27+
id
28+
a
29+
connection node_1;
30+
select * from t1;
31+
id
32+
a
33+
DROP TABLE t3, t2, t1;
34+
#
35+
# 2. FLUSH TABLES WITH READ LOCK and INSERT
36+
#
37+
connection node_1;
38+
CREATE TABLE t1 (
39+
id varchar(100),
40+
PRIMARY KEY (id)) engine=innodb;
41+
CREATE TABLE t2 (
42+
id varchar(100) , a varchar(100),
43+
PRIMARY KEY (id,a),
44+
KEY a (a),
45+
CONSTRAINT FOREIGN KEY (a) REFERENCES t1 (id)
46+
) ENGINE=InnoDB;
47+
CREATE TABLE t3 (
48+
a varchar(100),
49+
b varchar(100) ,
50+
PRIMARY KEY (a, b),
51+
CONSTRAINT FOREIGN KEY (a) REFERENCES t2 (a)
52+
) ENGINE=InnoDB;
53+
FLUSH TABLES WITH READ LOCK;
54+
INSERT INTO t1 VALUES ('a');
55+
ERROR HY000: Can't execute the query because you have a conflicting read lock
56+
UNLOCK TABLES;
57+
connection node_2;
58+
select * from t1;
59+
id
60+
connection node_1;
61+
select * from t1;
62+
id
63+
DROP TABLE t3, t2, t1;

mysql-test/suite/galera/r/galera_multi_level_fk_ddl_insert.result

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ connection node_2;
4848
SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached";
4949
SET SESSION wsrep_sync_wait = 0;
5050
connection node_1;
51-
SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table';
5251
START TRANSACTION;
5352
INSERT INTO t1 VALUES (3,0);
5453
COMMIT;
@@ -62,10 +61,6 @@ connection node_1;
6261
SET DEBUG_SYNC = 'RESET';
6362
SET GLOBAL DEBUG_DBUG = "";
6463
SET GLOBAL wsrep_slave_threads=DEFAULT;
65-
connection node_1;
66-
include/assert_grep.inc [Foreign key referenced table found: 2 tables]
67-
include/assert_grep.inc [Foreign key referenced table found: test.t2]
68-
include/assert_grep.inc [Foreign key referenced table found: test.t3]
6964
connection node_2;
7065
select * from t1;
7166
id f2
@@ -146,7 +141,6 @@ connection node_2;
146141
SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached";
147142
SET SESSION wsrep_sync_wait = 0;
148143
connection node_1;
149-
SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table';
150144
START TRANSACTION;
151145
INSERT INTO t1 VALUES (3,0);
152146
COMMIT;
@@ -160,11 +154,6 @@ connection node_1;
160154
SET DEBUG_SYNC = 'RESET';
161155
SET GLOBAL DEBUG_DBUG = "";
162156
SET GLOBAL wsrep_slave_threads=DEFAULT;
163-
connection node_1;
164-
include/assert_grep.inc [Foreign key referenced table found: 3 tables]
165-
include/assert_grep.inc [Foreign key referenced table found: test.t2]
166-
include/assert_grep.inc [Foreign key referenced table found: test.t3]
167-
include/assert_grep.inc [Foreign key referenced table found: test.t4]
168157
connection node_2;
169158
select * from t1;
170159
id f2
@@ -233,7 +222,6 @@ connection node_2;
233222
SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached";
234223
SET SESSION wsrep_sync_wait = 0;
235224
connection node_1;
236-
SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table';
237225
START TRANSACTION;
238226
INSERT INTO t1 VALUES (3,0);
239227
COMMIT;
@@ -247,11 +235,6 @@ connection node_1;
247235
SET DEBUG_SYNC = 'RESET';
248236
SET GLOBAL DEBUG_DBUG = "";
249237
SET GLOBAL wsrep_slave_threads=DEFAULT;
250-
connection node_1;
251-
include/assert_grep.inc [Foreign key referenced table found: 2 tables]
252-
include/assert_grep.inc [Foreign key referenced table found: test.t2]
253-
include/assert_grep.inc [Foreign key referenced table found: test.t3]
254-
include/assert_grep.inc [Foreign key referenced table found: test.t4]
255238
connection node_2;
256239
select * from t1;
257240
id f2
@@ -323,7 +306,6 @@ connection node_2;
323306
SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached";
324307
SET SESSION wsrep_sync_wait = 0;
325308
connection node_1;
326-
SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table';
327309
START TRANSACTION;
328310
INSERT INTO t1 VALUES (3,0);
329311
COMMIT;
@@ -337,10 +319,6 @@ connection node_1;
337319
SET DEBUG_SYNC = 'RESET';
338320
SET GLOBAL DEBUG_DBUG = "";
339321
SET GLOBAL wsrep_slave_threads=DEFAULT;
340-
connection node_1;
341-
include/assert_grep.inc [Foreign key referenced table found: 1 tables]
342-
include/assert_grep.inc [Foreign key referenced table found: test.t2]
343-
include/assert_grep.inc [Foreign key referenced table found: test.t3]
344322
connection node_2;
345323
select * from t1;
346324
id f2

0 commit comments

Comments
 (0)