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

Allow LASTACCESS_UPDATE_SECS overwrite

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.5.2, 2.6
    • Fix Version/s: 2.5.3
    • Component/s: Performance
    • Labels:
    • Testing Instructions:
      Hide

      You have to pull the patch (more info below) this test purpose is to check that the user_lastaccess insert/update is only done when LASTACCESS_UDPATE_SECS expired and the value overwritten in config.php is being used:

      1. cd /your/moodle/dirroot
      2. git fetch git://github.com/dmonllao/moodle.git MDL-41910_testme
      3. git cherry-pick 8698642d89210ec5dfa8acd6f4b179a628395993
      4. Login and access a course
      5. You SHOULD see a list of INSERT and UPDATE statements
      6. One of them SHOULD be inserting or updating in user_lastaccess table
      7. Wait more than 10 seconds and refresh the page
      8. You SHOULD see a list of INSERT and UPDATE statements
      9. One of them SHOULD be inserting or updating in user_lastaccess table
      10. Wait less than 10 seconds (or refresh two times if you are slow)
      11. You SHOULD NOT see any update to user_lastaccess table
      12. Edit your config.php file and add a define('LASTACCESS_UPDATE_SECS', 30); (now we are going to repeat the steps, we want to ensure the '30' is being used)
      13. Access a course
      14. You SHOULD see a list of INSERT and UPDATE statements
      15. One of them SHOULD be inserting or updating in user_lastaccess table
      16. Wait less than 10 seconds (or refresh two times if you are slow)
      17. You SHOULD NOT see any update to user_lastaccess table
      18. Wait more than 10 seconds and less than 30 seconds
      19. You SHOULD NOT see any update to user_lastaccess table
      20. Wait more than 30 seconds
      21. You SHOULD see an update to user_lastaccess table
      22. git reset --hard HEAD~ to remove the test commit
      Show
      You have to pull the patch (more info below) this test purpose is to check that the user_lastaccess insert/update is only done when LASTACCESS_UDPATE_SECS expired and the value overwritten in config.php is being used: cd /your/moodle/dirroot git fetch git://github.com/dmonllao/moodle.git MDL-41910 _testme git cherry-pick 8698642d89210ec5dfa8acd6f4b179a628395993 Login and access a course You SHOULD see a list of INSERT and UPDATE statements One of them SHOULD be inserting or updating in user_lastaccess table Wait more than 10 seconds and refresh the page You SHOULD see a list of INSERT and UPDATE statements One of them SHOULD be inserting or updating in user_lastaccess table Wait less than 10 seconds (or refresh two times if you are slow) You SHOULD NOT see any update to user_lastaccess table Edit your config.php file and add a define('LASTACCESS_UPDATE_SECS', 30); (now we are going to repeat the steps, we want to ensure the '30' is being used) Access a course You SHOULD see a list of INSERT and UPDATE statements One of them SHOULD be inserting or updating in user_lastaccess table Wait less than 10 seconds (or refresh two times if you are slow) You SHOULD NOT see any update to user_lastaccess table Wait more than 10 seconds and less than 30 seconds You SHOULD NOT see any update to user_lastaccess table Wait more than 30 seconds You SHOULD see an update to user_lastaccess table git reset --hard HEAD~ to remove the test commit
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-41910_master

      Description

      To compare performance tests runs we need to have stable results, LASTACCESS_UPDATE_SECS makes things really hard, as we don't know if the db record will be updated (depending on the 60 seconds of LASTACCESS_UPDATE_SECS) or not so the results of the test changes.

      user_accesstime_log() calls are spread across the codebase and they are not controlled by any other setting, the only way I know of preventing this random updates when running performance test is forcing LASTACCESS_UPDATE_SECS to 0 or to "a lot"; it is a constant so I can define it in config.php, but, as it is already defined, when the includes chain reaches lib/datalib.php a php notice is thrown.

      I guess there are many ways to avoid this, I will send a patch with the quickest patch I can think of as I don't know if there is a general policy about optional settings or what we allow to be overridden in config.php, AFAIK we can do it with $CFG settings (I will probably end up doing it with cachetext for the same stability reasons) but not with constants, I also doubt that would be worth to add a new setting, deprecate the constant... just for this, so attaching a patch with if(!defined()) as we use to do during setup.

        Attachments

          Activity

            People

            Assignee:
            dmonllao David Monllaó
            Reporter:
            dmonllao David Monllaó
            Peer reviewer:
            Ankit Agarwal
            Integrator:
            Eloy Lafuente (stronk7)
            Tester:
            Dan Poltawski
            Participants:
            Component watchers:
            Matteo Scaramuccia, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              11/Nov/13