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

Issue #3181013 by Driskell, alexpott, ericgsmith, Pan Lee, smustgrave, Kristen...

Issue #3181013 by Driskell, alexpott, ericgsmith, Pan Lee, smustgrave, Kristen Pol, mxr576: Faulty permanent config cache has been set to the cache backend on failed sql server connection
parent 5d011419
No related branches found
No related tags found
37 merge requests!8528Issue #3456871 by Tim Bozeman: Support NULL services,!8323Fix source code editing and in place front page site studio editing.,!6278Issue #3187770 by godotislate, smustgrave, catch, quietone: Views Rendered...,!3878Removed unused condition head title for views,!38582585169-10.1.x,!3818Issue #2140179: $entity->original gets stale between updates,!3742Issue #3328429: Create item list field formatter for displaying ordered and unordered lists,!3731Claro: role=button on status report items,!3668Resolve #3347842 "Deprecate the trusted",!3651Issue #3347736: Create new SDC component for Olivero (header-search),!3546refactored dialog.pcss file,!3531Issue #3336994: StringFormatter always displays links to entity even if the user in context does not have access,!3502Issue #3335308: Confusing behavior with FormState::setFormState and FormState::setMethod,!3452Issue #3332701: Refactor Claro's tablesort-indicator stylesheet,!3355Issue #3209129: Scrolling problems when adding a block via layout builder,!3226Issue #2987537: Custom menu link entity type should not declare "bundle" entity key,!3154Fixes #2987987 - CSRF token validation broken on routes with optional parameters.,!3147Issue #3328457: Replace most substr($a, $i) where $i is negative with str_ends_with(),!3146Issue #3328456: Replace substr($a, 0, $i) with str_starts_with(),!3133core/modules/system/css/components/hidden.module.css,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!2812Issue #3312049: [Followup] Fix Drupal.Commenting.FunctionComment.MissingReturnType returns for NULL,!2614Issue #2981326: Replace non-test usages of \Drupal::logger() with IoC injection,!2378Issue #2875033: Optimize joins and table selection in SQL entity query implementation,!2334Issue #3228209: Add hasRole() method to AccountInterface,!2062Issue #3246454: Add weekly granularity to views date sort,!1255Issue #3238922: Refactor (if feasible) uses of the jQuery serialize function to use vanillaJS,!1105Issue #3025039: New non translatable field on translatable content throws error,!1073issue #3191727: Focus states on mobile second level navigation items fixed,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!877Issue #2708101: Default value for link text is not saved,!844Resolve #3036010 "Updaters",!673Issue #3214208: FinishResponseSubscriber could create duplicate headers,!617Issue #3043725: Provide a Entity Handler for user cancelation,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493
Pipeline #55621 canceled
Pipeline: drupal

