-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOCS-758 Adds new commit scope rule degradation functionality for synchronous and group commit. #6044
Merged
Merged
DOCS-758 Adds new commit scope rule degradation functionality for synchronous and group commit. #6044
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
3a5c095
First draft reference changes.
jpe442 107bd51
Small changes.
jpe442 2a6f854
Small tweaks.
jpe442 95b18f8
More small changes in group and synchrnounous commit.
jpe442 857f090
Small fixes.
jpe442 30b08b4
More small tweaks.
jpe442 7d0fcd9
tried to fix link.
jpe442 d493a71
Changing paths to absolute.
jpe442 3b842a8
Update product_docs/docs/pgd/5.6/commit-scopes/synchronous_commit.mdx
jpe442 91e2591
Update product_docs/docs/pgd/5.6/commit-scopes/index.mdx
jpe442 890e8df
Changed wording in Group commit.
jpe442 8897f0a
Changed order of commit scopes in Commit scope rules to feature synch…
jpe442 370a655
changed overview to put synch commit before group commit.
jpe442 c442329
Removed some white space.
jpe442 d8faa4c
Degrade options section.
jpe442 6c823c4
Added Degrade on section in Commit scopes page.
jpe442 28c2a8e
Fixed some small things.
jpe442 f98a6ca
Small word change.
jpe442 c53725b
Move CAMO and adjust accordingly.
jpe442 63c10a7
Small changes.
jpe442 b172c32
Moved degrading options to its own page.
jpe442 b434311
Addressed one of DJ's comments.
jpe442 1c00222
Update product_docs/docs/pgd/5.6/commit-scopes/degrading.mdx
jpe442 97291e3
Update product_docs/docs/pgd/5.6/commit-scopes/degrading.mdx
jpe442 6b26680
Update product_docs/docs/pgd/5.6/commit-scopes/degrading.mdx
jpe442 f8d86b3
Update product_docs/docs/pgd/5.6/reference/commit-scopes.mdx
jpe442 6f0e7cf
Update product_docs/docs/pgd/5.6/reference/commit-scopes.mdx
jpe442 c9a67fc
Moved behavior section up.
jpe442 bc353f8
Worked on wording given Petr's comments.
jpe442 bf62aa9
More word changes.
jpe442 fa22f21
Add degrading bit to Overview.
jpe442 46dd28a
Added wrap-language support, wrapped blocks, added degrading to index
djw-m 83ff5a8
Remove console.log hangover
djw-m abf0a6b
Improve feedback
djw-m d6ec97b
Shorten tooltip
djw-m 48bbdc2
Update product_docs/docs/pgd/5.6/commit-scopes/degrading.mdx
jpe442 1e440d8
Update product_docs/docs/pgd/5.6/commit-scopes/group-commit.mdx
jpe442 4b575f0
Update product_docs/docs/pgd/5.6/commit-scopes/index.mdx
jpe442 277e4b4
Update product_docs/docs/pgd/5.6/commit-scopes/synchronous_commit.mdx
jpe442 6235d3f
Update product_docs/docs/pgd/5.6/commit-scopes/degrading.mdx
jpe442 72c286d
Disable startWrap for now
djw-m 3318937
Fix link.
jpe442 8df3d37
Update product_docs/docs/pgd/5.6/commit-scopes/commit-scope-rules.mdx
jpe442 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--- | ||
title: Degrading commit scope rules | ||
navTitle: Degrading | ||
deepToC: true | ||
--- | ||
|
||
`SYNCHRONOUS_COMMIT`, `GROUP COMMIT`, and `CAMO` each have the optional capability of degrading the requirements for transactions when particular performance thresholds are crossed. | ||
|
||
When a node is applying a transaction and that transaction times out, it can be useful to trigger a process of degrading the requirements of the transaction to be completed, rather than just rolling back. | ||
|
||
`DEGRADE ON` offers a route for gracefully degrading the commit scope rule of a transaction. At its simplest, `DEGRADE ON` takes a timeout and a second set of commit scope operations that the commit scope can gracefully degrade to. | ||
|
||
For instance, after 20ms or 30ms timeout, the requirements for satisfying a commit scope could degrade from `ALL (node_group_name) GROUP COMMIT` to `MAJORITY (node_group_name) GROUP COMMIT`, making the transactions apply more steadily. | ||
|
||
You can also require that the write leader be the originator of a transaction in order for the degrade clause to be triggered. This can be helpful in "split brain scenarios" where you have, say, 2 data nodes and a witness node. Supposing there is a network split between the two data nodes and you have connections to both of the data nodes, only one of them will be allowed to degrade, because only one of them will be elected leader through the raft election with the witness node. | ||
|
||
## Behavior | ||
|
||
There are two parts to how the generalized `DEGRADE` clause behaves as it is applied to transactions. | ||
|
||
Once during the commit, while the commit being processed is waiting for responses that satisfy the commit scope rule, PGD checks for a timeout and, if the timeout has expired, the commit being processed is reconfigured to wait for the commit scope rule in the `DEGRADE` clause. In fact, by this point, the commit scope rule in the `DEGRADE` clause might already be satisfied. | ||
|
||
This mechanism alone is insufficient for the intended behavior, as this alone would mean that every transaction—even those that were certain to degrade due to connectivity issues—must wait for the timeout to expire before degraded mode kicks in, which would severely affect performance in such degrading-cluster scenarios. | ||
|
||
To avoid this, the PGD manager process also periodically (every 5s) checks the connectivity and apply rate (the one in [bdr.node_replication_rates](/pgd/latest/reference/catalogs-visible/#bdrnode_replication_rates)) and if there are commit scopes that would degrade at that point based on the current state of replication, they will be automatically degraded—such that any transaction using that commit scope when processing after that uses the degraded rule instead of waiting for timeout—until the manager process detects that replication is moving swiftly enough again. | ||
|
||
## SYNCHRONOUS_COMMIT and GROUP COMMIT | ||
|
||
Both `SYNCHRONOUS_COMMIT` and `GROUP COMMIT` have `timeout` and `require_write_lead` parameters, with defaults of `0` and `false` respectively. You should probably always set the `timeout`, as the default of `0` causes an instant degrade. You can also require that the write leader be the originator of the transaction in order to switch to degraded (again, default is `false`). | ||
|
||
Both `SYNCHRONOUS_COMMIT` and `GROUP COMMIT` also have options regarding which rule you can degrade to—which depends on which rule you are degrading from. | ||
|
||
First of all, you can degrade to asynchronous operation: | ||
|
||
```sql | ||
ALL (left_dc) SYNCHRONOUS_COMMIT DEGRADE ON (timeout=20s) TO ASYNC | ||
``` | ||
|
||
You can also degrade to a less restrictive commit group with the same commit scope kind (again as long as the kind is either `SYNCHRONOUS_COMMIT` or `GROUP COMMIT`). For instance, you can degrade as follows: | ||
|
||
```sql | ||
ALL (left_dc) SYNCHRONOUS_COMMIT DEGRADE ON (timeout=20s) TO MAJORITY (left_dc) SYNCHRONOUS_COMMIT | ||
``` | ||
|
||
or as follows: | ||
|
||
```sql | ||
ANY 3 (left_dc) SYNCHRONOUS_COMMIT DEGRADE ON (timeout=20s) TO ANY 2 (left_dc) SYNCHRONOUS_COMMIT | ||
``` | ||
|
||
But you cannot degrade from `SYNCHRONOUS_COMMIT` to `GROUP COMMIT` or the other way around. | ||
|
||
## CAMO | ||
|
||
While [CAMO](camo) supports both the same `timeout` and `require_write_lead` parameters (with the same defaults, `0` and `false` respectively), the options are simpler in that you can only degrade to asynchronous operation. | ||
|
||
```sql | ||
ALL (left_dc) CAMO DEGRADE ON (timeout=20ms, require_write_lead=true) TO ASYNC | ||
``` | ||
|
||
Again, you should set the `timeout` parameter, as the default is `0`. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why synchronous_commit is being pushed ahead of group commit. Group commit, synchronous commit, camo and then lag control (by use/feature maturity?)