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

table_share used for reading statistical tables is not protected

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.2, 10.3, 10.4
    • Fix Version/s: 10.2, 10.3, 10.4
    • Component/s: Optimizer
    • Labels:
      None

      Description

      While reading statistics for a table in function read_statistics_for_table_is_needed we don't protect the table_share fields and there is a chance that multiple threads would try to access it at the same time.

      To see this
      Lets add this patch to read_statistics_for_table

      +fprintf(stderr, "READ %p\n", current_thd); fflush(stderr);
      +sleep(10);
      +fprintf(stderr, "DONE %p\n", current_thd); fflush(stderr);
      +
      

      and the server output is

       
      READ 0x7fc870000b00 
      READ 0x7fc874000b00
      DONE 0x7fc870000b00
      DONE 0x7fc874000b00
      

      so different threads are entering the function at the same time.
      So i think we need an exclusive lock to protect the members of table_share

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                svoj Sergey Vojtovich
                Reporter:
                varun Varun Gupta
              • Votes:
                1 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated: