Loading core/lib/Drupal/Core/Config/ExportStorageManager.php +1 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ public function getStorage() { // Wrapping the queries in a transaction for performance gain. $transaction = $this->connection->startTransaction(); self::replaceStorageContents($this->active, $this->storage); unset($transaction); $transaction->commitOrRelease(); $this->eventDispatcher->dispatch(new StorageTransformEvent($this->storage), ConfigEvents::STORAGE_TRANSFORM_EXPORT); Loading core/lib/Drupal/Core/Config/ImportStorageTransformer.php +1 −1 Original line number Diff line number Diff line Loading @@ -117,7 +117,7 @@ public function transform(StorageInterface $storage) { // Wrapping the queries in a transaction for performance gain. $transaction = $this->connection->startTransaction(); self::replaceStorageContents($storage, $mutable); unset($transaction); $transaction->commitOrRelease(); // Dispatch the event so that event listeners can alter the configuration. $this->eventDispatcher->dispatch(new StorageTransformEvent($mutable), ConfigEvents::STORAGE_TRANSFORM_IMPORT); Loading core/lib/Drupal/Core/Database/Query/Insert.php +1 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ public function execute() { $stmt->execute($insert_values, $this->queryOptions); $last_insert_id = $this->connection->lastInsertId(); } $transaction->commitOrRelease(); } catch (\Exception $e) { if (isset($transaction)) { Loading core/lib/Drupal/Core/Database/Transaction/TransactionManagerBase.php +7 −1 Original line number Diff line number Diff line Loading @@ -345,6 +345,12 @@ public function unpile(string $name, string $id): void { return; } // If the client transaction was already committed, there's no longer // anything to do on an explicit commit/savepoint release. if ($this->getConnectionTransactionState() === ClientConnectionTransactionState::Committed) { return; } // If there is no $id to commit, or if $id does not correspond to the one // in the stack for that $name, the commit is out of order. if (!isset($this->stack()[$id]) || $this->stack()[$id]->name !== $name) { Loading Loading @@ -408,7 +414,7 @@ public function rollback(string $name, string $id): void { // If the transaction was voided, we cannot rollback. Fail silently but // trigger a user warning. if ($this->getConnectionTransactionState() === ClientConnectionTransactionState::Voided) { $this->connectionTransactionState = ClientConnectionTransactionState::RollbackFailed; $this->setConnectionTransactionState(ClientConnectionTransactionState::RollbackFailed); trigger_error('Transaction::rollBack() failed because of a prior execution of a DDL statement.', E_USER_WARNING); return; } Loading core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php +23 −3 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ use Drupal\Core\Database\DatabaseExceptionWrapper; use Drupal\Core\Database\SchemaException; use Drupal\Core\Database\Statement\FetchAs; use Drupal\Core\Database\TransactionOutOfOrderException; use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\ContentEntityStorageBase; use Drupal\Core\Entity\ContentEntityTypeInterface; Loading Loading @@ -764,14 +765,20 @@ public function delete(array $entities) { try { $transaction = $this->database->startTransaction(); parent::delete($entities); $transaction->commitOrRelease(); // Ignore replica server temporarily. \Drupal::service('database.replica_kill_switch')->trigger(); } catch (\Exception $e) { if (isset($transaction)) { try { $transaction->rollBack(); } catch (TransactionOutOfOrderException $rollbackException) { Error::logException(\Drupal::logger($this->entityTypeId), $rollbackException); } } Error::logException(\Drupal::logger($this->entityTypeId), $e); throw new EntityStorageException($e->getMessage(), $e->getCode(), $e); } Loading Loading @@ -815,6 +822,7 @@ public function save(EntityInterface $entity) { try { $transaction = $this->database->startTransaction(); $return = parent::save($entity); $transaction->commitOrRelease(); // Ignore replica server temporarily. \Drupal::service('database.replica_kill_switch')->trigger(); Loading @@ -822,8 +830,13 @@ public function save(EntityInterface $entity) { } catch (\Exception $e) { if (isset($transaction)) { try { $transaction->rollBack(); } catch (TransactionOutOfOrderException $rollbackException) { Error::logException(\Drupal::logger($this->entityTypeId), $rollbackException); } } Error::logException(\Drupal::logger($this->entityTypeId), $e); throw new EntityStorageException($e->getMessage(), $e->getCode(), $e); } Loading Loading @@ -866,13 +879,20 @@ public function restore(EntityInterface $entity) { // Insert the entity data in the dedicated tables. $this->saveToDedicatedTables($entity, FALSE, []); $transaction->commitOrRelease(); // Ignore replica server temporarily. \Drupal::service('database.replica_kill_switch')->trigger(); } catch (\Exception $e) { if (isset($transaction)) { try { $transaction->rollBack(); } catch (TransactionOutOfOrderException $rollbackException) { Error::logException(\Drupal::logger($this->entityTypeId), $rollbackException); } } Error::logException(\Drupal::logger($this->entityTypeId), $e); throw new EntityStorageException($e->getMessage(), $e->getCode(), $e); } Loading Loading
core/lib/Drupal/Core/Config/ExportStorageManager.php +1 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ public function getStorage() { // Wrapping the queries in a transaction for performance gain. $transaction = $this->connection->startTransaction(); self::replaceStorageContents($this->active, $this->storage); unset($transaction); $transaction->commitOrRelease(); $this->eventDispatcher->dispatch(new StorageTransformEvent($this->storage), ConfigEvents::STORAGE_TRANSFORM_EXPORT); Loading
core/lib/Drupal/Core/Config/ImportStorageTransformer.php +1 −1 Original line number Diff line number Diff line Loading @@ -117,7 +117,7 @@ public function transform(StorageInterface $storage) { // Wrapping the queries in a transaction for performance gain. $transaction = $this->connection->startTransaction(); self::replaceStorageContents($storage, $mutable); unset($transaction); $transaction->commitOrRelease(); // Dispatch the event so that event listeners can alter the configuration. $this->eventDispatcher->dispatch(new StorageTransformEvent($mutable), ConfigEvents::STORAGE_TRANSFORM_IMPORT); Loading
core/lib/Drupal/Core/Database/Query/Insert.php +1 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ public function execute() { $stmt->execute($insert_values, $this->queryOptions); $last_insert_id = $this->connection->lastInsertId(); } $transaction->commitOrRelease(); } catch (\Exception $e) { if (isset($transaction)) { Loading
core/lib/Drupal/Core/Database/Transaction/TransactionManagerBase.php +7 −1 Original line number Diff line number Diff line Loading @@ -345,6 +345,12 @@ public function unpile(string $name, string $id): void { return; } // If the client transaction was already committed, there's no longer // anything to do on an explicit commit/savepoint release. if ($this->getConnectionTransactionState() === ClientConnectionTransactionState::Committed) { return; } // If there is no $id to commit, or if $id does not correspond to the one // in the stack for that $name, the commit is out of order. if (!isset($this->stack()[$id]) || $this->stack()[$id]->name !== $name) { Loading Loading @@ -408,7 +414,7 @@ public function rollback(string $name, string $id): void { // If the transaction was voided, we cannot rollback. Fail silently but // trigger a user warning. if ($this->getConnectionTransactionState() === ClientConnectionTransactionState::Voided) { $this->connectionTransactionState = ClientConnectionTransactionState::RollbackFailed; $this->setConnectionTransactionState(ClientConnectionTransactionState::RollbackFailed); trigger_error('Transaction::rollBack() failed because of a prior execution of a DDL statement.', E_USER_WARNING); return; } Loading
core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php +23 −3 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ use Drupal\Core\Database\DatabaseExceptionWrapper; use Drupal\Core\Database\SchemaException; use Drupal\Core\Database\Statement\FetchAs; use Drupal\Core\Database\TransactionOutOfOrderException; use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\ContentEntityStorageBase; use Drupal\Core\Entity\ContentEntityTypeInterface; Loading Loading @@ -764,14 +765,20 @@ public function delete(array $entities) { try { $transaction = $this->database->startTransaction(); parent::delete($entities); $transaction->commitOrRelease(); // Ignore replica server temporarily. \Drupal::service('database.replica_kill_switch')->trigger(); } catch (\Exception $e) { if (isset($transaction)) { try { $transaction->rollBack(); } catch (TransactionOutOfOrderException $rollbackException) { Error::logException(\Drupal::logger($this->entityTypeId), $rollbackException); } } Error::logException(\Drupal::logger($this->entityTypeId), $e); throw new EntityStorageException($e->getMessage(), $e->getCode(), $e); } Loading Loading @@ -815,6 +822,7 @@ public function save(EntityInterface $entity) { try { $transaction = $this->database->startTransaction(); $return = parent::save($entity); $transaction->commitOrRelease(); // Ignore replica server temporarily. \Drupal::service('database.replica_kill_switch')->trigger(); Loading @@ -822,8 +830,13 @@ public function save(EntityInterface $entity) { } catch (\Exception $e) { if (isset($transaction)) { try { $transaction->rollBack(); } catch (TransactionOutOfOrderException $rollbackException) { Error::logException(\Drupal::logger($this->entityTypeId), $rollbackException); } } Error::logException(\Drupal::logger($this->entityTypeId), $e); throw new EntityStorageException($e->getMessage(), $e->getCode(), $e); } Loading Loading @@ -866,13 +879,20 @@ public function restore(EntityInterface $entity) { // Insert the entity data in the dedicated tables. $this->saveToDedicatedTables($entity, FALSE, []); $transaction->commitOrRelease(); // Ignore replica server temporarily. \Drupal::service('database.replica_kill_switch')->trigger(); } catch (\Exception $e) { if (isset($transaction)) { try { $transaction->rollBack(); } catch (TransactionOutOfOrderException $rollbackException) { Error::logException(\Drupal::logger($this->entityTypeId), $rollbackException); } } Error::logException(\Drupal::logger($this->entityTypeId), $e); throw new EntityStorageException($e->getMessage(), $e->getCode(), $e); } Loading