Loading
Write policy
Overview
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-policy
and which bins are updated at the source.- If
bin-policy
isall
:- If all bins of the record are shipped, after considering the
ignore-bin
configuration, the remote record is replaced or created. - If a subset of bins is shipped, after considering the
ignore-bin
configuration, the remote record is updated.
- If all bins of the record are shipped, after considering the
- If
bin-policy
isonly-changed
,changed-and-specified
, orchanged-or-specified
, the remote record is updated. - If
bin-policy
isonly-specified
and 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-policy
isonly-changed
,changed-and-specified
orchanged-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
and bin-policy
and ignore-bin
is complex.
Consider a situation where a record already has bins (b1, b2, b3).
Shipping happens as follows when ignore-bin
has (b3) and an update comes with bins (b2, b3) (no b1).
bin-policy | all | only-changed | changed-and-specified | changed-or-specified |
---|---|---|---|---|
(ignore-bin honored) | (ignore-bin honored) | (ignore-bin not honored) | (ignore-bin not honored) | |
write-policy | ||||
auto | (b1, b2) as update | (b2) as update | nothing | (b2, b3) as update |
update | (b1, b2) as update | (b2) as update | nothing | (b2, b3) as update |
replace | (b1, b2) as replace | not allowed | not allowed | not allowed |
Shipping happens as follows when ignore-bin
has (b4) and an update comes with bins (b2, b3) (no b1).
bin-policy | all | only-changed | changed-and-specified | changed-or-specified |
---|---|---|---|---|
(ignore-bin honored) | (ignore-bin honored) | (ignore-bin not honored) | (ignore-bin not honored) | |
write-policy | ||||
auto | (b1, b2, b3) as replace | (b2, b3) as update | nothing | (b2, b3) as update |
update | (b1, b2, b3) as update | (b2, b3) as update | nothing | (b2, b3) as update |
replace | (b1, b2, b3) as replace | not allowed | not allowed | not allowed |
Shipping happens as follows when ignore-bin
has (b3) and an update comes with bins b2=NULL (b2 gets deleted).
bin-policy | all | only-changed | changed-and-specified | changed-or-specified |
---|---|---|---|---|
(ignore-bin honored) | (ignore-bin honored) | (ignore-bin not honored) | (ignore-bin not honored) | |
write-policy | ||||
auto | (b1) as update (b2 not deleted on dest) | (b2) delete | nothing | (b2) delete |
update | (b1) as update (b2 not deleted on dest) | (b2) delete | nothing | (b2) delete |
replace | (b1) as replace (b2 deleted on dest) | not allowed | not allowed | not allowed |
Shipping happens as follows when ignore-bin
has (b4) and an update comes with bins b2=NULL (b2 gets deleted).
bin-policy | all | only-changed | changed-and-specified | changed-or-specified |
---|---|---|---|---|
(ignore-bin honored) | (ignore-bin honored) | (ignore-bin not honored) | (ignore-bin not honored) | |
write-policy | ||||
auto | (b1, b3) as replace (b2 deleted on dest) | (b2) delete | nothing | (b2) delete |
update | (b1, b3) as update (b2 not deleted on dest) | (b2) delete | nothing | (b2) delete |
replace | (b1, b3) as replace (b2 deleted on dest) | not allowed | not allowed | not allowed |