Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
5f5906d8
Commit
5f5906d8
authored
Mar 14, 2019
by
Ash McKenzie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New pg_last_xact_replay_timestamp DB helper
parent
044a695c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
1 deletion
+11
-1
ee/lib/gitlab/geo/health_check.rb
ee/lib/gitlab/geo/health_check.rb
+1
-1
lib/gitlab/database.rb
lib/gitlab/database.rb
+4
-0
spec/lib/gitlab/database_spec.rb
spec/lib/gitlab/database_spec.rb
+6
-0
No files found.
ee/lib/gitlab/geo/health_check.rb
View file @
5f5906d8
...
...
@@ -42,7 +42,7 @@ module Gitlab
WHEN
#{
Gitlab
::
Database
.
pg_last_wal_receive_lsn
}
() =
#{
Gitlab
::
Database
.
pg_last_wal_replay_lsn
}
()
THEN 0
ELSE
EXTRACT (EPOCH FROM now() -
pg_last_xact_replay_timestamp
())::INTEGER
EXTRACT (EPOCH FROM now() -
#{
Gitlab
::
Database
.
pg_last_xact_replay_timestamp
}
())::INTEGER
END
AS replication_lag
SQL
...
...
lib/gitlab/database.rb
View file @
5f5906d8
...
...
@@ -102,6 +102,10 @@ module Gitlab
Gitlab
::
Database
.
postgresql_9_or_less?
?
'pg_last_xlog_replay_location'
:
'pg_last_wal_replay_lsn'
end
def
self
.
pg_last_xact_replay_timestamp
'pg_last_xact_replay_timestamp'
end
def
self
.
nulls_last_order
(
field
,
direction
=
'ASC'
)
order
=
"
#{
field
}
#{
direction
}
"
...
...
spec/lib/gitlab/database_spec.rb
View file @
5f5906d8
...
...
@@ -195,6 +195,12 @@ describe Gitlab::Database do
end
end
describe
'.pg_last_xact_replay_timestamp'
do
it
'returns pg_last_xact_replay_timestamp'
do
expect
(
described_class
.
pg_last_xact_replay_timestamp
).
to
eq
(
'pg_last_xact_replay_timestamp'
)
end
end
describe
'.nulls_last_order'
do
context
'when using PostgreSQL'
do
before
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment