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

Improve the sql debugging

    • MDL-79312-sql-debug
    • Hide
      1. Improvements to the sql debug traces on the web
        1. Add $CFG->debugsqltrace = 100; to config.php
        2. Download MDL-79312-sql-debug.php turns debugging on manually from code
        3. Run it in a browser without logging in
        4. Confirm that the comments are generally before the SQL instead of after. Note some edge cases have the sql somewhere in the middle of the query.
        5. Confirm they are sql block comments not inline comments
        6. Confirm that the url of the page is present
        7. Login and then reload the test script
        8. Confirm that the username and user's id are also present in the SQL comments
      2. Improvements to the sql debug traces on the CLI
        1. On the cli run php MDL-79312-sql-debug.php
        2. Confirm that the script path is present in the comment
      3. Test new option to display sql debugging
        1. Visit /admin/settings.php?section=debugging&debugsqlfrom=1 and confirm you see the normal admin settings page with no extra debugging
        2. Tick debugsql and save
        3. Visit /admin/settings.php?section=debugging&debugsqlfrom=1 and confirm you see a large number of raw queries
        4. Confirm that for each query you see the bind variables and their values
        5. Confirm that the first query contains a reference to itself: * line 18 of /MDL-79312sql-debug.php ...
        6. Confirm that each query has a query number in sequence from 1 to roughly 100.
        7. Visit /admin/settings.php?section=debugging&debugsqlfrom=60&debugsqlto=65 and confirm you now see a subset of queries from query 60 to query 65 inclusive
      Show
      Improvements to the sql debug traces on the web Add $CFG->debugsqltrace = 100; to config.php Download MDL-79312 -sql-debug.php turns debugging on manually from code Run it in a browser without logging in Confirm that the comments are generally before the SQL instead of after. Note some edge cases have the sql somewhere in the middle of the query. Confirm they are sql block comments not inline comments Confirm that the url of the page is present Login and then reload the test script Confirm that the username and user's id are also present in the SQL comments Improvements to the sql debug traces on the CLI On the cli run php MDL-79312 -sql-debug.php Confirm that the script path is present in the comment Test new option to display sql debugging Visit /admin/settings.php?section=debugging&debugsqlfrom=1 and confirm you see the normal admin settings page with no extra debugging Tick debugsql and save Visit /admin/settings.php?section=debugging&debugsqlfrom=1 and confirm you see a large number of raw queries Confirm that for each query you see the bind variables and their values Confirm that the first query contains a reference to itself: * line 18 of / MDL-79312 sql-debug.php ... Confirm that each query has a query number in sequence from 1 to roughly 100. Visit /admin/settings.php?section=debugging&debugsqlfrom=60&debugsqlto=65 and confirm you now see a subset of queries from query 60 to query 65 inclusive

      In MDL-68874 we added the option to add some sql comments to help debug things. Proposing to tweak this:

      1. Add in $ME so its easier to trace sql to a specific web request
      2. Add in the currently logged in moodle user
      3. Move the comments to the top because various sql tools may only give you the first N bytes of a very large sql which is truncated

            brendanheywood Brendan Heywood
            brendanheywood Brendan Heywood
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:

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