You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
replace(
key=new_data["id"],
value=new_data,
opts=ReplaceOptions(
# cas=old.cas, # This parameter does not work as expected (does not take effect) in Couchbase Python SDK 4.3.5
durability=ServerDurability(
level=DurabilityLevel.PERSIST_TO_MAJORITY
)
),
cas=old_cas, # This parameter works as expected (takes effect) in Couchbase Python SDK 4.3.5
)
Explanation:
In the Couchbase Python SDK 4.3.5, there is an issue where specifying the 'cas' parameter inside the ReplaceOptions object
(e.g., cas=old.cas) does not function correctly and does not take effect. However, passing the 'cas' parameter directly
to the replace function (outside of the ReplaceOptions object) works as intended.
The text was updated successfully, but these errors were encountered:
Hi @Tan-Fei-Fei -- Can you provide some more details on how you are validating if the CAS is working properly?
Maybe there is a typo in your example? What does not work is cas=old.cas and what does work is cas=old_cas which do not appear to be the same thing.
We test cas w/ various operation's options blocks (including replace()), so I would be surprised if passing in cas to ReplaceOptions is not working. I have provided a small sample below and the output is as I would expect (e.g. no CasMismatchException when providing the correct cas and then a CasMismatchException with an incorrect cas).
replace(
key=new_data["id"],
value=new_data,
opts=ReplaceOptions(
# cas=old.cas, # This parameter does not work as expected (does not take effect) in Couchbase Python SDK 4.3.5
durability=ServerDurability(
level=DurabilityLevel.PERSIST_TO_MAJORITY
)
),
cas=old_cas, # This parameter works as expected (takes effect) in Couchbase Python SDK 4.3.5
)
Explanation:
In the Couchbase Python SDK 4.3.5, there is an issue where specifying the 'cas' parameter inside the ReplaceOptions object
(e.g.,
cas=old.cas
) does not function correctly and does not take effect. However, passing the 'cas' parameter directlyto the
replace
function (outside of theReplaceOptions
object) works as intended.The text was updated successfully, but these errors were encountered: