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

Wrong duplicate detection for plugin session vars in session_track_system_variables

    XMLWordPrintable

Details

    • Bug
    • Status: In Review (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.4
    • 11.4
    • None
    • None
    • Can result in unexpected behaviour
    • Q2/2026 Server Maintenance

    Description

      This bug is masked by MDEV-39207 and caused by the 11.1+ change MDEV-31746.

      The MDEV-31746 patch changed the hash key calculation in session sysvar tracker from the sys_var pointer to its offset. This was useful for non-plugin variable aliases, but not so much for plugin variables which all have offset 0.

      The bug is masked by MDEV-39207 because all plugin session vars are marked with "*test_loaded=false". If none of the plugin session vars are marked loaded, then false positive deduplication does not surface.

      With the current MDEV-39207 patch applied to 11.4, the bug becomes apparent:

      sys_vars.session_track_system_variables_basic [ fail ]
              Test ended at 2026-03-31 16:42:51
       
      CURRENT_TEST: sys_vars.session_track_system_variables_basic
      --- /home/ycp/source/mariadb-server/11.4/src/mysql-test/suite/sys_vars/r/session_track_system_variables_basic.result	2026-03-31 16:42:21.710652757 +1100
      +++ /home/ycp/source/mariadb-server/11.4/src/mysql-test/suite/sys_vars/r/session_track_system_variables_basic.reject	2026-03-31 16:42:51.418448445 +1100
      @@ -168,20 +168,17 @@
       set global session_track_system_variables='myisam_sort_buffer_size,example_int_var';
       select @@global.session_track_system_variables;
       @@global.session_track_system_variables
      -example_int_var,myisam_sort_buffer_size
      +myisam_sort_buffer_size
       set global session_track_system_variables='myisam_block_size,myisam_sort_buffer_size,character_set_client,example_int_var';
       select @@global.session_track_system_variables;
       @@global.session_track_system_variables
      -character_set_client,example_int_var,myisam_sort_buffer_size
      +character_set_client
       # Session tracking works as expected for plugin session var
       connect foo,localhost,root;
       select @@session.session_track_system_variables;
       @@session.session_track_system_variables
      -character_set_client,example_int_var,myisam_sort_buffer_size
      +character_set_client
       set session example_int_var = -1;
      --- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
      --- example_int_var: -1
      -
       connection default;
       disconnect foo;
       uninstall soname 'ha_example.so';
      

      In the first diff hunk, example_int_var and myisam_sort_buffer_size are both plugin session vars, so they are incorrectly deemed duplicates for having the same 0 offset and only one appears.

      In the second diff hunk, example_int_var and myisam_sort_buffer_size are deemed duplicates of myisam_block_size for the same reason. But myisam_block_size does not appear either because it is a global plugin var, and global plugin vars have *test_load==static_unloaded.

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              ycp Yuchen Pei
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.