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

Global search. Additional indexing table can cause error on the search areas page.

XMLWordPrintable

    • MOODLE_401_STABLE, MOODLE_405_STABLE

      When context is gone, but reference is still in mdl_search_index_requests there is an error on the Search areas page:

      Can't find data record in database table context.
       
      More information about this error
       
      error
       
      Error
      Debug info: SELECT * FROM {context} WHERE id = ?
      [array (
      0 => '4940988',
      )]
      Error code: invalidrecord
      error
       
      Error
      Stack trace:
      line 1654 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
      line 1630 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
      line 5428 of /lib/accesslib.php: call to moodle_database->get_record()
      line 1800 of /search/classes/manager.php: call to context::instance_by_id()
      line 249 of /admin/searchareas.php: call to core_search\manager->get_index_requests_info()
      

      Steps to replicate:

      0 . Make sure global search is enabled on your site.
      1. Stop cron if it's enabled.
      2. Create a course with a single assignment activity in it.
      3. Navigate to /admin/searchareas.php and request Gradual reindex for assignment activity type.
      4. Make sure a new record is added to mdl_search_index_requests
      5. Navigate to your course and delete assignment activity created on step 2.
      6. Make sure that context record for that activity is gone from mdl_context table.
      7. Navigate to /admin/searchareas.php again and scroll down the page.
      8. Confirm you see the "Can't find data record in database table context" error

      SQL for finding all records:

      SELECT sir.* FROM mdl_search_index_requests sir LEFT JOIN mdl_context c ON sir.contextid = c.id AND c.id is NULL;

            Unassigned Unassigned
            dmitriim Dmitrii Metelkin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

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