As noted in a commit message, we should not avoid writing anything to the TRX_SYS page during normal operation.
We still write some binlog and Galera write-set replication (WSREP) information on each commit to the TRX_SYS page. We do not really have to write this to that page; we can instead use rollback segment header pages (which commit is already modifying anyway).
To facilitate upgrade from older MySQL or MariaDB versions, we must read the information from the TRX_SYS page. Normally this information would be overridden by information that we find in the rollback segment header pages.
We choose pick the newest information from the rollback segment header pages. It is probably simplest to assign a 64-bit sequence number for this purpose, say, TRX_RSEG_COMMIT_INFO. On startup, we would only read this number if TRX_RSEG_FORMAT contains 0. When TRX_RSEG_FORMAT was introduced by repurposing TRX_RSEG_MAX_SIZE we would initialize the unused part of the rollback segment header page to 0.
If TRX_RSEG_FORMAT is 0 and TRX_RSEG_COMMIT_INFO is not 0, we would read the binlog and WSREP metadata into a global variable unless we already saw a bigger TRX_RSEG_COMMIT_INFO in some other rollback segment header page.
Note: 64 bits should be more than enough, because we can only have at most 1<<47 transactions (DB_TRX_ID is 48 bits, and trx_sys.get_max_trx_id() increments at transaction start and commit (actually twice at commit if the
MDEV-12894 mysql.transaction_registry table is being udpated).
Upgrade will trivially work: we will first read from the TRX_SYS page, and not find anything in the rollback segment header pages.
Downgrade is trivial too: After
MDEV-15132, any new transactions will be blocked, because the rollback segment headers will contain 0 in TRX_RSEG_MAX_SIZE.