Skip to content

Commit

Permalink
disable path prefix index on postgresql for now
Browse files Browse the repository at this point in the history
having the index work properly for the queries we need it for requires some additional options which dbal does not support at the momement.
to prevent making it harder to add the correct index later on we don't create the index for now on postgresql

Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 authored and backportbot[bot] committed Oct 19, 2021
1 parent 82fbf5f commit 7d637f2
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 2 deletions.
1 change: 1 addition & 0 deletions core/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
*/
namespace OC\Core;

use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use OC\Authentication\Events\RemoteWipeFinished;
use OC\Authentication\Events\RemoteWipeStarted;
use OC\Authentication\Listeners\RemoteWipeActivityListener;
Expand Down
1 change: 1 addition & 0 deletions core/Command/Db/AddMissingIndices.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
*/
namespace OC\Core\Command\Db;

use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use OC\DB\Connection;
use OC\DB\SchemaWrapper;
use OCP\IDBConnection;
Expand Down
5 changes: 4 additions & 1 deletion core/Migrations/Version13000Date20170718121200.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
*/
namespace OC\Core\Migrations;

use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
use OCP\IDBConnection;
Expand Down Expand Up @@ -263,7 +264,9 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op
$table->addIndex(['storage', 'size', 'fileid'], 'fs_storage_size');
$table->addIndex(['mtime'], 'fs_mtime');
$table->addIndex(['size'], 'fs_size');
$table->addIndex(['storage', 'path'], 'fs_storage_path_prefix', [], ['lengths' => [null, 64]]);
if (!$schema->getDatabasePlatform() instanceof PostgreSQL94Platform) {
$table->addIndex(['storage', 'path'], 'fs_storage_path_prefix', [], ['lengths' => [null, 64]]);
}
}

if (!$schema->hasTable('group_user')) {
Expand Down
13 changes: 13 additions & 0 deletions lib/private/DB/SchemaWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
*/
namespace OC\DB;

use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\Schema;
use OCP\DB\ISchemaWrapper;

Expand Down Expand Up @@ -129,4 +131,15 @@ public function dropTable($tableName) {
public function getTables() {
return $this->schema->getTables();
}

/**
* Gets the DatabasePlatform for the database.
*
* @return AbstractPlatform
*
* @throws Exception
*/
public function getDatabasePlatform() {
return $this->connection->getDatabasePlatform();
}
}
15 changes: 14 additions & 1 deletion lib/public/DB/ISchemaWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
*/
namespace OCP\DB;

use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\AbstractPlatform;

/**
* Interface ISchemaWrapper
*
Expand Down Expand Up @@ -81,12 +84,22 @@ public function getTables();
* @since 13.0.0
*/
public function getTableNames();

/**
* Gets all table names
*
* @return array
* @since 13.0.0
*/
public function getTableNamesWithoutPrefix();

/**
* Gets the DatabasePlatform for the database.
*
* @return AbstractPlatform
*
* @throws Exception
* @since 23.0.0
*/
public function getDatabasePlatform();
}

0 comments on commit 7d637f2

Please sign in to comment.