#55624

    ......@@ -72,8 +72,11 @@ public function exists($name) {
    ], $this->options)->fetchField();
    }
    catch (\Exception $e) {
    // If we attempt a read without actually having the database or the table
    // available, just return FALSE so the caller can handle it.
    if ($this->connection->schema()->tableExists($this->table)) {
    throw $e;
    }
    // If we attempt a read without actually having the table available,
    // return false so the caller can handle it.
    return FALSE;
    }
    }
    ......@@ -90,8 +93,11 @@ public function read($name) {
    }
    }
    catch (\Exception $e) {
    // If we attempt a read without actually having the database or the table
    // available, just return FALSE so the caller can handle it.
    if ($this->connection->schema()->tableExists($this->table)) {
    throw $e;
    }
    // If we attempt a read without actually having the table available,
    // return false so the caller can handle it.
    }
    return $data;
    }
    ......@@ -108,8 +114,11 @@ public function readMultiple(array $names) {
    }
    }
    catch (\Exception $e) {
    // If we attempt a read without actually having the database or the table
    // available, just return an empty array so the caller can handle it.
    if ($this->connection->schema()->tableExists($this->table)) {
    throw $e;
    }
    // If we attempt a read without actually having the table available,
    // return an empty array so the caller can handle it.
    }
    return $list;
    }
    ......@@ -277,6 +286,11 @@ public function listAll($prefix = '') {
    return $query->execute()->fetchCol();
    }
    catch (\Exception $e) {
    if ($this->connection->schema()->tableExists($this->table)) {
    throw $e;
    }
    // If we attempt a read without actually having the table available,
    // return an empty array so the caller can handle it.
    return [];
    }
    }
    ......@@ -295,6 +309,11 @@ public function deleteAll($prefix = '') {
    ->execute();
    }
    catch (\Exception $e) {
    if ($this->connection->schema()->tableExists($this->table)) {
    throw $e;
    }
    // If we attempt a delete without actually having the table available,
    // return false so the caller can handle it.
    return FALSE;
    }
    }
    ......@@ -328,6 +347,11 @@ public function getAllCollectionNames() {
    ])->fetchCol();
    }
    catch (\Exception $e) {
    if ($this->connection->schema()->tableExists($this->table)) {
    throw $e;
    }
    // If we attempt a read without actually having the table available,
    // return an empty array so the caller can handle it.
    return [];
    }
    }
    ......
    ......@@ -4,6 +4,7 @@
    use Drupal\Core\Config\DatabaseStorage;
    use Drupal\Core\Database\Database;
    use Drupal\Core\Database\DatabaseExceptionWrapper;
    /**
    * Tests DatabaseStorage operations.
    ......@@ -39,4 +40,87 @@ protected function delete($name) {
    Database::getConnection()->delete('config')->condition('name', $name)->execute();
    }
    /**
    * Tests that operations throw exceptions if the query fails.
    */
    public function testExceptionIsThrownIfQueryFails() {
    $connection = Database::getConnection();
    if ($connection->databaseType() === 'sqlite') {
    // See: https://www.drupal.org/project/drupal/issues/3349286
    $this->markTestSkipped('SQLite cannot allow detection of exceptions due to double quoting.');
    return;
    }
    Database::getConnection()->schema()->dropTable('config');
    // In order to simulate database issue create a table with an incorrect
    // specification.
    $table_specification = [
    'fields' => [
    'id' => [
    'type' => 'int',
    'default' => NULL,
    ],
    ],
    ];
    Database::getConnection()->schema()->createTable('config', $table_specification);
    try {
    $this->storage->exists('config.settings');
    $this->fail('Expected exception not thrown from exists()');
    }
    catch (DatabaseExceptionWrapper $e) {
    // Exception was expected
    }
    try {
    $this->storage->read('config.settings');
    $this->fail('Expected exception not thrown from read()');
    }
    catch (DatabaseExceptionWrapper $e) {
    // Exception was expected
    }
    try {
    $this->storage->readMultiple(['config.settings', 'config.settings2']);
    $this->fail('Expected exception not thrown from readMultiple()');
    }
    catch (DatabaseExceptionWrapper $e) {
    // Exception was expected
    }
    try {
    $this->storage->write('config.settings', ['data' => '']);
    $this->fail('Expected exception not thrown from deleteAll()');
    }
    catch (DatabaseExceptionWrapper $e) {
    // Exception was expected
    }
    try {
    $this->storage->listAll();
    $this->fail('Expected exception not thrown from listAll()');
    }
    catch (DatabaseExceptionWrapper $e) {
    // Exception was expected
    }
    try {
    $this->storage->deleteAll();
    $this->fail('Expected exception not thrown from deleteAll()');
    }
    catch (DatabaseExceptionWrapper $e) {
    // Exception was expected
    }
    try {
    $this->storage->getAllCollectionNames();
    $this->fail('Expected exception not thrown from getAllCollectionNames()');
    }
    catch (DatabaseExceptionWrapper $e) {
    // Exception was expected
    }
    $this->assertTrue(TRUE);
    }
    }
    • catch @catch

      mentioned in commit d8b92d57

      ·

      mentioned in commit d8b92d57

      Toggle commit list
    • catch @catch

      mentioned in commit 562a13e2

      ·

      mentioned in commit 562a13e2

      Toggle commit list
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment