Write policy
With the XDR parameter write-policy at the datacenter (DC) or namespace level, you can control the behavior of XDR writes on the target DC.
Values for write-policy
auto(default): Behavior depends on thebin-policyand which bins are updated at the source.- If
bin-policyisall:- If all bins of the record are shipped, after considering the
ignore-binconfiguration, the remote record is replaced or created. - If a subset of bins is shipped, after considering the
ignore-binconfiguration, the remote record is updated.
- If all bins of the record are shipped, after considering the
- If
bin-policyisonly-changed,changed-and-specified, orchanged-or-specified, the remote record is updated. - If
bin-policyisonly-specifiedand a subset of bins is shipped, the remote record is updated.
- If
update: creates the record or updates it if it already exists. Merges existing bins with the new bins being written.replace: creates the record or replaces it entirely if a previous version of the record already exists. Deletes existing bins for the record.- Not allowed when
bin-policyisonly-changed,changed-and-specifiedorchanged-or-specified.
- Not allowed when
Example
xdr { dc DC1 { node-address-port 10.1.0.1 3000 namespace nameSpaceName { write-policy replace ... } }}write-policy vs bin-policy vs ignore-bin
The interaction between write-policy=auto, bin-policy, and ignore-bin is complex. The following examples illustrate how bins are shipped and the results at the remote destination in various policy and write scenarios.
Example 1
In the following example, the configuration includes ignore-bin b3 and b2 and b3 are updated on the source.
Example 2
In the following example, the configuration includes ignore-bin b4 and b2 and b3 are updated on the source.
Example 3
In the following example, the configuration includes ignore-bin b3 and an update comes with bin b2=NULL (b2 gets deleted).
Example 4
In the following example, the configuration includes ignore-bin b4, or ignore-bin is not configured, and an update comes with bin b2=NULL (b2 gets deleted).