Quellcode durchsuchen

disable path prefix index on postgresql for now

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>
tags/v23.0.0beta2
Robin Appelman vor 2 Jahren
Ursprung
Commit
695326534c
Es ist kein Account mit der E-Mail-Adresse des Committers verbunden

+ 2
- 1
core/Application.php Datei anzeigen

@@ -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;
@@ -119,7 +120,7 @@ class Application extends App {
$subject->addHintForMissingSubject($table->getName(), 'fs_id_storage_size');
}

if (!$table->hasIndex('fs_storage_path_prefix')) {
if (!$table->hasIndex('fs_storage_path_prefix') && !$schema->getDatabasePlatform() instanceof PostgreSQL94Platform) {
$subject->addHintForMissingSubject($table->getName(), 'fs_storage_path_prefix');
}
}

+ 2
- 1
core/Command/Db/AddMissingIndices.php Datei anzeigen

@@ -33,6 +33,7 @@ declare(strict_types=1);
*/
namespace OC\Core\Command\Db;

use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use OC\DB\Connection;
use OC\DB\SchemaWrapper;
use OCP\IDBConnection;
@@ -151,7 +152,7 @@ class AddMissingIndices extends Command {
$updated = true;
$output->writeln('<info>Filecache table updated successfully.</info>');
}
if (!$table->hasIndex('fs_storage_path_prefix')) {
if (!$table->hasIndex('fs_storage_path_prefix') && !$schema->getDatabasePlatform() instanceof PostgreSQL94Platform) {
$output->writeln('<info>Adding additional path index to the filecache table, this can take some time...</info>');
$table->addIndex(['storage', 'path'], 'fs_storage_path_prefix', [], ['lengths' => [null, 64]]);
$this->connection->migrateToSchema($schema->getWrappedSchema());

+ 4
- 1
core/Migrations/Version13000Date20170718121200.php Datei anzeigen

@@ -31,6 +31,7 @@
*/
namespace OC\Core\Migrations;

use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
use OCP\IDBConnection;
@@ -264,7 +265,9 @@ class Version13000Date20170718121200 extends SimpleMigrationStep {
$table->addIndex(['fileid', 'storage', 'size'], 'fs_id_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')) {

+ 13
- 0
lib/private/DB/SchemaWrapper.php Datei anzeigen

@@ -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;

@@ -129,4 +131,15 @@ class SchemaWrapper implements ISchemaWrapper {
public function getTables() {
return $this->schema->getTables();
}

/**
* Gets the DatabasePlatform for the database.
*
* @return AbstractPlatform
*
* @throws Exception
*/
public function getDatabasePlatform() {
return $this->connection->getDatabasePlatform();
}
}

+ 14
- 1
lib/public/DB/ISchemaWrapper.php Datei anzeigen

@@ -22,6 +22,9 @@
*/
namespace OCP\DB;

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

/**
* Interface ISchemaWrapper
*
@@ -81,7 +84,7 @@ interface ISchemaWrapper {
* @since 13.0.0
*/
public function getTableNames();
/**
* Gets all table names
*
@@ -89,4 +92,14 @@ interface ISchemaWrapper {
* @since 13.0.0
*/
public function getTableNamesWithoutPrefix();

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

Laden…
Abbrechen
Speichern