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
6f3055fa
Commit
6f3055fa
authored
Oct 05, 2017
by
Toon Claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document Gitlab::Middleware::Readonly
parent
a723b559
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
8 deletions
+21
-8
doc/development/geo.md
doc/development/geo.md
+9
-8
doc/development/verifying_database_capabilities.md
doc/development/verifying_database_capabilities.md
+12
-0
No files found.
doc/development/geo.md
View file @
6f3055fa
...
...
@@ -78,19 +78,20 @@ to see if there are changes since the last time the log was checked
and will handle repository updates, deletes, changes & renames.
## Readonly
## Read
-
only
All
**Secondary**
nodes are read-only.
We have a Rails Middleware that filters any potentially writing operations
a
nd prevent user from trying to update the database and getting a 500 error
(see
`Gitlab::Middleware::Readonly`
)
.
The general principle of a
[
read-only database
](
verifying_database_capabilities.md#read-only-database
)
a
pplies to all Geo secondary nodes. So
`Gitlab::Database.read_only?`
will always return
`true`
on a secondary node
.
Database will already be read-only in a replicated setup, so we don't need to
take any extra step for that.
When some write actions are not allowed, because the node is a
secondary, consider the
`Gitlab::Database.read_only?`
or
`Gitlab::Database.read_write?`
guard, instead of
`Gitlab::Geo.secondary?`
.
We do use our feature toggle
`Gitlab::Database.read_only?`
to deny write operations
on a node that is in read-only mode. This toggle is also available in CE
.
Database itself will already be read-only in a replicated setup, so we
don't need to take any extra step for that
.
## File Transfers
...
...
doc/development/verifying_database_capabilities.md
View file @
6f3055fa
...
...
@@ -24,3 +24,15 @@ else
run_query
end
```
# Read-only database
The database can be used in read-only mode. In this case we have to
make sure all GET requests don't attempt any write operations to the
database. If one of those requests wants to write to the database, it needs
to be wrapped in a
`Gitlab::Database.read_only?`
or
`Gitlab::Database.read_write?`
guard, to make sure it doesn't for read-only databases.
We have a Rails Middleware that filters any potentially writing
operations (the CUD operations of CRUD) and prevent the user from trying
to update the database and getting a 500 error (see
`Gitlab::Middleware::ReadOnly`
).
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