From 1362b2fb68f214144b87c74a7dfb0ad31c67efaf Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 15 Apr 2026 16:25:15 +0200 Subject: [PATCH] perf: swap around root_id and mount_path_hash in index Signed-off-by: Robin Appelman --- .../Version13000Date20170718121200.php | 1 - .../Version33000Date20251209123503.php | 4 -- .../Version34000Date20260415161745.php | 45 +++++++++++++++++++ lib/composer/composer/autoload_classmap.php | 1 + lib/composer/composer/autoload_static.php | 1 + 5 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 core/Migrations/Version34000Date20260415161745.php diff --git a/core/Migrations/Version13000Date20170718121200.php b/core/Migrations/Version13000Date20170718121200.php index 64b5a83477b6b..933cd49f7843b 100644 --- a/core/Migrations/Version13000Date20170718121200.php +++ b/core/Migrations/Version13000Date20170718121200.php @@ -121,7 +121,6 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op $table->addIndex(['storage_id'], 'mounts_storage_index'); $table->addIndex(['root_id'], 'mounts_root_index'); $table->addIndex(['mount_id'], 'mounts_mount_id_index'); - $table->addIndex(['user_id', 'root_id', 'mount_point'], 'mounts_user_root_path_index', [], ['lengths' => [null, null, 128]]); } else { $table = $schema->getTable('mounts'); if (!$table->hasColumn('mount_id')) { diff --git a/core/Migrations/Version33000Date20251209123503.php b/core/Migrations/Version33000Date20251209123503.php index 1a9cdc4434339..afea24ae7877c 100644 --- a/core/Migrations/Version33000Date20251209123503.php +++ b/core/Migrations/Version33000Date20251209123503.php @@ -39,10 +39,6 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt 'notnull' => true, 'length' => 32, // xxh128 ]); - if ($table->hasIndex('mounts_user_root_path_index')) { - $table->dropIndex('mounts_user_root_path_index'); - } - $table->addUniqueIndex(['user_id', 'root_id', 'mount_point_hash'], 'mounts_user_root_path_index'); return $schema; } diff --git a/core/Migrations/Version34000Date20260415161745.php b/core/Migrations/Version34000Date20260415161745.php new file mode 100644 index 0000000000000..2b959f3085c21 --- /dev/null +++ b/core/Migrations/Version34000Date20260415161745.php @@ -0,0 +1,45 @@ +hasTable('mounts')) { + $table = $schema->getTable('mounts'); + + if (!$table->hasIndex('mounts_user_path_root_index')) { + $table->addUniqueIndex(['user_id', 'mount_point_hash', 'root_id'], 'mounts_user_path_root_index'); + $changed = true; + } + if ($table->hasIndex('mounts_user_root_path_index')) { + $table->dropIndex('mounts_user_root_path_index'); + $changed = true; + } + } + + return $changed ? $schema : null; + } +} diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index d51a2a73f8e1d..79b464acca6ee 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -1595,6 +1595,7 @@ 'OC\\Core\\Migrations\\Version33000Date20251209123503' => $baseDir . '/core/Migrations/Version33000Date20251209123503.php', 'OC\\Core\\Migrations\\Version33000Date20260126120000' => $baseDir . '/core/Migrations/Version33000Date20260126120000.php', 'OC\\Core\\Migrations\\Version34000Date20260318095645' => $baseDir . '/core/Migrations/Version34000Date20260318095645.php', + 'OC\\Core\\Migrations\\Version34000Date20260415161745' => $baseDir . '/core/Migrations/Version34000Date20260415161745.php', 'OC\\Core\\Notification\\CoreNotifier' => $baseDir . '/core/Notification/CoreNotifier.php', 'OC\\Core\\ResponseDefinitions' => $baseDir . '/core/ResponseDefinitions.php', 'OC\\Core\\Service\\CronService' => $baseDir . '/core/Service/CronService.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index 3032405b29863..28e0851583f3b 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -1636,6 +1636,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2 'OC\\Core\\Migrations\\Version33000Date20251209123503' => __DIR__ . '/../../..' . '/core/Migrations/Version33000Date20251209123503.php', 'OC\\Core\\Migrations\\Version33000Date20260126120000' => __DIR__ . '/../../..' . '/core/Migrations/Version33000Date20260126120000.php', 'OC\\Core\\Migrations\\Version34000Date20260318095645' => __DIR__ . '/../../..' . '/core/Migrations/Version34000Date20260318095645.php', + 'OC\\Core\\Migrations\\Version34000Date20260415161745' => __DIR__ . '/../../..' . '/core/Migrations/Version34000Date20260415161745.php', 'OC\\Core\\Notification\\CoreNotifier' => __DIR__ . '/../../..' . '/core/Notification/CoreNotifier.php', 'OC\\Core\\ResponseDefinitions' => __DIR__ . '/../../..' . '/core/ResponseDefinitions.php', 'OC\\Core\\Service\\CronService' => __DIR__ . '/../../..' . '/core/Service/CronService.php',