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

Forum search problems with MySQL 8

XMLWordPrintable

    • MOODLE_401_STABLE
    • MOODLE_311_STABLE, MOODLE_400_STABLE
    • m41_MDL-74912_Fix_RegExp_Word_Boundaries_On_MySQL8
    • Hide

      You need to test the patch within the scope of the change first (MySQL 8) and then in those other environments required to verify that no regressions have been added.

      Limiting the scenarios run by the Reviewer/Tester is proposed here to make the task faster but a fully automated Behat run should be done as well.

      Setup the test environment using Moodle Docker Toolbox w/ MySQL 8

      1. Define the required environment variables:

        # export MOODLE_DOCKER_WWWROOT=/path/to/moodle/code
        # export MOODLE_DOCKER_DB=mysql
        

      2. Change the MySQL image in order to run v8:

        # export MOODLE_DOCKER_DB_VERSION=8.0
        

      3. Then start the Moodle environment and init Behat environment too:

        # cp config.docker-template.php $MOODLE_DOCKER_WWWROOT/config.php
        # bin/moodle-docker-compose up -d
        # bin/moodle-docker-wait-for-db
        # bin/moodle-docker-compose exec webserver php admin/tool/behat/cli/init.php
        

        Test the specific Behat scenario

      1. Identify the line of the failing scenario - using master you should get line 59:

        # grep -n "Scenario: Perform an advanced search using whole words" ${MOODLE_DOCKER_WWWROOT}/mod/forum/tests/behat/advanced_search.feature
        59:  Scenario: Perform an advanced search using whole words
        

      2. Execute that scenario and confirm no error out of the execution of the scenario:

        # bin/moodle-docker-compose exec -u www-data webserver php admin/tool/behat/cli/run.php /var/www/html/mod/forum/tests/behat/advanced_search.feature:59
        

      3. Finally destroy the test environment:

        # bin/moodle-docker-compose down -v
        

      Setup the test environment using Moodle Docker Toolbox w/ MySQL 5

      Follow the above steps using a plain Moodle Docker Toolbox i.e. you need to reset the DB Version setting:

      # unset MOODLE_DOCKER_DB_VERSION
      

      and verify that you're running a MYSQL 5.7 based environment.
      Confirm no regression error will appear at the end of the execution.

      Setup the test environment using Moodle Docker Toolbox w/ a DB server different from MySQL but supporting the Moodle Advanced Search

      Follow the above steps using a plain Moodle Docker Toolbox i.e. you need to reset the DB Version setting in step 2 and select a different DB Server in step 1, i.e. MOODLE_DOCKER_DB=pgsql or mariadb - ideally both the DB servers should be tested.
      Confirm no regression error will appear at the end of the execution.

      Note: Oracle (oracle) and MSSQL (mssql) could be use to have a full coverage of the regressions but using the "after 24 hours" approach during the Integration.

      Show
      You need to test the patch within the scope of the change first ( MySQL 8 ) and then in those other environments required to verify that no regressions have been added. Limiting the scenarios run by the Reviewer/Tester is proposed here to make the task faster but a fully automated Behat run should be done as well. Setup the test environment using Moodle Docker Toolbox w/ MySQL 8 Define the required environment variables: # export MOODLE_DOCKER_WWWROOT=/path/to/moodle/code # export MOODLE_DOCKER_DB=mysql Change the MySQL image in order to run v8 : # export MOODLE_DOCKER_DB_VERSION=8.0 Then start the Moodle environment and init Behat environment too: # cp config.docker-template.php $MOODLE_DOCKER_WWWROOT/config.php # bin/moodle-docker-compose up -d # bin/moodle-docker-wait-for-db # bin/moodle-docker-compose exec webserver php admin/tool/behat/cli/init.php Test the specific Behat scenario Identify the line of the failing scenario - using master you should get line 59 : # grep -n "Scenario: Perform an advanced search using whole words" ${MOODLE_DOCKER_WWWROOT}/mod/forum/tests/behat/advanced_search.feature 59: Scenario: Perform an advanced search using whole words Execute that scenario and confirm no error out of the execution of the scenario: # bin/moodle-docker-compose exec -u www-data webserver php admin/tool/behat/cli/run.php /var/www/html/mod/forum/tests/behat/advanced_search.feature:59 Finally destroy the test environment: # bin/moodle-docker-compose down -v Setup the test environment using Moodle Docker Toolbox w/ MySQL 5 Follow the above steps using a plain Moodle Docker Toolbox i.e. you need to reset the DB Version setting: # unset MOODLE_DOCKER_DB_VERSION and verify that you're running a MYSQL 5 .7 based environment. Confirm no regression error will appear at the end of the execution. Setup the test environment using Moodle Docker Toolbox w/ a DB server different from MySQL but supporting the Moodle Advanced Search Follow the above steps using a plain Moodle Docker Toolbox i.e. you need to reset the DB Version setting in step 2 and select a different DB Server in step 1, i.e. MOODLE_DOCKER_DB=pgsql or mariadb - ideally both the DB servers should be tested. Confirm no regression error will appear at the end of the execution. Note: Oracle ( oracle ) and MSSQL ( mssql ) could be use to have a full coverage of the regressions but using the "after 24 hours" approach during the Integration.

      While working on MDLSITE-6376, some behat tests were launched (@mod_forum) with MySQL 8. And it failed.

      This is the job: https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/24381/

      And this is the error (from the logs):

      001 Scenario: Perform an advanced search using whole words # /var/www/html/mod/forum/tests/behat/advanced_search.feature:59
            When I press "Search"                                # /var/www/html/mod/forum/tests/behat/advanced_search.feature:67
              Moodle exception: Exception - Warning: mysqli::query(): (HY000/3685): Illegal argument to a regular expression. in [dirroot]/lib/dml/mysqli_native_moodle_database.php on line 1272More information about this error
              
              Exception - Warning: mysqli::query(): (HY000/3685): Illegal argument to a regular expression. in [dirroot]/lib/dml/mysqli_native_moodle_database.php on line 1272
       
      Debug:
       
      Error code: generalexceptionmessage
      * line 157 of /lib/behat/lib.php: Exception thrown
      * line ? of unknownfile: call to behat_error_handler()
      * line 1272 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli->query()
      * line 1671 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()
      * line 1744 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
      * line 1954 of /lib/dml/moodle_database.php: call to moodle_database->get_field_sql()
      * line 1256 of /mod/forum/lib.php: call to moodle_database->count_records_sql()
      * line 166 of /mod/forum/search.php: call to forum_search_posts()
      , referer: http://webserverca0499b3df001f39/behatrun3/mod/forum/search.php?id=102000&search=
      

      Only tested with master (4.1dev) but surely affects older versions too.

        1. master_mariadb_MDL-74912.png
          master_mariadb_MDL-74912.png
          50 kB
        2. master_mysql_5_MDL-74912.png
          master_mysql_5_MDL-74912.png
          50 kB
        3. master_mysql_8_MDL-74912.png
          master_mysql_8_MDL-74912.png
          49 kB
        4. master_pgsql_MDL-74912.png
          master_pgsql_MDL-74912.png
          51 kB
        5. v311_mariadb_MDL-74912.png
          v311_mariadb_MDL-74912.png
          50 kB
        6. v311_mysql_5_MDL-74912.png
          v311_mysql_5_MDL-74912.png
          50 kB
        7. v311_mysql_8_MDL-74912.png
          v311_mysql_8_MDL-74912.png
          50 kB
        8. v311_pgsql_MDL-74912.png
          v311_pgsql_MDL-74912.png
          50 kB
        9. v400_mariadb_MDL-74912.png
          v400_mariadb_MDL-74912.png
          50 kB
        10. v400_mysql_5_MDL-74912.png
          v400_mysql_5_MDL-74912.png
          50 kB
        11. v400_mysql_8_MDL-74912.png
          v400_mysql_8_MDL-74912.png
          49 kB
        12. v400_pgsql_MDL-74912.png
          v400_pgsql_MDL-74912.png
          51 kB

            matteo Matteo Scaramuccia
            stronk7 Eloy Lafuente (stronk7)
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Victor Déniz Falcón Victor Déniz Falcón
            John Edward Pedregosa John Edward Pedregosa
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 6 hours
                6h

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.