Bug #109134 rseg->trx_ref_count is incorrect when truncating undo log
Submitted: 18 Nov 2022 10:00 Modified: 18 Nov 2022 16:06
Reporter: songlei wang Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.7.21 OS:CentOS
Assigned to: CPU Architecture:Any
Tags: undo truncate

[18 Nov 2022 10:00] songlei wang
Description:
An undo log can not be truncated. Some variables are as follows:
show global variables like '%_undo_%'
innodb_max_undo_log_size    1073741824
innodb_undo_directory   /data/mysql/
innodb_undo_log_truncate    ON
innodb_undo_logs    128
innodb_undo_tablespaces 3

/data/mysql# du -h -c undo00*
2.1G    undo001
200G    undo002
201G    undo003

Some memory information of mysqld which is collected by gdb as follows:
1. one rseg blocks the truncate operation of the undo log due to the value of rseg->trx_ref_count is 1.

2. the history length in all undo logs is 0

3. rw_trx_list has no trx in it.

4. mysql_trx_list has only one trx, it has not be started and has no rsegs assigned.

Maybe some 'rseg->trx_ref_count--' losts.

How to repeat:
no repeate
[18 Nov 2022 16:06] MySQL Verification Team
Hi Mr. wang,

Thank you for your bug report.

However, your report is about a release that is very , very old.

Please try 8.0.31.

Unsupported.
[18 Nov 2022 16:07] MySQL Verification Team
Please, also let us know where do we describe truncation of the undo log in our Reference Manual.

That operation was not supported in 5.7.