Write policy
With the XDR parameter
write-policy
at the dc/namespace level, you can control the behavior of XDR writes
on the target datacenter. Allowable values:
auto
(default): The behavior depends on thebin-policy
and which bins got updated at the source.- With the default
bin-policy
(all
) :- If all the bins of the record are shipped, after taking into consideration the
ignore-bin
configuration, the remote record is replaced or created. - If a subset of bins of the record are shipped, after taking into consideration the
ignore-bin
configuration, the remote record is updated.
- If all the bins of the record are shipped, after taking into consideration the
- If
bin-policy
is set toonly-changed
,changed-and-specified
orchanged-or-specified
, the remote record is updated. - If
bin-policy
is set toonly-specified
and a subset of bins of the record are shipped, the remote record is updated.
- With the default
update
: creates the record or updates the record if it already exists. Merges previously 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 already existing bins for the record.- Not allowed when
bin-policy
is set toonly-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. Let us try to explain with an example.
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 |