diff --git a/core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php b/core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php index 63420aa..0924c00 100644 --- a/core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php +++ b/core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php @@ -108,14 +108,17 @@ public function calculateChecksum(array $tags) { if ($query_tags) { $db_tags = array(); try { - $db_tags = $this->connection->select('cachetags', 'ct') - ->condition('tag', $query_tags, 'IN') - ->fields('ct', array('tag', 'invalidations')) - ->execute() + // Add a transaction because this query is anticipated to fail because + // cache-related tables are not gauranteed to exist. + // @todo Revisit after https://www.drupal.org/node/2371709 + $txn = $this->connection->startTransaction('cache_tags'); + $db_tags = $this->connection->query('SELECT tag, invalidations FROM {cachetags} WHERE tag IN ( :tags[] )', array(':tags[]' => $query_tags)) ->fetchAllKeyed(); + $this->connection->popTransaction('cache_tags'); $this->tagCache += $db_tags; } catch (\Exception $e) { + $txn->rollback(); // If the table does not exist yet, create. if (!$this->ensureTableExists()) { $this->catchException($e);