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
3aa9c110
Commit
3aa9c110
authored
Dec 21, 2020
by
Andreas Brandl
Committed by
Matija Čupić
Jan 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust scheduling migration
parent
44bf97b4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
+17
-7
db/post_migrate/20201208175117_schedule_backfilling_artifact_expiry_migration.rb
...8175117_schedule_backfilling_artifact_expiry_migration.rb
+16
-6
db/structure.sql
db/structure.sql
+1
-1
No files found.
db/post_migrate/20201208175117_schedule_backfilling_artifact_expiry_migration.rb
View file @
3aa9c110
...
...
@@ -4,25 +4,35 @@ class ScheduleBackfillingArtifactExpiryMigration < ActiveRecord::Migration[6.0]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
INDEX_NAME
=
'expired_artifacts_temp_index'
INDEX_CONDITION
=
'expire_at IS NULL'
SWITCH_DATE
=
Time
.
utc
(
2020
,
6
,
22
).
freeze
INDEX_NAME
=
'expired_artifacts_temp_index'
.
freeze
INDEX_CONDITION
=
"expire_at IS NULL AND created_at < '
#{
SWITCH_DATE
}
'"
disable_ddl_transaction!
class
JobArtifact
<
ActiveRecord
::
Base
include
EachBatch
self
.
table_name
=
'ci_job_artifacts'
scope
:without_expiry_date
,
->
{
where
(
expire_at:
nil
)
}
scope
:before_switch
,
->
{
where
(
'created_at < ?'
,
SWITCH_DATE
)
}
end
def
up
# Create temporary index for expired artifacts
# Needs to be removed in a later migration
add_concurrent_index
(
:ci_job_artifacts
,
:expire_at
,
where:
INDEX_CONDITION
,
name:
INDEX_NAME
)
add_concurrent_index
(
:ci_job_artifacts
,
%i(id created_at)
,
where:
INDEX_CONDITION
,
name:
INDEX_NAME
)
queue_background_migration_jobs_by_range_at_intervals
(
::
Ci
::
JobArtifact
.
where
(
expire_at:
nil
)
,
JobArtifact
.
without_expiry_date
.
before_switch
,
::
Gitlab
::
BackgroundMigration
::
BackfillArtifactExpiryDate
,
2
.
minutes
,
batch_size:
1
00_000
batch_size:
2
00_000
)
end
def
down
# no-op
remove_concurrent_index_by_name
:ci_job_artifacts
,
INDEX_NAME
end
end
db/structure.sql
View file @
3aa9c110
...
...
@@ -20756,7 +20756,7 @@ CREATE UNIQUE INDEX epic_user_mentions_on_epic_id_and_note_id_index ON epic_user
CREATE
UNIQUE
INDEX
epic_user_mentions_on_epic_id_index
ON
epic_user_mentions
USING
btree
(
epic_id
)
WHERE
(
note_id
IS
NULL
);
CREATE
INDEX
expired_artifacts_temp_index
ON
ci_job_artifacts
USING
btree
(
expire_at
)
WHERE
(
expire_at
IS
NULL
);
CREATE
INDEX
expired_artifacts_temp_index
ON
ci_job_artifacts
USING
btree
(
id
,
created_at
)
WHERE
((
expire_at
IS
NULL
)
AND
(
created_at
<
'2020-06-22 00:00:00+00'
::
timestamp
with
time
zone
)
);
CREATE
INDEX
finding_links_on_vulnerability_occurrence_id
ON
vulnerability_finding_links
USING
btree
(
vulnerability_occurrence_id
);
...
...
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