Skip to content

Commit 9a0b7ad

Browse files
committed
feat postgresql: more diagnostic
commit_hash:a408f03ff639b64a235503e387677b0c83a4682d
1 parent bdab7e2 commit 9a0b7ad

File tree

1 file changed

+7
-2
lines changed
  • postgresql/src/storages/postgres/detail

1 file changed

+7
-2
lines changed

postgresql/src/storages/postgres/detail/pool.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,13 +480,18 @@ void ConnectionPool::TryCreateConnectionAsync() {
480480
auto conn_settings = conn_settings_.ReadCopy();
481481
// Checking errors is more expensive than incrementing an atomic, so we
482482
// check it only if we can start a new connection.
483-
if (recent_conn_errors_.GetStatsForPeriod(kRecentErrorPeriod, true) < conn_settings.recent_errors_threshold) {
483+
const auto recent_errors = recent_conn_errors_.GetStatsForPeriod(kRecentErrorPeriod, true);
484+
if (recent_errors < conn_settings.recent_errors_threshold) {
484485
engine::SemaphoreLock size_lock{size_semaphore_, std::try_to_lock};
485486
if (size_lock || connect_task_storage_.ActiveTasksApprox() <= kPendingConnectsMax) {
486487
connect_task_storage_.Detach(Connect(std::move(size_lock), std::move(conn_settings)));
487488
}
488489
} else {
489-
LOG_DEBUG() << "Too many connection errors in recent period";
490+
LOG_LIMITED_WARNING(
491+
"Too many connection errors in recent period: {} >= {}",
492+
recent_errors,
493+
conn_settings.recent_errors_threshold
494+
);
490495
}
491496
}
492497

0 commit comments

Comments
 (0)