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
c8676585
Commit
c8676585
authored
Jan 25, 2022
by
Dmitry Gruzd
Committed by
Etienne Baqué
Jan 25, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Advanced Search: Always use UTC for index names
parent
baaa2104
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
ee/lib/gitlab/elastic/helper.rb
ee/lib/gitlab/elastic/helper.rb
+5
-1
ee/spec/lib/ee/gitlab/elastic/helper_spec.rb
ee/spec/lib/ee/gitlab/elastic/helper_spec.rb
+8
-0
No files found.
ee/lib/gitlab/elastic/helper.rb
View file @
c8676585
...
...
@@ -61,6 +61,10 @@ module Gitlab
"
#{
target_name
}
-migrations"
end
def
index_name_with_timestamp
(
alias_name
)
"
#{
alias_name
}
-
#{
Time
.
now
.
utc
.
strftime
(
'%Y%m%d-%H%M'
)
}
"
end
def
create_migrations_index
settings
=
{
number_of_shards:
1
}
mappings
=
{
...
...
@@ -114,7 +118,7 @@ module Gitlab
proxies
=
standalone_indices_proxies
(
target_classes:
target_classes
)
proxies
.
each_with_object
({})
do
|
proxy
,
indices
|
alias_name
=
proxy
.
index_name
new_index_name
=
"
#{
alias_name
}
-
#{
Time
.
now
.
strftime
(
"%Y%m%d-%H%M"
)
}
"
new_index_name
=
index_name_with_timestamp
(
alias_name
)
create_index
(
new_index_name
,
alias_name
,
with_alias
,
proxy
.
settings
.
to_hash
,
proxy
.
mappings
.
to_hash
,
options
)
indices
[
new_index_name
]
=
alias_name
...
...
ee/spec/lib/ee/gitlab/elastic/helper_spec.rb
View file @
c8676585
...
...
@@ -63,6 +63,14 @@ RSpec.describe Gitlab::Elastic::Helper, :request_store do
end
end
describe
'#index_name_with_timestamp'
,
time_travel_to:
'2022-01-02 10:30:45 -0700'
do
subject
{
helper
.
index_name_with_timestamp
(
'gitlab-production'
)
}
it
'returns correct index name'
do
is_expected
.
to
eq
(
'gitlab-production-20220102-1730'
)
end
end
describe
'#create_migrations_index'
do
after
do
helper
.
delete_migrations_index
...
...
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