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
92b5d14b
Commit
92b5d14b
authored
4 years ago
by
Valery Sizov
Committed by
Adam Hegyi
4 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change the type of verification_checksum column
in package file table for efficient usage of DB space
parent
3a4ca8d6
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
4 deletions
+47
-4
db/migrate/20200409105455_change_verification_checksum_field_type_in_package_file.rb
...hange_verification_checksum_field_type_in_package_file.rb
+17
-0
db/migrate/20200409105456_add_checksum_index_to_package_file.rb
...rate/20200409105456_add_checksum_index_to_package_file.rb
+17
-0
db/structure.sql
db/structure.sql
+4
-2
doc/development/geo/framework.md
doc/development/geo/framework.md
+1
-1
ee/lib/gitlab/geo/replicable_model.rb
ee/lib/gitlab/geo/replicable_model.rb
+3
-0
ee/spec/lib/gitlab/geo/replicator_spec.rb
ee/spec/lib/gitlab/geo/replicator_spec.rb
+5
-1
No files found.
db/migrate/20200409105455_change_verification_checksum_field_type_in_package_file.rb
0 → 100644
View file @
92b5d14b
# frozen_string_literal: true
class
ChangeVerificationChecksumFieldTypeInPackageFile
<
ActiveRecord
::
Migration
[
6.0
]
DOWNTIME
=
false
def
up
# The use of this column is behind a feature flag that never got enabled,
# so it's safe to remove it in a normal migration
remove_column
:packages_package_files
,
:verification_checksum
,
:string
# rubocop:disable Migration/RemoveColumn
add_column
:packages_package_files
,
:verification_checksum
,
:binary
end
def
down
remove_column
:packages_package_files
,
:verification_checksum
,
:binary
add_column
:packages_package_files
,
:verification_checksum
,
:string
end
end
This diff is collapsed.
Click to expand it.
db/migrate/20200409105456_add_checksum_index_to_package_file.rb
0 → 100644
View file @
92b5d14b
# frozen_string_literal: true
class
AddChecksumIndexToPackageFile
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
add_concurrent_index
:packages_package_files
,
:verification_checksum
,
where:
"(verification_checksum IS NOT NULL)"
,
name:
"packages_packages_verification_checksum_partial"
end
def
down
remove_concurrent_index
:packages_package_files
,
:verification_checksum
end
end
This diff is collapsed.
Click to expand it.
db/structure.sql
View file @
92b5d14b
...
...
@@ -4668,9 +4668,9 @@ CREATE TABLE public.packages_package_files (
file_sha256
bytea
,
verification_retry_at
timestamp
with
time
zone
,
verified_at
timestamp
with
time
zone
,
verification_checksum
character
varying
(
255
),
verification_failure
character
varying
(
255
),
verification_retry_count
integer
verification_retry_count
integer
,
verification_checksum
bytea
);
CREATE
SEQUENCE
public
.
packages_package_files_id_seq
...
...
@@ -13738,6 +13738,8 @@ COPY "schema_migrations" (version) FROM STDIN;
20200408175424
20200408212219
20200409085956
20200409105455
20200409105456
20200409211607
20200410104828
20200410232012
...
...
This diff is collapsed.
Click to expand it.
doc/development/geo/framework.md
View file @
92b5d14b
...
...
@@ -324,7 +324,7 @@ Widgets should now be replicated by Geo!
def
change
add_column
:widgets
,
:verification_retry_at
,
:datetime_with_timezone
add_column
:widgets
,
:verified_at
,
:datetime_with_timezone
add_column
:widgets
,
:verification_checksum
,
:
string
add_column
:widgets
,
:verification_checksum
,
:
binary
,
using:
'verification_checksum::bytea'
add_column
:widgets
,
:verification_failure
,
:string
add_column
:widgets
,
:verification_retry_count
,
:integer
end
...
...
This diff is collapsed.
Click to expand it.
ee/lib/gitlab/geo/replicable_model.rb
View file @
92b5d14b
...
...
@@ -5,6 +5,7 @@ module Gitlab
module
ReplicableModel
extend
ActiveSupport
::
Concern
include
Checksummable
include
::
ShaAttribute
included
do
# If this hook turns out not to apply to all Models, perhaps we should extract a `ReplicableBlobModel`
...
...
@@ -12,6 +13,8 @@ module Gitlab
scope
:checksummed
,
->
{
where
(
'verification_checksum IS NOT NULL'
)
}
scope
:checksum_failed
,
->
{
where
(
'verification_failure IS NOT NULL'
)
}
sha_attribute
:verification_checksum
end
class_methods
do
...
...
This diff is collapsed.
Click to expand it.
ee/spec/lib/gitlab/geo/replicator_spec.rb
View file @
92b5d14b
...
...
@@ -10,7 +10,9 @@ describe Gitlab::Geo::Replicator do
before
(
:all
)
do
ActiveRecord
::
Schema
.
define
do
create_table
:dummy_models
create_table
:dummy_models
,
force:
true
do
|
t
|
t
.
binary
:verification_checksum
end
end
end
...
...
@@ -70,6 +72,8 @@ describe Gitlab::Geo::Replicator do
with_replicator
Geo
::
DummyReplicator
end
DummyModel
.
reset_column_information
end
subject
{
DummyModel
.
new
}
...
...
This diff is collapsed.
Click to expand it.
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