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

purge_sys_t::wait_FTS sleeps 10ms, even if it does not have to wait.

Details

    Description

      The code reads like this

        bool paused;
        do
        {
          latch.wr_lock(SRW_LOCK_CALL);
          paused= m_FTS_paused || (also_sys && m_SYS_paused);
          latch.wr_unlock();
          std::this_thread::sleep_for(std::chrono::milliseconds(10));
        }
        while (paused);
      

      it sleeps. without checking paused, even if paused is false.

      It looks wrong, although perhaps it was intended for some purpose, e.g throttle purge activity.

      Even if it was intended, then it still needs to be taken out of the function loop, and added to where the throttling needs to actually be, with appropritate comment.

      Otherwise it adds 10 ms latency to all of its callers, and to the callers of its callers, which happens more than once during the purge

      e.g in wait_FTS/clone_oldest_view/trx_purge and in wait_FTS/close_and_reopen/trx_attach_undo_recs/trx_purge code paths

      Other thing : taking a write lock latch.wr_lock just to check the variable, and not change anything is this correct? Looks strange at least.

      Attachments

        Issue Links

          Activity

            wlad Vladislav Vaintroub created issue -
            wlad Vladislav Vaintroub made changes -
            Field Original Value New Value
            Labels performance
            wlad Vladislav Vaintroub made changes -
            Summary purge_sys_t::wait_FTS sleeps even if it does not have to wait. purge_sys_t::wait_FTS sleeps 10ms, even if it does not have to wait.
            serg Sergei Golubchik made changes -
            Fix Version/s 10.6 [ 24028 ]
            Fix Version/s 10.11 [ 27614 ]
            Fix Version/s 11.4 [ 29301 ]
            marko Marko Mäkelä made changes -
            Assignee Debarun Banerjee [ JIRAUSER54513 ] Marko Mäkelä [ marko ]
            marko Marko Mäkelä made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            Assignee Marko Mäkelä [ marko ] Debarun Banerjee [ JIRAUSER54513 ]
            Status In Progress [ 3 ] In Review [ 10002 ]
            debarun Debarun Banerjee made changes -
            Assignee Debarun Banerjee [ JIRAUSER54513 ] Marko Mäkelä [ marko ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            marko Marko Mäkelä made changes -
            Assignee Marko Mäkelä [ marko ] Debarun Banerjee [ JIRAUSER54513 ]
            Status Stalled [ 10000 ] In Review [ 10002 ]
            debarun Debarun Banerjee made changes -
            Assignee Debarun Banerjee [ JIRAUSER54513 ] Marko Mäkelä [ marko ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            marko Marko Mäkelä made changes -
            Fix Version/s 10.6.20 [ 29903 ]
            Fix Version/s 10.11.10 [ 29904 ]
            Fix Version/s 11.2.6 [ 29906 ]
            Fix Version/s 11.4.4 [ 29907 ]
            Fix Version/s 11.6.2 [ 29908 ]
            Fix Version/s 10.6 [ 24028 ]
            Fix Version/s 10.11 [ 27614 ]
            Fix Version/s 11.4 [ 29301 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]

            People

              marko Marko Mäkelä
              wlad Vladislav Vaintroub
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.