Upgrade to 18.10 error on oAuth clean up

Bug #1802046 reported by Ghada El-Zoghbi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Ghada El-Zoghbi
18.04
Fix Released
High
Unassigned
18.10
Fix Released
High
Ghada El-Zoghbi
19.04
Fix Released
High
Unassigned

Bug Description

Mahara: 18.10.0
DB: Postgres
OS: Linux
Brower: N/A

During an upgrade from 17.04 to 18.10, the following error occurs:

[INF] 79 (lib/mahara.php:238) Upgrading auth.webservice
[WAR] 79 (lib/errors.php:858) Failed to get a recordset: postgres8 error: [-1: ERROR: update or delete on table "oauth_server_registry" violates foreign key constraint "oautservconf_oau_fk" on table "oauth_server_config"
[WAR] 79 (lib/errors.php:858) DETAIL: Key (id)=(7) is still referenced from table "oauth_server_config".] in adodb_throw(DELETE FROM "oauth_server_registry" WHERE externalserviceid IN (SELECT id FROM "external_services" WHERE component = ?), Array)Command was: DELETE FROM "oauth_server_registry" WHERE externalserviceid IN (SELECT id FROM "external_services" WHERE component = ?) and values was (0:module/lti)
Call stack (most recent first):
  * log_message("Failed to get a recordset: postgres8 error: [-1: E...", 8, true, true) at /var/www/mahara/htdocs/lib/errors.php:95
  * log_warn("Failed to get a recordset: postgres8 error: [-1: E...") at /var/www/mahara/htdocs/lib/errors.php:858
  * SQLException->__construct("Failed to get a recordset: postgres8 error: [-1: E...") at /var/www/mahara/htdocs/lib/dml.php:1025
  * delete_records_sql("DELETE FROM "oauth_server_registry" WHERE external...", array(size 1)) at /var/www/mahara/htdocs/lib/dml.php:1002
  * delete_records_select("oauth_server_registry", "WHERE externalserviceid IN (SELECT id FROM {extern...", array(size 1)) at /var/www/mahara/htdocs/webservice/lib.php:1529
  * external_delete_descriptions("module/lti") at /var/www/mahara/htdocs/webservice/lib.php:1570
  * external_reload_webservices() at /var/www/mahara/htdocs/auth/webservice/db/upgrade.php:594
  * xmldb_auth_webservice_upgrade("2017030600") at /var/www/mahara/htdocs/lib/upgrade.php:450
  * upgrade_plugin(object(stdClass)) at /var/www/mahara/htdocs/lib/mahara.php:272
  * upgrade_mahara(array(size 1)) at /var/www/mahara/htdocs/admin/cli/upgrade.php:56

[WAR] 79 (lib/dml.php:1025) Failed to get a recordset: postgres8 error: [-1: ERROR: update or delete on table "oauth_server_registry" violates foreign key constraint "oautservconf_oau_fk" on table "oauth_server_config"
[WAR] 79 (lib/dml.php:1025) DETAIL: Key (id)=(7) is still referenced from table "oauth_server_config".] in adodb_throw(DELETE FROM "oauth_server_registry" WHERE externalserviceid IN (SELECT id FROM "external_services" WHERE component = ?), Array)Command was: DELETE FROM "oauth_server_registry" WHERE externalserviceid IN (SELECT id FROM "external_services" WHERE component = ?) and values was (0:module/lti)
Call stack (most recent first):
  * delete_records_sql("DELETE FROM "oauth_server_registry" WHERE external...", array(size 1)) at /var/www/mahara/htdocs/lib/dml.php:1002
  * delete_records_select("oauth_server_registry", "WHERE externalserviceid IN (SELECT id FROM {extern...", array(size 1)) at /var/www/mahara/htdocs/webservice/lib.php:1529
  * external_delete_descriptions("module/lti") at /var/www/mahara/htdocs/webservice/lib.php:1570
  * external_reload_webservices() at /var/www/mahara/htdocs/auth/webservice/db/upgrade.php:594
  * xmldb_auth_webservice_upgrade("2017030600") at /var/www/mahara/htdocs/lib/upgrade.php:450
  * upgrade_plugin(object(stdClass)) at /var/www/mahara/htdocs/lib/mahara.php:272
  * upgrade_mahara(array(size 1)) at /var/www/mahara/htdocs/admin/cli/upgrade.php:56

The lti service had been configured in the past but is now disabled. During the upgrade, it tries to clean up the tables for unused modules and the lti comes up in the list.

But, it's failing due to a foreign key constraint on the oauth_server_config table.

The external_delete_descriptions() needs to also remove records from the oauth_server_config table before removing records from the oauth_server_registry table.

Changed in mahara:
assignee: nobody → Ghada El-Zoghbi (ghada-z)
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/9293

Revision history for this message
Ghada El-Zoghbi (ghada-z) wrote :

To replicate:

* In previous version 17.04, create an lti configuration
* disable the lti configuration
* upgrade to 18.10

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/9293
Committed: https://git.mahara.org/mahara/mahara/commit/6b06c240532a1d55fee07ba57be0b4d587130875
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 6b06c240532a1d55fee07ba57be0b4d587130875
Author: Ghada El-Zoghbi <email address hidden>
Date: Wed Nov 7 16:59:58 2018 +1100

Bug #1802046: Clean up old lti settings from oauth_server_config

During an upgrade, the clean up should also remove records from
the oauth_server_config table.

behatnotneeded

Change-Id: Ia0ae61ddb7cf7b05241466ec0d6900d2025d662b

Robert Lyon (robertl-9)
Changed in mahara:
milestone: none → 19.04.0
importance: Undecided → Medium
importance: Medium → High
status: New → Fix Committed
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "18.10_STABLE" branch: https://reviews.mahara.org/9299

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Patch for "18.04_STABLE" branch: https://reviews.mahara.org/9300

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/9299
Committed: https://git.mahara.org/mahara/mahara/commit/df999420fcb4bef2c629bb64ff03a50200eeb9c0
Submitter: Robert Lyon (<email address hidden>)
Branch: 18.10_STABLE

commit df999420fcb4bef2c629bb64ff03a50200eeb9c0
Author: Ghada El-Zoghbi <email address hidden>
Date: Wed Nov 7 16:59:58 2018 +1100

Bug #1802046: Clean up old lti settings from oauth_server_config

During an upgrade, the clean up should also remove records from
the oauth_server_config table.

behatnotneeded

Change-Id: Ia0ae61ddb7cf7b05241466ec0d6900d2025d662b
(cherry picked from commit 6b06c240532a1d55fee07ba57be0b4d587130875)

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/9300
Committed: https://git.mahara.org/mahara/mahara/commit/0199aaf63f832c7497d0f894de0c90b6369fe354
Submitter: Robert Lyon (<email address hidden>)
Branch: 18.04_STABLE

commit 0199aaf63f832c7497d0f894de0c90b6369fe354
Author: Ghada El-Zoghbi <email address hidden>
Date: Wed Nov 7 16:59:58 2018 +1100

Bug #1802046: Clean up old lti settings from oauth_server_config

During an upgrade, the clean up should also remove records from
the oauth_server_config table.

behatnotneeded

Change-Id: Ia0ae61ddb7cf7b05241466ec0d6900d2025d662b
(cherry picked from commit 6b06c240532a1d55fee07ba57be0b4d587130875)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.