Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/database/load_balancing/primary_host.rb')
-rw-r--r--lib/gitlab/database/load_balancing/primary_host.rb24
1 files changed, 8 insertions, 16 deletions
diff --git a/lib/gitlab/database/load_balancing/primary_host.rb b/lib/gitlab/database/load_balancing/primary_host.rb
index e379652c260..7070cc54d4b 100644
--- a/lib/gitlab/database/load_balancing/primary_host.rb
+++ b/lib/gitlab/database/load_balancing/primary_host.rb
@@ -11,6 +11,12 @@ module Gitlab
# balancing is enabled, but no replicas have been configured (= the
# default case).
class PrimaryHost
+ WAL_ERROR_MESSAGE = <<~MSG.strip
+ Obtaining WAL information when not using any replicas results in
+ redundant queries, and may break installations that don't support
+ streaming replication (e.g. AWS' Aurora database).
+ MSG
+
def initialize(load_balancer)
@load_balancer = load_balancer
end
@@ -51,30 +57,16 @@ module Gitlab
end
def primary_write_location
- @load_balancer.primary_write_location
+ raise NotImplementedError, WAL_ERROR_MESSAGE
end
def database_replica_location
- row = query_and_release(<<-SQL.squish)
- SELECT pg_last_wal_replay_lsn()::text AS location
- SQL
-
- row['location'] if row.any?
- rescue *Host::CONNECTION_ERRORS
- nil
+ raise NotImplementedError, WAL_ERROR_MESSAGE
end
def caught_up?(_location)
true
end
-
- def query_and_release(sql)
- connection.select_all(sql).first || {}
- rescue StandardError
- {}
- ensure
- release_connection
- end
end
end
end