mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #26636
[Bug 1450676] [NEW] The way we add new columns to tables can cause db to lock up
Public bug reported:
Currently when we want to add a column to an existing table we do
something like this in lib/db/upgrade.php
$table = new XMLDBTable('group');
$field = new XMLDBField('allowarchives');
$field->setAttributes(XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, null, null, 0);
add_field($table, $field);
The problem is if the database is big it can cause things to lock up
Changing the above to a more direct:
execute_sql('ALTER TABLE {group} ADD COLUMN allowarchives SMALLINT NOT NULL DEFAULT 0');
seems to avoid this problem.
So this bug is here so we can find out why the current way is so
resource intensive and/or what dangers there are doing it the more
direct way.
** Affects: mahara
Importance: Undecided
Status: Confirmed
** Changed in: mahara
Status: New => Confirmed
--
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1450676
Title:
The way we add new columns to tables can cause db to lock up
Status in Mahara ePortfolio:
Confirmed
Bug description:
Currently when we want to add a column to an existing table we do
something like this in lib/db/upgrade.php
$table = new XMLDBTable('group');
$field = new XMLDBField('allowarchives');
$field->setAttributes(XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, null, null, 0);
add_field($table, $field);
The problem is if the database is big it can cause things to lock up
Changing the above to a more direct:
execute_sql('ALTER TABLE {group} ADD COLUMN allowarchives SMALLINT NOT NULL DEFAULT 0');
seems to avoid this problem.
So this bug is here so we can find out why the current way is so
resource intensive and/or what dangers there are doing it the more
direct way.
To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1450676/+subscriptions
Follow ups
References