Skip to content

Commit 5db9c6e

Browse files
committed
MDEV-15132 Avoid accessing the TRX_SYS page
trx_write_serialisation_history(): Only invoke trx_sysf_get() to exclusively lock the TRX_SYS page if some change really has to be written to the page. On transaction commit, we will still write some binlog and Galera WSREP XID information. FIXME: If this information has to be written, it should be partitioned into the rollback segment pages.
1 parent c7d0448 commit 5db9c6e

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

storage/innobase/trx/trx0trx.cc

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,20 +1336,28 @@ trx_write_serialisation_history(
13361336

13371337
MONITOR_INC(MONITOR_TRX_COMMIT_UNDO);
13381338

1339+
#ifdef WITH_WSREP
1340+
const bool update_wsrep = wsrep_is_wsrep_xid(trx->xid);
1341+
#endif
1342+
const bool update_binlog_pos = trx->mysql_log_file_name
1343+
&& *trx->mysql_log_file_name;
1344+
if (!update_binlog_pos
1345+
#ifdef WITH_WSREP
1346+
&& !update_wsrep
1347+
#endif
1348+
) return true;
1349+
13391350
buf_block_t* block = trx_sysf_get(mtr);
13401351
#ifdef WITH_WSREP
1341-
/* Update latest MySQL wsrep XID in trx sys header. */
1342-
if (wsrep_is_wsrep_xid(trx->xid)) {
1352+
if (update_wsrep)
13431353
trx_sys_update_wsrep_checkpoint(trx->xid, block, mtr);
1344-
}
13451354
#endif /* WITH_WSREP */
13461355

13471356
/* Update the latest MySQL binlog name and offset info
13481357
in trx sys header if MySQL binlogging is on or the database
13491358
server is a MySQL replication slave */
13501359

1351-
if (trx->mysql_log_file_name != NULL
1352-
&& trx->mysql_log_file_name[0] != '\0') {
1360+
if (update_binlog_pos) {
13531361

13541362
trx_sys_update_mysql_binlog_offset(
13551363
trx->mysql_log_file_name,

0 commit comments

Comments
 (0)