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
c935a786
Commit
c935a786
authored
Dec 08, 2020
by
Michael Kozono
Committed by
Douglas Barbosa Alexandre
Dec 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Geo: Document verification indexes
parent
ae991fd6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
doc/development/geo/framework.md
doc/development/geo/framework.md
+16
-4
No files found.
doc/development/geo/framework.md
View file @
c935a786
...
@@ -433,24 +433,36 @@ can track verification state.
...
@@ -433,24 +433,36 @@ can track verification state.
end
end
```
```
1.
Add an index on
`verification_state`
to ensure verification can be performed efficiently:
1.
Add indexes on verification fields to ensure verification can be performed efficiently:
Some or all of these indexes can be omitted if the table is guaranteed to be small. Ask a database expert if you are unsure.
```
ruby
```
ruby
# frozen_string_literal: true
# frozen_string_literal: true
class
AddVerification
StateIndex
ToWidgets
<
ActiveRecord
::
Migration
[
6.0
]
class
AddVerification
Indexes
ToWidgets
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
DOWNTIME
=
false
VERIFICATION_STATE_INDEX_NAME
=
"index_widgets_verification_state"
PENDING_VERIFICATION_INDEX_NAME
=
"index_widgets_pending_verification"
FAILED_VERIFICATION_INDEX_NAME
=
"index_widgets_failed_verification"
NEEDS_VERIFICATION_INDEX_NAME
=
"index_widgets_needs_verification"
disable_ddl_transaction!
disable_ddl_transaction!
def
up
def
up
add_concurrent_index
:widgets
,
:verification_state
,
name:
"index_widgets_on_verification_state"
add_concurrent_index
:widgets
,
:verification_state
,
name:
VERIFICATION_STATE_INDEX_NAME
add_concurrent_index
:widgets
,
:verified_at
,
where:
"(verification_state = 0)"
,
order:
{
verified_at:
'ASC NULLS FIRST'
},
name:
PENDING_VERIFICATION_INDEX_NAME
add_concurrent_index
:widgets
,
:verification_retry_at
,
where:
"(verification_state = 3)"
,
order:
{
verification_retry_at:
'ASC NULLS FIRST'
},
name:
FAILED_VERIFICATION_INDEX_NAME
add_concurrent_index
:widgets
,
:verification_state
,
where:
"(verification_state = 0 OR verification_state = 3)"
,
name:
NEEDS_VERIFICATION_INDEX_NAME
end
end
def
down
def
down
remove_concurrent_index
:widgets
,
:verification_state
remove_concurrent_index_by_name
:widgets
,
VERIFICATION_STATE_INDEX_NAME
remove_concurrent_index_by_name
:widgets
,
PENDING_VERIFICATION_INDEX_NAME
remove_concurrent_index_by_name
:widgets
,
FAILED_VERIFICATION_INDEX_NAME
remove_concurrent_index_by_name
:widgets
,
NEEDS_VERIFICATION_INDEX_NAME
end
end
end
end
```
```
...
...
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