Details

    Description

      my_thread_id, the type of many thread_id variables/functions, is a readability typedef of uint64 de jure, but long-standing formats (such as the client-server protocol and the binary log) hard-coded `my_thread_id` to 32 bits in practice. In fact –

      In mysqld.cc, static recalculate_thread_id_range() places a grand limit of (0, UINT_MAX32) on my_thread_id next_thread_id(void) and aborts the program when there’re “2^32 connections”.

      To prevent inconsistent-size bugs (such as MDEV-35646) once and for all, we should change it to a typedef of uint32_t to reflect its de facto range.

      There appears to be thread_id-named variables/functions that don’tcan’t make use of the my_thread_id typedef – some are ulonglong (64-bit) and some ulong/unsigned long (64-bit on Linux, 32-bit on Windows) (including slave_proxy_id of sql/log_event.h, the old name of pseudo_thread_id).
      Any thread_id users among them should convert to my_thread_id to join the consistency’s cause.
      (I tried to do this as part of MDEV-35646; a few files in but none understood uintXX of my_global.h (nor uintXX_t of MDEV-35460).

      Attachments

        Issue Links

          Activity

            ParadoxV5 Jimmy Hú added a comment -

            It could also have been wise to move typedef and #define out of my_pthread.h - because , my_pthread.h has nothing to do with connection ids (traditionally misnamed thread_id). my_pthread.h was for OS threads.
            wlad, https://github.com/MariaDB/server/pull/3721#issuecomment-2602806765

            ParadoxV5 Jimmy Hú added a comment - It could also have been wise to move typedef and #define out of my_pthread.h - because , my_pthread.h has nothing to do with connection ids (traditionally misnamed thread_id). my_pthread.h was for OS threads. ⸺ wlad , https://github.com/MariaDB/server/pull/3721#issuecomment-2602806765

            People

              Unassigned Unassigned
              ParadoxV5 Jimmy Hú
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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