Skip to content

Commit fd37344

Browse files
committed
Merge 10.3 into 10.4
2 parents 67e3d1e + 5fefcb0 commit fd37344

18 files changed

+180
-1314
lines changed

extra/mariabackup/fil_cur.cc

Lines changed: 49 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
3030
#include <trx0sys.h>
3131

3232
#include "fil_cur.h"
33+
#include "fil0crypt.h"
3334
#include "common.h"
3435
#include "read_filt.h"
3536
#include "xtrabackup.h"
@@ -230,7 +231,7 @@ xb_fil_cur_open(
230231

231232
posix_fadvise(cursor->file, 0, 0, POSIX_FADV_SEQUENTIAL);
232233

233-
const page_size_t page_size(cursor->node->space->flags);
234+
const page_size_t page_size(node->space->flags);
234235
cursor->page_size = page_size;
235236

236237
/* Allocate read buffer */
@@ -246,6 +247,19 @@ xb_fil_cur_open(
246247
cursor->buf_page_no = 0;
247248
cursor->thread_n = thread_n;
248249

250+
if (!node->space->crypt_data
251+
&& os_file_read(IORequestRead,
252+
node->handle, cursor->buf, 0,
253+
page_size.physical())) {
254+
mutex_enter(&fil_system.mutex);
255+
if (!node->space->crypt_data) {
256+
node->space->crypt_data
257+
= fil_space_read_crypt_data(page_size,
258+
cursor->buf);
259+
}
260+
mutex_exit(&fil_system.mutex);
261+
}
262+
249263
cursor->space_size = (ulint)(cursor->statinfo.st_size
250264
/ page_size.physical());
251265

@@ -267,14 +281,15 @@ xb_fil_cur_read(
267281
/*============*/
268282
xb_fil_cur_t* cursor) /*!< in/out: source file cursor */
269283
{
270-
ibool success;
271284
byte* page;
272285
ulint i;
273286
ulint npages;
274287
ulint retry_count;
275288
xb_fil_cur_result_t ret;
276289
ib_int64_t offset;
277290
ib_int64_t to_read;
291+
byte tmp_frame[UNIV_PAGE_SIZE_MAX];
292+
byte tmp_page[UNIV_PAGE_SIZE_MAX];
278293
const ulint page_size = cursor->page_size.physical();
279294
xb_ad(!cursor->is_system() || page_size == srv_page_size);
280295

@@ -317,6 +332,12 @@ xb_fil_cur_read(
317332
retry_count = 10;
318333
ret = XB_FIL_CUR_SUCCESS;
319334

335+
fil_space_t *space = fil_space_acquire_for_io(cursor->space_id);
336+
337+
if (!space) {
338+
return XB_FIL_CUR_ERROR;
339+
}
340+
320341
read_retry:
321342
xtrabackup_io_throttling();
322343

@@ -325,19 +346,11 @@ xb_fil_cur_read(
325346
cursor->buf_offset = offset;
326347
cursor->buf_page_no = (ulint)(offset / cursor->page_size.physical());
327348

328-
fil_space_t* space = fil_space_get(cursor->space_id);
329-
330-
if (!space) {
331-
return(XB_FIL_CUR_ERROR);
332-
}
333-
334-
success = os_file_read(IORequestRead,
335-
cursor->file, cursor->buf, offset,
336-
(ulint) to_read);
337-
if (!success) {
338-
return(XB_FIL_CUR_ERROR);
349+
if (!os_file_read(IORequestRead, cursor->file, cursor->buf, offset,
350+
(ulint) to_read)) {
351+
ret = XB_FIL_CUR_ERROR;
352+
goto func_exit;
339353
}
340-
341354
/* check pages for corruption and re-read if necessary. i.e. in case of
342355
partially written pages */
343356
for (page = cursor->buf, i = 0; i < npages;
@@ -348,11 +361,26 @@ xb_fil_cur_read(
348361
page_no >= FSP_EXTENT_SIZE &&
349362
page_no < FSP_EXTENT_SIZE * 3) {
350363
/* We ignore the doublewrite buffer pages */
351-
} else if (!fil_space_verify_crypt_checksum(
352-
page, cursor->page_size, space->id, page_no)
353-
&& buf_page_is_corrupted(true, page,
354-
cursor->page_size,
355-
space)) {
364+
} else if (fil_space_verify_crypt_checksum(
365+
page, cursor->page_size,
366+
space->id, page_no)) {
367+
ut_ad(mach_read_from_4(page + FIL_PAGE_SPACE_ID)
368+
== space->id);
369+
370+
bool decrypted = false;
371+
372+
memcpy(tmp_page, page, page_size);
373+
374+
if (!fil_space_decrypt(space, tmp_frame,
375+
tmp_page, &decrypted)
376+
|| buf_page_is_corrupted(true, tmp_page,
377+
cursor->page_size,
378+
space)) {
379+
goto corrupted;
380+
}
381+
} else if (buf_page_is_corrupted(true, page, cursor->page_size,
382+
space)) {
383+
corrupted:
356384
retry_count--;
357385
if (retry_count == 0) {
358386
msg("[%02u] mariabackup: "
@@ -372,15 +400,15 @@ xb_fil_cur_read(
372400
}
373401

374402
os_thread_sleep(100000);
375-
376403
goto read_retry;
377404
}
378405
cursor->buf_read += page_size;
379406
cursor->buf_npages++;
380407
}
381408

382409
posix_fadvise(cursor->file, offset, to_read, POSIX_FADV_DONTNEED);
383-
410+
func_exit:
411+
space->release_for_io();
384412
return(ret);
385413
}
386414

mysql-test/suite/innodb/r/innochecksum.result

Lines changed: 0 additions & 5 deletions
This file was deleted.

mysql-test/suite/innodb/r/innodb_zip_innochecksum.result

Lines changed: 0 additions & 91 deletions
This file was deleted.

mysql-test/suite/innodb/r/innodb_zip_innochecksum2.result

Lines changed: 0 additions & 160 deletions
This file was deleted.

0 commit comments

Comments
 (0)