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

Dual thread hang in 'closing tables' and 'Waiting for table metadata lock' on Spider CREATE OR REPLACE TABLE

Details

    Description

      Please change socket file location as required. Use CLI for replay, or MTR testcase (ref comment below). Use branch bb-10.11-midenok-MDEV-25292 (atm).

      INSTALL PLUGIN Spider SONAME 'ha_spider.so';
      CREATE USER Spider@localhost IDENTIFIED BY 'PWD1';
      CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET '../socket.sock',DATABASE 'test',user 'Spider',PASSWORD 'PWD1');
      CREATE TABLE t (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"';
      CREATE OR REPLACE TABLE t (c INT) ENGINE=Spider;
      

      Will make 10.11 (opt+dbg) hang with:

      10.11.0 49cee4e21a8e3cc0eccff3a6f9e493247344e24f (Optimized)

      10.11.0-opt>SHOW FULL PROCESSLIST;
      +----+-------------+-----------+------+---------+------+----------------------------------------------------+-------------------------------------------------+----------+
      | Id | User        | Host      | db   | Command | Time | State                                              | Info                                            | Progress |
      +----+-------------+-----------+------+---------+------+----------------------------------------------------+-------------------------------------------------+----------+
      |  4 | root        | localhost | test | Query   |  303 | closing tables                                     | CREATE OR REPLACE TABLE t (c INT) ENGINE=Spider |    0.000 |
      |  5 | system user |           | NULL | Daemon  | NULL | Spider table background cardinality action handler | NULL                                            |    0.000 |
      |  6 | system user |           | NULL | Daemon  | NULL | Spider table background cardinality action handler | NULL                                            |    0.000 |
      |  7 | system user |           | NULL | Daemon  | NULL | Spider table background cardinality action handler | NULL                                            |    0.000 |
      |  8 | system user |           | NULL | Daemon  | NULL | Spider table background statistics action handler  | NULL                                            |    0.000 |
      |  9 | system user |           | NULL | Daemon  | NULL | Spider table background cardinality action handler | NULL                                            |    0.000 |
      | 11 | system user |           | NULL | Daemon  | NULL | Spider table background cardinality action handler | NULL                                            |    0.000 |
      | 12 | system user |           | NULL | Daemon  | NULL | Spider table background statistics action handler  | NULL                                            |    0.000 |
      | 13 | system user |           | NULL | Daemon  | NULL | Spider table background cardinality action handler | NULL                                            |    0.000 |
      | 14 | system user |           | NULL | Daemon  | NULL | Spider table background cardinality action handler | NULL                                            |    0.000 |
      | 15 | system user |           | NULL | Daemon  | NULL | Spider table background statistics action handler  | NULL                                            |    0.000 |
      | 16 | system user |           | NULL | Sleep   |  303 | Reset for next command                             | NULL                                            |    0.000 |
      | 17 | system user |           | NULL | Daemon  | NULL | Spider table background statistics action handler  | NULL                                            |    0.000 |
      | 19 | system user |           | NULL | Daemon  | NULL | Spider table background statistics action handler  | NULL                                            |    0.000 |
      | 20 | system user |           | NULL | Daemon  | NULL | Spider table background statistics action handler  | NULL                                            |    0.000 |
      | 18 | system user |           | NULL | Daemon  | NULL | Spider table background statistics action handler  | NULL                                            |    0.000 |
      | 10 | system user |           | NULL | Daemon  | NULL | Spider table background statistics action handler  | NULL                                            |    0.000 |
      | 22 | system user |           | NULL | Daemon  | NULL | Spider table background cardinality action handler | NULL                                            |    0.000 |
      | 21 | system user |           | NULL | Daemon  | NULL | Spider table background cardinality action handler | NULL                                            |    0.000 |
      | 23 | system user |           | NULL | Daemon  | NULL | Spider table background statistics action handler  | NULL                                            |    0.000 |
      | 24 | system user |           | NULL | Daemon  | NULL | Spider table background cardinality action handler | NULL                                            |    0.000 |
      | 25 | Spider      | localhost | test | Query   |  303 | Waiting for table metadata lock                    | show table status from `test` like 't'          |    0.000 |
      | 26 | root        | localhost | test | Query   |    0 | starting                                           | SHOW FULL PROCESSLIST                           |    0.000 |
      +----+-------------+-----------+------+---------+------+----------------------------------------------------+-------------------------------------------------+----------+
      23 rows in set (0.000 sec)
      

      Attachments

        Issue Links

          Activity

            ycp Yuchen Pei added a comment - - edited

            Hi holyfoot, can you take a look at my patches for this ticket? In order, they are:

            > 9309d0c9cd2 MDEV-30265 Document some sts related functions in spider.

            The only reason this commit is not squashed into the next one is
            because it is purely a documentation change.

            > 425722e8f08 MDEV-29676 refactored and documented spider_get_share() and friends

            Refactoring and cleaning up spider_get_share() before fixing the
            bug. The refactoring is rather faithful and straightforward, with
            logical changes made in a separate commit below.

            > eb03f927824 MDEV-29676 Some changes in behaviour w.r.t. spider sts crd

            A bit of logical change on top of the refactoring for ease of
            review. Will probably squash with the refactoring after the review. It
            would be good to backport the squashed refactoring to older versions
            too.

            > ede6198cf71 MDEV-29676 adding lock wait timeout to get_sts and crd

            This is the commit that fixes the bug in the present ticket.

            The other commits in the same branch like f3353ca474d, 2544cace482
            are irrelevant as they are either offhand fixes or have already been
            pushed for other tickets.

            ycp Yuchen Pei added a comment - - edited Hi holyfoot , can you take a look at my patches for this ticket? In order, they are: > 9309d0c9cd2 MDEV-30265 Document some sts related functions in spider. The only reason this commit is not squashed into the next one is because it is purely a documentation change. > 425722e8f08 MDEV-29676 refactored and documented spider_get_share() and friends Refactoring and cleaning up spider_get_share() before fixing the bug. The refactoring is rather faithful and straightforward, with logical changes made in a separate commit below. > eb03f927824 MDEV-29676 Some changes in behaviour w.r.t. spider sts crd A bit of logical change on top of the refactoring for ease of review. Will probably squash with the refactoring after the review. It would be good to backport the squashed refactoring to older versions too. > ede6198cf71 MDEV-29676 adding lock wait timeout to get_sts and crd This is the commit that fixes the bug in the present ticket. The other commits in the same branch like f3353ca474d, 2544cace482 are irrelevant as they are either offhand fixes or have already been pushed for other tickets.

            you removed roop_count (not root)
            otherwise ok to push.

            holyfoot Alexey Botchkov added a comment - you removed roop_count (not root) otherwise ok to push.
            ycp Yuchen Pei added a comment - - edited

            The development of this issue has been based on bb-11.0-midenok-MDEV-25292 which is in turn based on 11.0, and the fix can definitely benefit 11.0. Therefore I add 11.0 as a fixversion for free. I will run tests on both 11.0 and 11.1 before pushing.

            I also add 11.2 because it is the latest development version.

            ycp Yuchen Pei added a comment - - edited The development of this issue has been based on bb-11.0-midenok- MDEV-25292 which is in turn based on 11.0, and the fix can definitely benefit 11.0. Therefore I add 11.0 as a fixversion for free. I will run tests on both 11.0 and 11.1 before pushing. I also add 11.2 because it is the latest development version.
            ycp Yuchen Pei added a comment - - edited

            Thanks for the review holyfoot.

            I have rebased the patches on 11.0 (instead of bb-11.0-midenok-MDEV-25292) with the test disabled (see MDEV-31138). I will push to 11.0 once I have an answer on whether / how to push the post-merge fixup for MDEV-29644 https://github.com/MariaDB/server/commit/e724017debb

            ycp Yuchen Pei added a comment - - edited Thanks for the review holyfoot . I have rebased the patches on 11.0 (instead of bb-11.0-midenok- MDEV-25292 ) with the test disabled (see MDEV-31138 ). I will push to 11.0 once I have an answer on whether / how to push the post-merge fixup for MDEV-29644 https://github.com/MariaDB/server/commit/e724017debb
            ycp Yuchen Pei added a comment -

            Pushed to 11.0. Also tested on 11.1 (but without rebasing on an MDEV-25292 commit because there is no such commit based on 11.1)

            ycp Yuchen Pei added a comment - Pushed to 11.0. Also tested on 11.1 (but without rebasing on an MDEV-25292 commit because there is no such commit based on 11.1)

            People

              ycp Yuchen Pei
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              8 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.