diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php index cae50da1455f2..fe6131dc5060e 100644 --- a/lib/private/DB/Connection.php +++ b/lib/private/DB/Connection.php @@ -263,12 +263,12 @@ public function executeQuery(string $sql, array $params = [], $types = [], Query if (count(array_intersect($this->tableDirtyWrites, $tables)) === 0 && !$this->isTransactionActive()) { // No tables read that could have been written already in the same request and no transaction active // so we can switch back to the replica for reading as long as no writes happen that switch back to the primary - $this->ensureConnectedToReplica(); - $this->logger->debug('no dirty table reads: ' . $sql, ['tables' => $this->tableDirtyWrites, 'reads' => $tables]); + // $this->ensureConnectedToReplica(); + $this->logger->error('no dirty table reads: ' . $sql, ['tables' => $this->tableDirtyWrites, 'reads' => $tables]); } else { // Read to a table that was previously written to // While this might not necessarily mean that we did a read after write it is an indication for a code path to check - $this->logger->debug('dirty table reads: ' . $sql, ['tables' => $this->tableDirtyWrites, 'reads' => $tables, 'exception' => new \Exception()]); + $this->logger->error('dirty table reads: ' . $sql, ['tables' => $this->tableDirtyWrites, 'reads' => $tables, 'exception' => new \Exception()]); } $sql = $this->replaceTablePrefix($sql); @@ -283,7 +283,7 @@ public function executeQuery(string $sql, array $params = [], $types = [], Query * used to track dirty tables that received a write with the current request */ private function getQueriedTables(string $sql): array { - $re = '/(\*PREFIX\*[A-z0-9_-]+)/mi'; + $re = '/(\*PREFIX\*\w+)/mi'; preg_match_all($re, $sql, $matches); return array_map([$this, 'replaceTablePrefix'], $matches[0] ?? []); } @@ -316,7 +316,7 @@ public function executeUpdate(string $sql, array $params = [], array $types = [] public function executeStatement($sql, array $params = [], array $types = []): int { $tables = $this->getQueriedTables($sql); $this->tableDirtyWrites = array_unique(array_merge($this->tableDirtyWrites, $tables)); - $this->logger->debug('dirty table writes: ' . $sql, ['tables' => $this->tableDirtyWrites]); + $this->logger->error('dirty table writes: ' . $sql, ['tables' => $this->tableDirtyWrites]); $sql = $this->replaceTablePrefix($sql); $sql = $this->adapter->fixupStatement($sql); $this->queriesExecuted++; @@ -644,7 +644,7 @@ protected function performConnect(?string $connectionName = null): bool { $result = parent::performConnect($connectionName); $after = $this->isConnectedToPrimary(); if (!$before && $after) { - $this->logger->debug('Switched to primary database', ['exception' => new \Exception()]); + $this->logger->error('Switched to primary database', ['exception' => new \Exception()]); } return $result; }