-
Notifications
You must be signed in to change notification settings - Fork 182
DOC-13862-XDCR Key ID Filtering #4175
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
base: release/8.5
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -178,6 +178,98 @@ For information on TTL and expiration, see xref:learn:data/expiration.adoc[Expir | |
|
|
||
| Note that the replication of deletions, expirations, and/or TTLs is _not_ prevented by the specifying of a filter that is formed with regular and other filtering expressions: to ensure that document-deletions, expirations, and/or TTLs are _not_ replicated, the appropriate deletion-filter checkboxes must be checked. | ||
|
|
||
|
|
||
|
|
||
| == Filter Deletions and Expirations with Key ID Expressions | ||
|
|
||
| By default, XDCR deletion filters operate across all documents in a replication stream. | ||
| Starting in Couchbase Server 8.1.0 (and 7.6.10), you can apply granular expression-based filtering to document deletions and expirations using **Key ID filter expressions** (`META().id`). | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This feature is in 8.5.0, 8.0.1, and 7.6.10. Starting in Couchbase Server 8.5.0 (and 8.0.1, 7.6.10), |
||
|
|
||
| When enabled, XDCR evaluates the document key ID of incoming deletion and expiration events against the replication's filter expression before replicating them to the target cluster. | ||
|
|
||
| [#ui-deletion-filtering-controls] | ||
| === Deletion and Expiration Filtering UI Controls | ||
|
|
||
| In the Couchbase Web Console, under *Advanced replication settings*, the following controls manage deletion and expiration expression filtering: | ||
|
|
||
| * *Do not replicate document expirations* (`filterExpirations`): When selected, prevents document expirations from replicating to the target. | ||
| * *Apply Filter Expression to Expirations* (`filterExpirationsWithExpression`): Evaluates the replication's filter expression against expiring documents. | ||
| Document expirations replicate to the target *only* if the document ID matches the filter expression. | ||
|
|
||
| * *Do not replicate DELETE operations* (`filterDeletions`): When selected, prevents document deletions from replicating to the target. | ||
| ** *Apply Filter Expression to Deletions* (`filterDeletionsWithExpression`): Evaluates the replication's filter expression against deleted documents. Document deletions replicate to the target *only* if the document ID matches the filter expression. | ||
|
|
||
| * *Remove TTL from replicated items* (`filterExpirationTTL`): Removes Time-To-Live (TTL) expiration timestamps from replicated documents. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure where The REST API option to remove TTL is called
|
||
|
|
||
| [#ui-prerequisites-and-validation] | ||
| === UI Prerequisites and Validation Rules | ||
|
|
||
| The Web Console enforces the following validation dependencies: | ||
|
|
||
| [cols="1,2,2"] | ||
| |=== | ||
| | UI Checkbox | Prerequisite / Dependency | Constraint & Behavior | ||
|
|
||
| | *Apply Filter Expression to Expirations* | ||
| | Requires both: | ||
| * A valid *Filter Expression* entered. | ||
| * *Do not replicate document expirations* selected. | ||
| | The checkbox remains disabled/greyed out until both prerequisites are satisfied. The filter expression must reference *only* `META().id`. | ||
|
|
||
| | *Apply Filter Expression to Deletions* | ||
| | Requires both: | ||
| * A valid *Filter Expression* entered. | ||
| * *Do not replicate DELETE operations* selected. | ||
| | The checkbox remains disabled/greyed out until both prerequisites are satisfied. The filter expression must reference *only* `META().id`. | ||
| |=== | ||
|
|
||
| NOTE: Because document deletions (tombstones) and expiration notices retain only the document key and metadata—not the document body or extended attributes (xattrs)—the filter expression must evaluate **only** the document ID (`META().id` or key-matching regular expressions). | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing spaces around "—". |
||
| Expressions attempting to match document JSON fields (such as `type = "hotel"`) or extended attributes will evaluate to `false` on deletions and expirations, preventing them from replicating. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I find the sentence on line 227 confusing -- I think that the sentence on line 227 should be removed. It's already been made clear that you can only use the settings Note: By default, if you have a filter expression (regardless of whether it is key id only or not), they don't apply to deletions and expirations -- the deletions and expirations are always replicated. You can only modify the default behavior using |
||
|
|
||
| --- | ||
|
|
||
| [#enable-expression-filtering-create] | ||
| === Enable Key ID Deletion Filtering During Replication Creation | ||
|
|
||
| To enable Key ID deletion and expiration filtering when creating a new replication: | ||
|
|
||
| . In the Couchbase Web Console, navigate to menu:XDCR[Add Replication]. | ||
| . Specify the *Cluster Reference*, *Source Bucket*, and *Target Bucket*. | ||
| . In the *Filter Expression* field, enter an expression that filters by document key ID. | ||
| For example: | ||
| + | ||
| [source,sql] | ||
| ---- | ||
| REGEXP_CONTAINS(META().id, "^eu:") | ||
| ---- | ||
| . Click *Advanced replication settings* to expand the configuration panel. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line 245 should be removed since the Filter Replication options are not in the Advanced Settings in the UI |
||
| . Under deletion filtering: | ||
| .. Select *Do not replicate DELETE operations*. | ||
| .. Select the nested checkbox *Apply Filter Expression to Deletions*. | ||
| .. (Optional) Select *Do not replicate document expirations* and then select *Apply Filter Expression to Expirations*. | ||
| . Configure any additional advanced replication settings as needed. | ||
| . Click *Save* to start the replication. | ||
|
Comment on lines
+245
to
+251
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't correct. Customer has 2 options in the Filter Expression panel. or, equivalently, they can select the below 4 checkboxes. Selecting "Replicate deletions and expirations only if they match the key only filter expression" automatically selects the below 4 checkboxes and greys them out so that they cannot be unselected. [ ] Do not replicate document expirations |
||
|
|
||
| --- | ||
|
|
||
| [#enable-expression-filtering-edit] | ||
| === Modify Key ID Deletion Filtering on an Existing Replication | ||
|
|
||
| You can dynamically enable or disable Key ID deletion and expiration filtering on an active replication without restarting or restreaming the replication: | ||
|
|
||
| . In the Couchbase Web Console, navigate to the *XDCR* screen. | ||
| . Locate the replication stream in the *Ongoing Replications* table. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's called "Outgoing Replications" in the UI. |
||
| . Click the *Edit* (gear) icon in the row corresponding to the replication. | ||
| . In the *Edit Replication* dialog, expand *Advanced replication settings*. | ||
| . Modify the *Apply Filter Expression to Deletions* and/or *Apply Filter Expression to Expirations* checkboxes as required. | ||
| . Click *Save*. | ||
|
Comment on lines
+262
to
+265
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Click the Edit button in the row corresponding to the replication. In the Filter Expression panel, select on unselect the checkbox for "Replicate deletions and expirations only if they match the key only filter expression" or the "Deletion Filters" options directly. . Click Save Replication |
||
|
|
||
| NOTE: Unlike changing the primary *Filter Expression* (which triggers a restream of data from sequence number 0), updating `filterDeletionsWithExpression` or `filterExpirationsWithExpression` applies dynamically to mutations processed after the setting update without restreaming. | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| [#filtering-binary-documents] | ||
| === Filtering Binary Documents | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,7 +55,8 @@ Information about establishing references is provided in xref:manage:manage-xdcr | |
|
|
||
| * Replication management: Once a reference has been registered on the local cluster, it can be specified as the target for a replication. | ||
| This requires that an existing source and an existing target bucket also be specified. | ||
| Optionally, filters can be established, so that only documents with matching ids, fields, values, or extended attributes are replicated. | ||
| Optionally, filters can be established so that only documents with matching IDs, fields, values, or extended attributes are replicated. | ||
| You can also configure deletion and expiration filters—including Key ID filter expressions—to selectively control whether document deletions and expirations are propagated to the target. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing spaces around "—". You can also configure deletion and expiration filters — including Key ID filter expressions — to selectively control whether document deletions and expirations are propagated to the target. |
||
| Advanced settings can be configured to ensure optimal performance. | ||
| Information about establishing replications is provided in xref:manage:manage-xdcr/create-xdcr-replication.adoc[Create a Replication] and information about deleting them in xref:manage:manage-xdcr/delete-xdcr-replication.adoc[Delete a Replication]. | ||
| + | ||
|
|
||
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.
I wasn't sure what "or will evaluate to false during deletion/expiration" meant -- you won't be able to use
filterDeletionsWithExpression=trueorfilterExpirationsWithExpression=trueif the filter expression uses any other part of the document than the key id -- the create or update of the replication with these settings will fail validation.So, suggest something like:
META().id). Expressions attempting to match JSON document fields (such astype = "user") or extended attributes will fail validation and will not be able to be used withfilterDeletionsWithExpression=trueorfilterExpirationsWithExpression=true.