mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 12:32:08 +02:00
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:
parent
e2270952c5
commit
3fa0daa90f
@ -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]) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user