Skip to content
Snippets Groups Projects
Commit a96bd6da authored by catch's avatar catch
Browse files

Issue #3217783 by prudloff, bircher, jsst, nigelcunningham, alexpott,...

Issue #3217783 by prudloff, bircher, jsst, nigelcunningham, alexpott, longwave: Configuration management performance regression - slow config:import
parent 8a10f82f
No related branches found
No related tags found
3 merge requests!5423Draft: Resolve #3329907 "Test2",!3478Issue #3337882: Deleted menus are not removed from content type config,!579Issue #2230909: Simple decimals fail to pass validation
Pipeline #477237 passed with warnings
Pipeline: drupal

#477254

    Pipeline: drupal

    #477249

      Pipeline: drupal

      #477246

        ......@@ -22,13 +22,6 @@ final class ExportStorageManager implements StorageManagerInterface {
        */
        const LOCK_NAME = 'config_storage_export_manager';
        /**
        * The active configuration storage.
        *
        * @var \Drupal\Core\Config\StorageInterface
        */
        protected $active;
        /**
        * The database storage.
        *
        ......@@ -36,20 +29,6 @@ final class ExportStorageManager implements StorageManagerInterface {
        */
        protected $storage;
        /**
        * The event dispatcher.
        *
        * @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface
        */
        protected $eventDispatcher;
        /**
        * The used lock backend instance.
        *
        * @var \Drupal\Core\Lock\LockBackendInterface
        */
        protected $lock;
        /**
        * ExportStorageManager constructor.
        *
        ......@@ -57,15 +36,17 @@ final class ExportStorageManager implements StorageManagerInterface {
        * The active config storage to prime the export storage.
        * @param \Drupal\Core\Database\Connection $connection
        * The database connection.
        * @param \Symfony\Contracts\EventDispatcher\EventDispatcherInterface $event_dispatcher
        * @param \Symfony\Contracts\EventDispatcher\EventDispatcherInterface $eventDispatcher
        * The event dispatcher.
        * @param \Drupal\Core\Lock\LockBackendInterface $lock
        * The used lock backend instance.
        */
        public function __construct(StorageInterface $active, Connection $connection, EventDispatcherInterface $event_dispatcher, LockBackendInterface $lock) {
        $this->active = $active;
        $this->eventDispatcher = $event_dispatcher;
        $this->lock = $lock;
        public function __construct(
        protected StorageInterface $active,
        protected Connection $connection,
        protected EventDispatcherInterface $eventDispatcher,
        protected LockBackendInterface $lock,
        ) {
        // The point of this service is to provide the storage and dispatch the
        // event when needed, so the storage itself can not be a service.
        $this->storage = new DatabaseStorage($connection, 'config_export');
        ......@@ -84,7 +65,11 @@ public function getStorage() {
        }
        }
        // Wrapping the queries in a transaction for performance gain.
        $transaction = $this->connection->startTransaction();
        self::replaceStorageContents($this->active, $this->storage);
        unset($transaction);
        $this->eventDispatcher->dispatch(new StorageTransformEvent($this->storage), ConfigEvents::STORAGE_TRANSFORM_EXPORT);
        return new ReadOnlyStorage($this->storage);
        ......
        ......@@ -114,7 +114,10 @@ public function transform(StorageInterface $storage) {
        }
        // Copy the sync configuration to the created mutable storage.
        // Wrapping the queries in a transaction for performance gain.
        $transaction = $this->connection->startTransaction();
        self::replaceStorageContents($storage, $mutable);
        unset($transaction);
        // Dispatch the event so that event listeners can alter the configuration.
        $this->eventDispatcher->dispatch(new StorageTransformEvent($mutable), ConfigEvents::STORAGE_TRANSFORM_IMPORT);
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment