Details
-
Bug
-
Resolution: Fixed
-
Major
-
3.2.0
-
None
-
None
-
1
Description
If a get_and_lock() operation is performed, a get() operation on the same locked document should succeed. Currently, the 3.2.0 version of the Python SDK will raise an LCB_ERR_DOCUMENT_LOCKED exception.
sample test script:
import time |
from datetime import timedelta |
from couchbase.cluster import Cluster |
from couchbase.auth import PasswordAuthenticator |
|
|
def run_sample_code(): |
try: |
auth = PasswordAuthenticator("Administrator", "password") |
cluster = Cluster("couchbase://localhost", authenticator=auth) |
bucket = cluster.bucket("default") |
collection = bucket.default_collection() |
|
print('LCB version: {}'.format(cluster.lcb_version())) |
|
key = "testKey100" |
res = collection.get_and_lock(key,timedelta(seconds=15)) |
print("Found: {}".format(res.content_as[dict])) |
res1 = collection.get(key) |
print("Found: {}".format(res1.content_as[dict])) |
|
except Exception as ex: |
import traceback |
traceback.print_exc()
|
|
if __name__ == '__main__': |
run_sample_code()
|
========== Research ==========
The 3.1.3 version of the Python SDK did not have this problem. The change in behavior looks to be introduced when LCB allowed the get operation to be deferred.
LCB details:
Gerrit, Commit: 3614640edbbf1ef0f8765942934fc942e28b50f2
Prior to this commit, the Python SDK will successfully retrieve the document even if locked.
It should be noted that in order to work with commit 3614640 of lcb, the Python client should be moved back to commit 888e69a11937214c536a0fb18c4b83b42370deba (prior to preserve TTL changes being added).