The observed performance bottleneck can be addressed in two ways. The short-term solution is to retain the current file format and allow a more efficient assignment of the 128 rollback segments to transactions.
The long-term solution would be a file format change. When it comes to that, I noticed my old comment in MDEV-11657 (which is basically a scratchpad of loose ideas):
In DB_ROLL_PTR, the rollback segment ID could identify the undo tablespace. Theoretically, given that each DB_TRX_ID has only one persistent rollback segment, we would not even need that; MVCC could look up the undo tablespace based on the DB_TRX_ID. This would require extending main memory data structures so that some data of committed transactions would be stored until the transactions are purged.
We could repurpose the 7 bits in DB_ROLL_PTR to be flags for future use (always write them as zero from now on), and retire the TRX_SYS page which was demoted into a mere directory of undo tablespace header pages in MDEV-15158.
We could allow any number of undo tablespaces (much larger than 128). On startup, we would recover the undo log header pages from each undo tablespace that is found (based on a file name), as well as recover the rollback segment of each active transaction. Each undo tablespace could contain multiple rollback segments, as defined by the new undo tablespace format.
If we went this route, we would probably refuse server startup if the undo logs are not empty, so that we will not have to support two undo log formats in the same executable.
The observed performance bottleneck can be addressed in two ways. The short-term solution is to retain the current file format and allow a more efficient assignment of the 128 rollback segments to transactions.
The long-term solution would be a file format change. When it comes to that, I noticed my old comment in MDEV-11657 (which is basically a scratchpad of loose ideas):
We could repurpose the 7 bits in DB_ROLL_PTR to be flags for future use (always write them as zero from now on), and retire the TRX_SYS page which was demoted into a mere directory of undo tablespace header pages in
MDEV-15158.We could allow any number of undo tablespaces (much larger than 128). On startup, we would recover the undo log header pages from each undo tablespace that is found (based on a file name), as well as recover the rollback segment of each active transaction. Each undo tablespace could contain multiple rollback segments, as defined by the new undo tablespace format.
If we went this route, we would probably refuse server startup if the undo logs are not empty, so that we will not have to support two undo log formats in the same executable.