qdrant-client
qdrant-client copied to clipboard
Indeterministic lock results
I'm looking for a way to prevent new writes to Qdrant DB and trying to utilize "/locks" endpoint to achieve it, but it doesn't work as expected.
# test DB lock
from qdrant_client.http.models.models import PointStruct, PointIdsList, Filter, FieldCondition, MatchValue
COLLECTION = "my-test-collection"
lock = client.lock_storage(reason="DB is locked")
print(lock)
# upload test point
uploaded_points = client.upload_points(collection_name=COLLECTION, points=[PointStruct(id="4009805e-90f5-445e-953e-62fd7222e68c", payload={"project_id": "test"}, vector=[])])
print("upload point response: ", uploaded_points)
# search for the point
response = client.scroll(
collection_name=COLLECTION_ALIAS,
scroll_filter=Filter(
must=[
FieldCondition(
key='project_id',
match=MatchValue(
value="test"
)
)
]
)
)
print("scroll point response: ", response)
# delete the point
deleted_points = client.delete(collection_name=COLLECTION, points_selector=PointIdsList(points=["4009805e-90f5-445e-953e-62fd7222e68c"]))
print("delete point response: ", deleted_points)
The console output:
WARNING:root:Batch upload failed 1 times. Retrying...
upload point response: None
scroll point response: ([Record(id='4009805e-90f5-445e-953e-62fd7222e68c', payload={'project_id': 'test'}, vector=None, shard_key=None)], None)
delete point response: operation_id=71316 status=<UpdateStatus.COMPLETED: 'completed'>
Running the above code doesn't stop me from performing new writes to the DB, however when the lock is executed multiple times, then it locks the DB successfully. It seems like it takes multiple calls to "lock" and "unlock" methods to make it work.
I'm running above against Qdrant cloud instance.
I don't think locks functionality have actual usage. It is likely that we are going to deprecate it