MDL-47664 phpunit: Do not use sequence number changes for Oracle

When resetting a sequence number, we call change_database_structure()
which in turns clears the MUC cache for databasemeta. This cache contains
information about the table, columns, etc.

After the cache is cleared, it must be re-filled, and it was discovered
that the get_columns() code which fills this cache can take a particularly
long time. Given that this is called for every table in Moodle, this can
add up to a significant period, and this is done on a per-testsuite basis.

On my SSD install this was taking approximately 40 seconds on each re-fill
of the cache.
This commit is contained in:
Andrew Nicols 2014-10-17 13:28:46 +08:00
parent e2270952c5
commit 3fa0daa90f

View File

@ -527,7 +527,12 @@ abstract class testing_util {
foreach ($data as $table => $records) {
if (isset($structure[$table]['id']) and $structure[$table]['id']->auto_increment) {
$nextid = self::get_next_sequence_starting_value($records);
$lastrecord = end($records);
if ($lastrecord) {
$nextid = $lastrecord->id + 1;
} else {
$nextid = 1;
}
if (!isset($current[$table])) {
$DB->get_manager()->reset_sequence($table);
} else if ($nextid == $current[$table]) {