Skip to content

Bug - Increase in Innodb_history_list_length #430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
davinc71998 opened this issue Aug 23, 2023 · 1 comment
Closed

Bug - Increase in Innodb_history_list_length #430

davinc71998 opened this issue Aug 23, 2023 · 1 comment

Comments

@davinc71998
Copy link
Contributor

Problem

MySQL 8.0+: The value of Innodb_history_list_length steadily increases after running the program
The increase in Innodb_history_list_length is expected to have the following effects on MySQL

  • Increased response time to user query

Bug description

def __get_table_information(self, schema, table):
for i in range(1, 3):
try:
if not self.__connected_ctl:
self.__connect_to_ctl()
cur = self._ctl_connection.cursor()
cur.execute("""
SELECT
COLUMN_NAME, COLLATION_NAME, CHARACTER_SET_NAME,
COLUMN_COMMENT, COLUMN_TYPE, COLUMN_KEY, ORDINAL_POSITION,
DATA_TYPE, CHARACTER_OCTET_LENGTH
FROM
information_schema.columns
WHERE
table_schema = %s AND table_name = %s
ORDER BY ORDINAL_POSITION
""", (schema, table))

According to the logic written in binlogstream.py
After executing a query through the cursor, the transaction remains in place until the program exits

스크린샷 2023-08-22 오후 11 06 03

the transaction is being maintained, the Innodb_history_list_length value will continue to increase when DML is performed.
KakaoTalk_Photo_2023-08-22-23-18-38

Solution

After executing the query, COMMIT the transaction so that it can be terminated normally.

@dongwook-chan
Copy link
Collaborator

I'm glad that this issue was created and hope this issue is immediately attended. I work at Kakao which operates the most prominent messaging service in South Korea. My team integrated the python-mysql-replication for a range of applications. However, given the substantial DML traffic we handle (we have about 48m monthly active users), we observed a surge in Innodb_history_list_length, leading to challenges like delayed query responses and heightened server load.

@davinc71998 davinc71998 changed the title Bug - Increase in Innodb_historyh_list_length Bug - Increase in Innodb_history_list_length Aug 23, 2023
julien-duponchelle pushed a commit that referenced this issue Aug 23, 2023
Overview

issue number #430

When using the pymysqlreplication package, there was a recurring issue with the history list length value under the following circumstances:

    MySQL version 8.x or higher.
    Continuous execution of DML (Data Manipulation Language) statements.

This problem led to a gradual slowing down of SELECT queries.

For detailed information, you can refer to the following reference:

https://minervadb.xyz/troubleshooting-innodb-history-length-with-hung-mysql-transaction/

As a result, I investigated the problem area and made necessary modifications. After making the changes, you were able to compare the performance before and after the fix, using monitoring tools such as Prometheus and MySQL Exporter.

---------

Co-authored-by: davinc71998 <[email protected]>
Co-authored-by: sean <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants