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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
3d1690c7
Commit
3d1690c7
authored
Nov 13, 2018
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a race condition intermittently breaking GitLab startup
parent
132e6c9f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
app/models/shard.rb
app/models/shard.rb
+5
-6
changelogs/unreleased/53972-fix-fill-shards.yml
changelogs/unreleased/53972-fix-fill-shards.yml
+5
-0
No files found.
app/models/shard.rb
View file @
3d1690c7
...
@@ -9,13 +9,12 @@ class Shard < ActiveRecord::Base
...
@@ -9,13 +9,12 @@ class Shard < ActiveRecord::Base
# The GitLab config does not change for the lifecycle of the process
# The GitLab config does not change for the lifecycle of the process
in_config
=
Gitlab
.
config
.
repositories
.
storages
.
keys
.
map
(
&
:to_s
)
in_config
=
Gitlab
.
config
.
repositories
.
storages
.
keys
.
map
(
&
:to_s
)
in_db
=
all
.
pluck
(
:name
)
transaction
do
# This may race with other processes creating shards at the same time, but
in_db
=
all
.
pluck
(
:name
)
# `by_name` will handle that correctly
missing
=
in_config
-
in_db
missing
=
in_config
-
in_db
missing
.
map
{
|
name
|
by_name
(
name
)
}
missing
.
map
{
|
name
|
by_name
(
name
)
}
end
end
end
def
self
.
by_name
(
name
)
def
self
.
by_name
(
name
)
...
...
changelogs/unreleased/53972-fix-fill-shards.yml
0 → 100644
View file @
3d1690c7
---
title
:
Fix a race condition intermittently breaking GitLab startup
merge_request
:
23028
author
:
type
:
fixed
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