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
bc12858f
Commit
bc12858f
authored
Jul 06, 2021
by
Aleksei Lipniagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deprecate load_balancer#all_caught_up? method
The method is just an alias after FF removal. We could drop it.
parent
3848ff31
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
22 deletions
+9
-22
lib/gitlab/database/load_balancing/load_balancer.rb
lib/gitlab/database/load_balancing/load_balancer.rb
+0
-5
lib/gitlab/database/load_balancing/sticking.rb
lib/gitlab/database/load_balancing/sticking.rb
+3
-3
spec/lib/gitlab/database/load_balancing/load_balancer_spec.rb
.../lib/gitlab/database/load_balancing/load_balancer_spec.rb
+0
-8
spec/lib/gitlab/database/load_balancing/sticking_spec.rb
spec/lib/gitlab/database/load_balancing/sticking_spec.rb
+6
-6
No files found.
lib/gitlab/database/load_balancing/load_balancer.rb
View file @
bc12858f
...
...
@@ -147,11 +147,6 @@ module Gitlab
raise
'Failed to determine the write location of the primary database'
end
# Returns true if there was at least one host that has caught up with the given transaction and sets it.
def
all_caught_up?
(
location
)
select_up_to_date_host
(
location
)
end
# Returns true if there was at least one host that has caught up with the given transaction.
#
# In case of a retry, this method also stores the set of hosts that have caught up.
...
...
lib/gitlab/database/load_balancing/sticking.rb
View file @
bc12858f
...
...
@@ -33,10 +33,10 @@ module Gitlab
return
true
unless
location
load_balancer
.
all_caught_up?
(
location
).
tap
do
|
caught_up
|
ActiveSupport
::
Notifications
.
instrument
(
'caught_up_replica_pick.load_balancing'
,
{
result:
caught_up
}
)
load_balancer
.
select_up_to_date_host
(
location
).
tap
do
|
found
|
ActiveSupport
::
Notifications
.
instrument
(
'caught_up_replica_pick.load_balancing'
,
{
result:
found
}
)
unstick
(
namespace
,
id
)
if
caught_up
unstick
(
namespace
,
id
)
if
found
end
end
...
...
spec/lib/gitlab/database/load_balancing/load_balancer_spec.rb
View file @
bc12858f
...
...
@@ -306,14 +306,6 @@ RSpec.describe Gitlab::Database::LoadBalancing::LoadBalancer, :request_store do
end
end
describe
'#all_caught_up?'
do
it
'delegates execution to #select_up_to_date_host'
do
expect
(
lb
).
to
receive
(
:select_up_to_date_host
).
with
(
'foo'
).
and_return
(
true
)
expect
(
lb
.
all_caught_up?
(
'foo'
)).
to
eq
(
true
)
end
end
describe
'#retry_with_backoff'
do
it
'returns the value returned by the block'
do
value
=
lb
.
retry_with_backoff
{
10
}
...
...
spec/lib/gitlab/database/load_balancing/sticking_spec.rb
View file @
bc12858f
...
...
@@ -64,7 +64,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::Sticking, :redis do
.
with
(
:user
,
42
)
.
and_return
(
nil
)
expect
(
lb
).
not_to
receive
(
:
all_caught_up?
)
expect
(
lb
).
not_to
receive
(
:
select_up_to_date_host
)
expect
(
described_class
.
all_caught_up?
(
:user
,
42
)).
to
eq
(
true
)
end
...
...
@@ -72,7 +72,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::Sticking, :redis do
context
'when all secondaries have caught up'
do
before
do
allow
(
lb
).
to
receive
(
:
all_caught_up?
).
with
(
'foo'
).
and_return
(
true
)
allow
(
lb
).
to
receive
(
:
select_up_to_date_host
).
with
(
'foo'
).
and_return
(
true
)
end
it
'returns true, and unsticks'
do
...
...
@@ -93,7 +93,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::Sticking, :redis do
context
'when the secondaries have not yet caught up'
do
before
do
allow
(
lb
).
to
receive
(
:
all_caught_up?
).
with
(
'foo'
).
and_return
(
false
)
allow
(
lb
).
to
receive
(
:
select_up_to_date_host
).
with
(
'foo'
).
and_return
(
false
)
end
it
'returns false'
do
...
...
@@ -123,7 +123,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::Sticking, :redis do
.
with
(
:user
,
42
)
.
and_return
(
nil
)
expect
(
lb
).
not_to
receive
(
:
all_caught_up?
)
expect
(
lb
).
not_to
receive
(
:
select_up_to_date_host
)
described_class
.
unstick_or_continue_sticking
(
:user
,
42
)
end
...
...
@@ -133,7 +133,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::Sticking, :redis do
.
with
(
:user
,
42
)
.
and_return
(
'foo'
)
allow
(
lb
).
to
receive
(
:
all_caught_up?
).
with
(
'foo'
).
and_return
(
true
)
allow
(
lb
).
to
receive
(
:
select_up_to_date_host
).
with
(
'foo'
).
and_return
(
true
)
expect
(
described_class
).
to
receive
(
:unstick
).
with
(
:user
,
42
)
...
...
@@ -145,7 +145,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::Sticking, :redis do
.
with
(
:user
,
42
)
.
and_return
(
'foo'
)
allow
(
lb
).
to
receive
(
:
all_caught_up?
).
with
(
'foo'
).
and_return
(
false
)
allow
(
lb
).
to
receive
(
:
select_up_to_date_host
).
with
(
'foo'
).
and_return
(
false
)
expect
(
Gitlab
::
Database
::
LoadBalancing
::
Session
.
current
)
.
to
receive
(
:use_primary!
)
...
...
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