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
0bff6c12
Commit
0bff6c12
authored
Dec 11, 2020
by
Patrick Bair
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ab/track-bloat' into 'master'
Track index bloat estimate See merge request gitlab-org/gitlab!49822
parents
4f35e055
1395fe27
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
2 deletions
+25
-2
changelogs/unreleased/ab-track-bloat.yml
changelogs/unreleased/ab-track-bloat.yml
+5
-0
db/migrate/20201211145950_add_bloat_estimate_to_reindex_action.rb
...te/20201211145950_add_bloat_estimate_to_reindex_action.rb
+9
-0
db/schema_migrations/20201211145950
db/schema_migrations/20201211145950
+1
-0
db/structure.sql
db/structure.sql
+1
-0
lib/gitlab/database/reindexing/reindex_action.rb
lib/gitlab/database/reindexing/reindex_action.rb
+2
-1
spec/lib/gitlab/database/reindexing/reindex_action_spec.rb
spec/lib/gitlab/database/reindexing/reindex_action_spec.rb
+7
-1
No files found.
changelogs/unreleased/ab-track-bloat.yml
0 → 100644
View file @
0bff6c12
---
title
:
Track index bloat estimate
merge_request
:
49822
author
:
type
:
other
db/migrate/20201211145950_add_bloat_estimate_to_reindex_action.rb
0 → 100644
View file @
0bff6c12
# frozen_string_literal: true
class
AddBloatEstimateToReindexAction
<
ActiveRecord
::
Migration
[
6.0
]
DOWNTIME
=
false
def
change
add_column
:postgres_reindex_actions
,
:bloat_estimate_bytes_start
,
:bigint
end
end
db/schema_migrations/20201211145950
0 → 100644
View file @
0bff6c12
ecf6b392f35bb0ef905144a4605bcb927ce767240e47ec3b0653a94139b987bd
\ No newline at end of file
db/structure.sql
View file @
0bff6c12
...
...
@@ -15216,6 +15216,7 @@ CREATE TABLE postgres_reindex_actions (
ondisk_size_bytes_end
bigint
,
state
smallint
DEFAULT
0
NOT
NULL
,
index_identifier
text
NOT
NULL
,
bloat_estimate_bytes_start
bigint
,
CONSTRAINT
check_f12527622c
CHECK
((
char_length
(
index_identifier
)
<=
255
))
);
...
...
lib/gitlab/database/reindexing/reindex_action.rb
View file @
0bff6c12
...
...
@@ -18,7 +18,8 @@ module Gitlab
action
=
create!
(
index_identifier:
index
.
identifier
,
action_start:
Time
.
zone
.
now
,
ondisk_size_bytes_start:
index
.
ondisk_size_bytes
ondisk_size_bytes_start:
index
.
ondisk_size_bytes
,
bloat_estimate_bytes_start:
index
.
bloat_size
)
yield
...
...
spec/lib/gitlab/database/reindexing/reindex_action_spec.rb
View file @
0bff6c12
...
...
@@ -3,7 +3,7 @@
require
'spec_helper'
RSpec
.
describe
Gitlab
::
Database
::
Reindexing
::
ReindexAction
,
'.keep_track_of'
do
let
(
:index
)
{
double
(
'index'
,
identifier:
'public.something'
,
ondisk_size_bytes:
10240
,
reload:
nil
)
}
let
(
:index
)
{
double
(
'index'
,
identifier:
'public.something'
,
ondisk_size_bytes:
10240
,
reload:
nil
,
bloat_size:
42
)
}
let
(
:size_after
)
{
512
}
it
'yields to the caller'
do
...
...
@@ -47,6 +47,12 @@ RSpec.describe Gitlab::Database::Reindexing::ReindexAction, '.keep_track_of' do
expect
(
find_record
.
ondisk_size_bytes_end
).
to
eq
(
size_after
)
end
it
'creates the record with the indexes bloat estimate'
do
described_class
.
keep_track_of
(
index
)
do
expect
(
find_record
.
bloat_estimate_bytes_start
).
to
eq
(
index
.
bloat_size
)
end
end
context
'in case of errors'
do
it
'sets the state to failed'
do
expect
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