Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-69581

Azure hosted MariaDB instances report the wrong version number

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.9.1
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      MariaDB
    • Database:
      MySQL
    • Testing Instructions:
      Hide

      (difficulty: "easy", requires the ability to install a Moodle instance running on a MySQL-ish DB server including that provided by Microsoft Azure)

      Test using a "remote" MariaDB server provided by Microsoft Azure

      TBD (Requires a free trial account to access a MariaDB instance)

      Note: the version reported in the Information column in Site administration > Server > Environment is still the one wrongly reported by the PHP client, as reported here, to keep that info consistent w/ what the PHP client is telling about that DB connection. Only the version info has been improved to what the DB Server instance tells about its actual version.

      Prepare the "local" test environment

      1. You can use the Moodle Docker Toolbox:

        # export MOODLE_DOCKER_WWWROOT=/path/to/moodle/branch
        # cp config.docker-template.php $MOODLE_DOCKER_WWWROOT/config.php
        

      Regression tests on MySQL

      1. Select the MySQL DB Server in your Moodle Docker Toolbox and take note of the DB version as reported by the CLI comand (here: 5.7.31):

        # export MOODLE_DOCKER_DB=mysql
        # bin/moodle-docker-compose up -d && bin/moodle-docker-compose exec db mysql -V
        mysql  Ver 14.14 Distrib 5.7.31, for Linux (x86_64) using  EditLine wrapper
        

      2. Run the DML tests and verify both no failures but 1 skipped test and the match between the version reported in the PHPunit CLI output and the one from the CLI comand output above (5.7.31):

        # bin/moodle-docker-wait-for-db
        # bin/moodle-docker-compose exec webserver php admin/tool/phpunit/cli/init.php
        # bin/moodle-docker-compose exec webserver vendor/bin/phpunit lib/dml/tests/dml_test.php
        Moodle 4.0dev (Build: 20200827), 16d37dc2593e137102e97a44fed5cebfb5fdf1eb
        Php: 7.2.32, mysqli: 5.7.31, OS: Linux 3.10.0-1127.19.1.el7.x86_64 x86_64
        PHPUnit 7.5.20 by Sebastian Bergmann and contributors.
         
        ...............................................................  63 / 106 ( 59%)
        ..........................................S                     106 / 106 (100%)
         
        Time: 2.99 seconds, Memory: 48.00 MB
         
        OK, but incomplete, skipped, or risky tests!
        Tests: 106, Assertions: 1210, Skipped: 1.
        

      Regression tests on "plain" MariaDB

      1. Stop the previous test instance, select the MariaDB Server in your Moodle Docker Toolbox and take note of the DB version as reported by the CLI comand (here: 10.2.33. -MariaDB is just a suffix):

        # bin/moodle-docker-compose down -v
        # export MOODLE_DOCKER_DB=mariadb
        # bin/moodle-docker-compose up -d && bin/moodle-docker-compose exec db mysql -V
        mysql  Ver 15.1 Distrib 10.2.33-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
        

      2. Run the DML tests and verify both no failures and the match between the version reported in the PHPunit CLI output and the one from the CLI comand output above (10.2.33):

        # bin/moodle-docker-wait-for-db
        # bin/moodle-docker-compose exec webserver php admin/tool/phpunit/cli/init.php
        # bin/moodle-docker-compose exec webserver vendor/bin/phpunit lib/dml/tests/dml_test.php
        Moodle 4.0dev (Build: 20200827), 16d37dc2593e137102e97a44fed5cebfb5fdf1eb
        Php: 7.2.32, mariadb: 10.2.33, OS: Linux 3.10.0-1127.19.1.el7.x86_64 x86_64
        PHPUnit 7.5.20 by Sebastian Bergmann and contributors.
         
        ...............................................................  63 / 106 ( 59%)
        ...........................................                     106 / 106 (100%)
         
        Time: 4 seconds, Memory: 48.00 MB
         
        OK (106 tests, 1212 assertions)
        

      Show
      (difficulty: "easy", requires the ability to install a Moodle instance running on a MySQL-ish DB server including that provided by Microsoft Azure) Test using a "remote" MariaDB server provided by Microsoft Azure TBD (Requires a free trial account to access a MariaDB instance) Note: the version reported in the Information column in Site administration > Server > Environment is still the one wrongly reported by the PHP client, as reported here, to keep that info consistent w/ what the PHP client is telling about that DB connection. Only the version info has been improved to what the DB Server instance tells about its actual version. Prepare the "local" test environment You can use the Moodle Docker Toolbox: # export MOODLE_DOCKER_WWWROOT=/path/to/moodle/branch # cp config.docker-template.php $MOODLE_DOCKER_WWWROOT/config.php Regression tests on MySQL Select the MySQL DB Server in your Moodle Docker Toolbox and take note of the DB version as reported by the CLI comand (here: 5.7.31 ): # export MOODLE_DOCKER_DB=mysql # bin/moodle-docker-compose up -d && bin/moodle-docker-compose exec db mysql -V mysql Ver 14.14 Distrib 5.7.31, for Linux (x86_64) using EditLine wrapper Run the DML tests and verify both no failures but 1 skipped test and the match between the version reported in the PHPunit CLI output and the one from the CLI comand output above ( 5.7.31 ): # bin/moodle-docker-wait-for-db # bin/moodle-docker-compose exec webserver php admin/tool/phpunit/cli/init.php # bin/moodle-docker-compose exec webserver vendor/bin/phpunit lib/dml/tests/dml_test.php Moodle 4.0dev (Build: 20200827), 16d37dc2593e137102e97a44fed5cebfb5fdf1eb Php: 7.2.32, mysqli: 5.7.31, OS: Linux 3.10.0-1127.19.1.el7.x86_64 x86_64 PHPUnit 7.5.20 by Sebastian Bergmann and contributors.   ............................................................... 63 / 106 ( 59%) ..........................................S 106 / 106 (100%)   Time: 2.99 seconds, Memory: 48.00 MB   OK, but incomplete, skipped, or risky tests! Tests: 106, Assertions: 1210, Skipped: 1. Regression tests on "plain" MariaDB Stop the previous test instance, select the MariaDB Server in your Moodle Docker Toolbox and take note of the DB version as reported by the CLI comand (here: 10.2.33 . -MariaDB is just a suffix): # bin/moodle-docker-compose down -v # export MOODLE_DOCKER_DB=mariadb # bin/moodle-docker-compose up -d && bin/moodle-docker-compose exec db mysql -V mysql Ver 15.1 Distrib 10.2.33-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2 Run the DML tests and verify both no failures and the match between the version reported in the PHPunit CLI output and the one from the CLI comand output above ( 10.2.33 ): # bin/moodle-docker-wait-for-db # bin/moodle-docker-compose exec webserver php admin/tool/phpunit/cli/init.php # bin/moodle-docker-compose exec webserver vendor/bin/phpunit lib/dml/tests/dml_test.php Moodle 4.0dev (Build: 20200827), 16d37dc2593e137102e97a44fed5cebfb5fdf1eb Php: 7.2.32, mariadb: 10.2.33, OS: Linux 3.10.0-1127.19.1.el7.x86_64 x86_64 PHPUnit 7.5.20 by Sebastian Bergmann and contributors.   ............................................................... 63 / 106 ( 59%) ........................................... 106 / 106 (100%)   Time: 4 seconds, Memory: 48.00 MB   OK (106 tests, 1212 assertions)
    • Affected Branches:
      MOODLE_39_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      m40_MDL-69581_Improve_MariaDB_Server_Version_Detection

      Description

      This isn't really a Moodle bug, but is something it may be worth considering trying to work around or mitigate by changing the way the version is checked. I discovered this while upgrading a Moodle 3.5 installation to 3.9.1, but it probably affects other versions as well.

      The Azure managed instances of MairaDB wrongly reports it's version number when you connect by design! You can demonstrate this using the command line client to connect to the database, which gives the following output:

       

      Welcome to the MariaDB monitor. Commands end with ; or \g.
      Your MySQL connection id is 64799
      Server version: 5.6.42.0 MariaDB Server
      Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
      MySQL [(none)]> SELECT @@version ;
      +-----------------+
      | @@version |
      +-----------------+
      | 10.2.32-MariaDB |
      +-----------------+
      1 row in set (0.01 sec)
      

       

      The initial connection reports 5.6.42.0, but a subsequent query of the version reports 10.2.32 (which is the correct version for this instance). This blocks the installation of Moodle 3.9 which (not unreasonably) only checks the version reported when the connection is made. The work around is to either mis-configure the database as MySQL (which allows version 5.6) or patch the minimum version of MariaDB allowed.

      The inconsistency is documented by Microsoft here:

      https://docs.microsoft.com/en-us/azure/mariadb/concepts-supported-versions

      I have submitted a bug report to Microsoft, but the response was that I should change my software to work around their bug!

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              tim1mw Tim Williams
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Matteo Scaramuccia, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated: