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
15089f98
Commit
15089f98
authored
Jul 09, 2021
by
Andreas Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reset memoized bloat estimation upon #reset
parent
dfe060f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
lib/gitlab/database/postgres_index.rb
lib/gitlab/database/postgres_index.rb
+4
-1
spec/lib/gitlab/database/postgres_index_spec.rb
spec/lib/gitlab/database/postgres_index_spec.rb
+18
-0
No files found.
lib/gitlab/database/postgres_index.rb
View file @
15089f98
...
...
@@ -38,7 +38,10 @@ module Gitlab
where
(
'NOT EXISTS (?)'
,
recent_actions
)
end
alias_method
:reset
,
:reload
def
reset
reload
# rubocop:disable Cop/ActiveRecordAssociationReload
clear_memoization
(
:bloat_size
)
end
def
bloat_size
strong_memoize
(
:bloat_size
)
{
bloat_estimate
&
.
bloat_size
||
0
}
...
...
spec/lib/gitlab/database/postgres_index_spec.rb
View file @
15089f98
...
...
@@ -107,6 +107,24 @@ RSpec.describe Gitlab::Database::PostgresIndex do
end
end
describe
'#reset'
do
subject
{
index
.
reset
}
let
(
:index
)
{
described_class
.
by_identifier
(
identifier
)
}
it
'calls #reload'
do
expect
(
index
).
to
receive
(
:reload
).
once
.
and_call_original
subject
end
it
'resets the bloat estimation'
do
expect
(
index
).
to
receive
(
:clear_memoization
).
with
(
:bloat_size
).
and_call_original
subject
end
end
describe
'#unique?'
do
it
'returns true for a unique index'
do
expect
(
find
(
'public.bar_key'
)).
to
be_unique
...
...
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