Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-32576

increase query length in he InnoDB deadlock output

Details

    Description

      The recent release of MySQL 8.0.35 includes the following change:
      Bug #23036096 - INNODB LAST DETECTED DEADLOCK NOT SHOWING FULL QUERY

      The function innobase_mysql_print_thd() reserves a 1024-byte buffer for the output of a function that in MariaDB has been renamed to thd_get_error_context_description(). At most 600 first bytes of the SQL string will be copied to the buffer. The above fix is increasing that limit to 3000 bytes.

      In MariaDB, at least starting with the fix of MDEV-15359, it is possible that no SQL statement will be output at all. In some MariaDB releases, there also was a lock order inversion problem that caused server hangs; see MDEV-13983 for some details.

      In MariaDB Server 10.6, the locking subsystem was greatly refactored by MDEV-20612, MDEV-24738 and other changes. Therefore, it could make sense to not fix this bug in earlier major versions.

      Attachments

        Issue Links

          Activity

            well, it's definitely not a bug. 600 bytes was a limit implemented to avoid spamming the log with huge multi-MB queries.

            It is a feature request to increase this limit to 3000 like MySQL did.

            I don't have an opinion on what length is "best".

            serg Sergei Golubchik added a comment - well, it's definitely not a bug. 600 bytes was a limit implemented to avoid spamming the log with huge multi-MB queries. It is a feature request to increase this limit to 3000 like MySQL did. I don't have an opinion on what length is "best".

            This change is mostly a step into the right direction, but it could cause crashes in environments where the stack size is more limited by default, such as Alpine Linux; see MDEV-35022.

            It would be better to refactor or duplicate thd_get_error_context_description() so that the output can be sent to a FILE* directly, without having to allocate a large buffer in the stack. As far as I understand, that would allow the entire thd->query() to be included in the output.

            marko Marko Mäkelä added a comment - This change is mostly a step into the right direction, but it could cause crashes in environments where the stack size is more limited by default, such as Alpine Linux; see MDEV-35022 . It would be better to refactor or duplicate thd_get_error_context_description() so that the output can be sent to a FILE* directly, without having to allocate a large buffer in the stack. As far as I understand, that would allow the entire thd->query() to be included in the output.

            As I wrote above, not including the entire query is very intentional.

            Also, 3K is below the 8K stack frame size, and there are functions with much larger frames. For example, Aria uses 3K arrays on the stack, so the stack frame size won't go below 3K, Alpine or not.

            serg Sergei Golubchik added a comment - As I wrote above, not including the entire query is very intentional. Also, 3K is below the 8K stack frame size, and there are functions with much larger frames. For example, Aria uses 3K arrays on the stack, so the stack frame size won't go below 3K, Alpine or not.

            People

              serg Sergei Golubchik
              marko Marko Mäkelä
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.