MariaDB Development
  1. MariaDB Development
  2. MDEV-4352

multi_source replication: conflict between rli->slave_patternload_file files of different connections

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.0.1
    • Fix Version/s: 10.0.2, 10.0.3
    • Labels:
    • Global Rank:
      2804

      Description

      When using multiple connections to different masters in a slave server, there
      is nothing done to guard against conflicts on the file name constructed in
      rli->slave_patternload_file.

      I found this from random failures in a test case where I start two slave
      connections at once:

      CHANGE MASTER 'slave1' TO master_port=$SERVER_MYPORT_1,
          master_host='127.0.0.1', master_user='root';
      CHANGE MASTER 'slave2' TO master_port=$SERVER_MYPORT_2,
           master_host='127.0.0.1', master_user='root';
      start all slaves;
      

      This results sometimes in this error:

      130329 21:18:13 [ERROR] Master 'slave1': Slave SQL: Unable to use slave's temporary directory /private/var/lib/buildslave/maria-slave/labrador/build/mysql-test/var/tmp/mysqld.3 - Can't create/write to file '/private/var/lib/buildslave/maria-slave/labrador/build/mysql-test/var/tmp/mysqld.3/SQL_LOAD-' (Errcode: 17 "File exists"), Error_code: 1
      

      This happens because both SQL threads call
      check_temp_dir(rli->slave_patternload_file) on the same file name created in
      init_relay_log_info().

      I think there are more problems with this. For example, it looks like
      cleanup_load_tmpdir() could easily wrongly remove files from a different
      connection. There seems nothing done to handle temporary files correctly
      between different connections to multiple masters.

      This seems like something that could easily cause silent (or not so silent)
      corruption of replication.

        Activity

        Hide
        Elena Stepanova added a comment -

        See also MDEV-4033

        Show
        Elena Stepanova added a comment - See also MDEV-4033
        Hide
        Michael Widenius added a comment -

        The issue with check_temp_dir() is already fixed in 10.0.2
        I will look at fixing cleanup_load_tmpdir() for 10.0.3

        Show
        Michael Widenius added a comment - The issue with check_temp_dir() is already fixed in 10.0.2 I will look at fixing cleanup_load_tmpdir() for 10.0.3
        Hide
        Michael Widenius added a comment -

        There was also a bug that two parallel LOAD DATA statements could use the same temporary file name.
        I fixed this by prefixing the temporary file name with the connection name.

        Show
        Michael Widenius added a comment - There was also a bug that two parallel LOAD DATA statements could use the same temporary file name. I fixed this by prefixing the temporary file name with the connection name.
        Hide
        Michael Widenius added a comment -

        Pushed into 10.0-base tree

        Show
        Michael Widenius added a comment - Pushed into 10.0-base tree

          People

          • Assignee:
            Michael Widenius
            Reporter:
            Kristian Nielsen
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: