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

disks plugin does not work on 32bit systems

Details

    Description

      https://buildbot.mariadb.org/#/builders/50/builds/11/steps/5/logs/stdio

      it shoud uses size_t instead of long for sizes. Also more tests are welcome.

      disks.disks                              w14 [ fail ]
              Test ended at 2020-05-29 11:34:19
      CURRENT_TEST: disks.disks
      --- /buildbot/32bit-ubuntu-1804/build/plugin/disks/mysql-test/disks/disks.result	2020-05-29 11:23:53.000000000 +0000
      +++ /buildbot/32bit-ubuntu-1804/build/plugin/disks/mysql-test/disks/disks.reject	2020-05-29 11:34:19.644705159 +0000
      @@ -9,4 +9,4 @@
       ) ENGINE=MEMORY DEFAULT CHARSET=utf8
       select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
       sum(Total) > sum(Available)	sum(Total)>sum(Used)
      -1	1
      +0	1
      mysqltest: Result content mismatch
      

      Attachments

        Activity

          wlad Vladislav Vaintroub added a comment - - edited

          it should actually use ulonglong, not size_t and especially not long . Never use long, it serves no purpose.
          The reason for ulonglong is that disks are bigger than 4GB, even on on 32bit. Even if you count KB, there are now disks that are 4TB big

          wlad Vladislav Vaintroub added a comment - - edited it should actually use ulonglong, not size_t and especially not long . Never use long, it serves no purpose. The reason for ulonglong is that disks are bigger than 4GB, even on on 32bit. Even if you count KB, there are now disks that are 4TB big
          wlad Vladislav Vaintroub added a comment - - edited

          size_t total = (info.f_frsize * info.f_blocks) / 1024;
          size_t used = (info.f_frsize * (info.f_blocks - info.f_bfree)) / 1024;
          size_t avail = (info.f_frsize * info.f_bavail) / 1024;

          that stuff needs rethinking , definitely.
          not size_t , ulonglong
          when multiplying , cast the first parameter to ulonglong, so that multiplication does not result into truncation.

          wlad Vladislav Vaintroub added a comment - - edited size_t total = (info.f_frsize * info.f_blocks) / 1024; size_t used = (info.f_frsize * (info.f_blocks - info.f_bfree)) / 1024; size_t avail = (info.f_frsize * info.f_bavail) / 1024; that stuff needs rethinking , definitely. not size_t , ulonglong when multiplying , cast the first parameter to ulonglong, so that multiplication does not result into truncation.
          rucha174 Rucha Deodhar added a comment - Duplicate: https://jira.mariadb.org/browse/MDEV-22834

          People

            rucha174 Rucha Deodhar
            sanja Oleksandr Byelkin
            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.