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

Inconsistent and Incorrect rw-lock stats

Details

    Description

      • Inconsistent and Incorrect rw-lock stats
      • There are multiple inconsistency and incorrect way in which rw-lock
        stats are calculated.
      • shared rw-lock stats:
      • "rounds" counter is incremented only once for N rounds done in spin-cycle.
      • all rw-lock stats:
      • if the spin-cycle is short-circuited then attempts are re-counted.
        [if spin-cycle is interrupted, before it completes srv_n_spin_wait_rounds
        (default 30) rounds, spin_count (renamed to spin_round_count for better
        clarity) is incremented to consider this.
        if thread resumes spin-cycle (due to unavailability of the locks)
        and is again interrupted or completed spin_count (spin_round_count) is
        again incremented with the total count, failing to adjust the previous
        attempt increment].
      • s/x rw-lock stats:
      • spin_loop counter is not incremented at-all instead it is projected
        as 0 (in show engine output) and division to calculate spin-round per
        spin-loop is adjusted.
      • as per the original semantics spin_loop counter should be incremented
        once per spin_loop execution.
      • sx rw-lock stats:
      • sx locks increment spin_loop counter but instead of incrementing it once
        for spin_loop invocation it does it multiple times based on how many
        time spin_loop flow is repeated for same instance post os-wait.

      Attachments

        Activity

          krunalbauskar Krunal Bauskar added a comment - Patch for it could be found here. https://github.com/mysqlonarm/server/commit/6b21ce184ecc24a03a552eb9b0aad89fc1995be4

          krunalbauskar, thank you! A few notes:

          • We try to apply changes to the earliest affected version. I believe that the change should apply to MariaDB 10.2. But your patch is based on 10.5. Can you please rebase it to 10.2?
          • Coding style: I prefer to limit the scope of variables. Would ulint j = i; work?
          • Can you please open a pull request?
          marko Marko Mäkelä added a comment - krunalbauskar , thank you! A few notes: We try to apply changes to the earliest affected version. I believe that the change should apply to MariaDB 10.2. But your patch is based on 10.5. Can you please rebase it to 10.2? Coding style: I prefer to limit the scope of variables. Would ulint j = i; work? Can you please open a pull request ?

          PR submitted: https://github.com/MariaDB/server/pull/1535 (based on 10.2)

          Local mtr testing done found to be working (except the known failured re-check it with the http://buildbot.askmonty.org/buildbot/grid?branch=10.2)

          Output
          -----------

          without patch
          =============
          OS WAIT ARRAY INFO: reservation count 1905259
          OS WAIT ARRAY INFO: signal count 424327
          RW-shared spins 0, rounds 18226, OS waits 2732
          RW-excl spins 0, rounds 11096957, OS waits 178606
          RW-sx spins 3204, rounds 83720, OS waits 1918
          Spin rounds per wait: 18226.00 RW-shared, 11096957.00 RW-excl, 26.13 RW-sx

          with patch
          ==========
          OS WAIT ARRAY INFO: reservation count 1969248
          OS WAIT ARRAY INFO: signal count 445870
          RW-shared spins 13515, rounds 121096, OS waits 2880
          RW-excl spins 1363552, rounds 10484920, OS waits 181852
          RW-sx spins 3303, rounds 87907, OS waits 1994
          Spin rounds per wait: 8.96 RW-shared, 7.69 RW-excl, 26.61 RW-sx


          • Numbers are not directly comparable but just for references
          krunalbauskar Krunal Bauskar added a comment - PR submitted: https://github.com/MariaDB/server/pull/1535 (based on 10.2) Local mtr testing done found to be working (except the known failured re-check it with the http://buildbot.askmonty.org/buildbot/grid?branch=10.2 ) Output ----------- without patch ============= OS WAIT ARRAY INFO: reservation count 1905259 OS WAIT ARRAY INFO: signal count 424327 RW-shared spins 0, rounds 18226, OS waits 2732 RW-excl spins 0, rounds 11096957, OS waits 178606 RW-sx spins 3204, rounds 83720, OS waits 1918 Spin rounds per wait: 18226.00 RW-shared, 11096957.00 RW-excl, 26.13 RW-sx with patch ========== OS WAIT ARRAY INFO: reservation count 1969248 OS WAIT ARRAY INFO: signal count 445870 RW-shared spins 13515, rounds 121096, OS waits 2880 RW-excl spins 1363552, rounds 10484920, OS waits 181852 RW-sx spins 3303, rounds 87907, OS waits 1994 Spin rounds per wait: 8.96 RW-shared, 7.69 RW-excl, 26.61 RW-sx Numbers are not directly comparable but just for references

          People

            marko Marko Mäkelä
            krunalbauskar Krunal Bauskar
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.