Skip to content

Commit 648d2da

Browse files
author
Daniele Sciascia
committed
MDEV-33540 Avoid writes to TRX_SYS page during mariabackup operations
Fix a scenario where `mariabackup --prepare` fails with assertion `!m_modifications || !recv_no_log_write' in `mtr_t::commit()`. This happens if the prepare step of the backup encounters a data directory which happens to store wsrep xid position in TRX SYS page (this is no longer the case since 10.3.5). And since MDEV-17458, `trx_rseg_array_init()` handles this case by copying the xid position to rollback segments, before clearing the xid from TRX SYS page. However, this step should be avoided when `trx_rseg_array_init()` is invoked from mariabackup. The relevant code was surrounded by the condition `srv_operation == SRV_OPERATION_NORMAL`. An additional check ensures that we are not trying to copy a xid position which has already zeroed.
1 parent 738da49 commit 648d2da

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

storage/innobase/trx/trx0rseg.cc

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,11 @@ bool trx_rseg_read_wsrep_checkpoint(const trx_rsegf_t* rseg_header, XID& xid)
207207
@return whether the WSREP XID is present */
208208
static bool trx_rseg_init_wsrep_xid(const page_t* page, XID& xid)
209209
{
210+
if (memcmp(TRX_SYS + TRX_SYS_WSREP_XID_INFO + page,
211+
field_ref_zero, TRX_SYS_WSREP_XID_LEN) == 0) {
212+
return false;
213+
}
214+
210215
if (mach_read_from_4(TRX_SYS + TRX_SYS_WSREP_XID_INFO
211216
+ TRX_SYS_WSREP_XID_MAGIC_N_FLD
212217
+ page)
@@ -570,10 +575,6 @@ static void trx_rseg_init_binlog_info(const page_t* page)
570575
+ TRX_SYS + page);
571576
trx_sys.recovered_binlog_is_legacy_pos= true;
572577
}
573-
574-
#ifdef WITH_WSREP
575-
trx_rseg_init_wsrep_xid(page, trx_sys.recovered_wsrep_xid);
576-
#endif
577578
}
578579

579580
/** Initialize or recover the rollback segments at startup. */
@@ -605,7 +606,11 @@ dberr_t trx_rseg_array_init()
605606
+ sys->frame);
606607
trx_rseg_init_binlog_info(sys->frame);
607608
#ifdef WITH_WSREP
608-
wsrep_sys_xid.set(&trx_sys.recovered_wsrep_xid);
609+
if (trx_rseg_init_wsrep_xid(
610+
sys->frame, trx_sys.recovered_wsrep_xid)) {
611+
wsrep_sys_xid.set(
612+
&trx_sys.recovered_wsrep_xid);
613+
}
609614
#endif
610615
}
611616

@@ -662,7 +667,7 @@ dberr_t trx_rseg_array_init()
662667
}
663668

664669
#ifdef WITH_WSREP
665-
if (!wsrep_sys_xid.is_null()) {
670+
if (srv_operation == SRV_OPERATION_NORMAL && !wsrep_sys_xid.is_null()) {
666671
/* Upgrade from a version prior to 10.3.5,
667672
where WSREP XID was stored in TRX_SYS page.
668673
If no rollback segment has a WSREP XID set,

0 commit comments

Comments
 (0)