-
Notifications
You must be signed in to change notification settings - Fork 860
versioning support #20382
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
Merged
Merged
versioning support #20382
Conversation
This file contains hidden or 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
…godb into feature/versioning-support
hkernbach
approved these changes
Jan 19, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Scope & Purpose
Added support for simple external versioning to document operations.
UPDATE and REPLACE operations can now be given an optional
versionAttribute
property. If set, the attribute with the name specified by the property is
looked up in the to-be-updated/to-be-replaced document. If no such attribute
exists, the UPDATE/REPLACE is performed as usual. If such attribute exists,
its content is read and compared numerically to the value of the versioning
attribute in the document that updates/replaces it. If the version number in
the new document is higher than in the document that exists in the database,
the UPDATE/REPLACE is performed normally. If the version number in the new
document is lower or equal to what exists in the database, the UPDATE/REPLACE
is not performed and behaves like a no-op. No error will be returned to the
user in this case.
This simple versioning can help to avoid overwriting existing data with older
versions in case data is transferred from an external system into ArangoDB
and the copies are currently not in sync.
The
versionAttribute
property can also be used for INSERT operations withoverwriteMode: "update"
oroverwriteMode: "replace"
.It can also be used inside AQL queries by specifying it in the
OPTIONS
clause of an UPDATE/REPLACE/INSERT operation.
Examples:
Note that versioning is opt-in, and that no version checking is performed for
operations for which the
versionAttribute
property was not set as part ofthe update or replace operation or as an option in the AQL query.
Also note that version checking only kicks in if both the existing version of
the document in the database and the new document version contain the version
attribute and they contain numeric values between 0 and 18446744073709551615.
If either the existing document in the database or the new document version
do not contain the version attribute, or if the version attribute in any of
the two is not a number inside the valid range, the update/replace operation
will behave as if no version checking was requested.
Also note that document removal operations do not support versioning. Removal
operations are always carried out normally without checking the version
attribute, even if it is specified.
Would likely address the feature request in https://arangodb.atlassian.net/browse/ES-1771
Checklist
Related Information