Configure Conflict Revisions Operation
-
By default, RavenDB creates revisions for conflict documents for all collections
when conflicts occur and when they are resolved. -
Use
ConfigureRevisionsForConflictsOperation
to disable the feature or modify the configuration. -
If you define default configuration,
then these settings will override the conflict revisions configuration. -
If you define any collection-specific configuration,
then these settings will also override the conflict revisions configuration for that collection.- E.g., if the conflict revisions configuration defines that revisions created for conflicting documents will not be purged,
but a collection-specific configuration defines an age limit for revisions,
revisions for conflicting documents of this collection that exceed this age will be purged.
- E.g., if the conflict revisions configuration defines that revisions created for conflicting documents will not be purged,
but a collection-specific configuration defines an age limit for revisions,
-
In this page:
Configure revisions for conflicts - Example
// Define the settings that will apply for conflict revisions (for all collections)
$conflictRevConfig = new RevisionsCollectionConfiguration();
// With this configuration:
// ------------------------
// * A revision will be created for conflict documents
// * When the parent document is deleted all its revisions will be removed.
// * Revisions that exceed 45 days will be removed on next revision creation.
$conflictRevConfig->setPurgeOnDelete(true);
$conflictRevConfig->setMinimumRevisionAgeToKeep(Duration::ofDays(45));
// Define the configure conflict revisions operation, pass the configuration
$configureConflictRevisionsOp =
new ConfigureRevisionsForConflictsOperation($documentStore->getDatabase(), $conflictRevConfig);
// Execute the operation by passing it to Maintenance.Server.Send
// The existing conflict revisions configuration will be replaced by the configuration passed
$documentStore->maintenance()->server()->send($configureConflictRevisionsOp);
Syntax
new ConfigureRevisionsForConflictsOperation(?string $database, ?RevisionsCollectionConfiguration $configuration)
Parameter | Type | Description |
---|---|---|
database | string |
The name of the database whose conflict revisions you want to manage |
configuration | RevisionsCollectionConfiguration |
The conflict revisions configuration to apply |
class RevisionsCollectionConfiguration
{
private ?int $minimumRevisionsToKeep = null;
private ?Duration $minimumRevisionAgeToKeep = null;
private bool $disabled = false;
private bool $purgeOnDelete = false;
private ?int $maximumRevisionsToDeleteUponDocumentUpdate = null;
// ... getters and setters ...
}
- See properties explanation and default values here.
Storage consideration
Automatic creation of conflict revisions can help track document conflicts and understand their reasons.
However, it can also lead to a significant increase in the database size if many conflicts occur unexpectedly.
-
Consider limiting the number of conflict revisions kept per document using:
MinimumRevisionsToKeep
and/orMinimumRevisionAgeToKeep
. -
Revisions are purged upon modification of their parent documents.
If you want to purge a large number of revisions at once, you can cautiously enforce configuration.