-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cosmos: query_items_change_feed reture same resualt with is_start_from_beginning parameters #11689
Comments
Thanks @nonokangwei - I will try to repro today :) |
Hi @nonokangwei - I put together some sample code based on our tests demonstrating the continuation support that is hopefully helpful: document_definition = {'pk': 'pk', 'id':'doc1'}
collection.create_item(body=document_definition)
query_iterable = collection.query_items_change_feed(
partition_key_range_id=pkRangeId,
is_start_from_beginning=True,
)
iter_list = list(query_iterable)
self.assertEqual(len(iter_list), 1)
continuation = collection.client_connection.last_response_headers['etag']
# Create two new documents. Verify that change feed contains the 2 new documents
document_definition = {'pk': 'pk', 'id': 'doc2'}
collection.create_item(body=document_definition)
document_definition = {'pk': 'pk', 'id': 'doc3'}
collection.create_item(body=document_definition)
# verify iterator
query_iterable = created_collection.query_items_change_feed(
partition_key_range_id=pkRangeId,
continuation=continuation,
max_item_count=pageSize
) Here is the actual test with more detail: As for the behaviour of |
@nonokangwei Is this a partitioned collection? You'll need to pass the partition key range id as the example above @annatisch Thanks for investigating. The API is a bit strange here. Partition Key Range ID is an integer representing the physical partition that a logical partition key maps to. But it's not something we normally expose to the user. I don't see any methods in the SDK that let a user convert a partition key to a partition key range id. This might just be a bug. Instead the SDK will need to accept the partition key and set that as the header. This is what JS does and forces the user to supply the partition key: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/cosmosdb/cosmos/samples/ChangeFeed.ts#L73-L78 |
@annatisch @southpolesteve i do some test based on the @annatisch sample code, if i do not give the partition key range id paramterer it seems not works. as @southpolesteve said i review the SDK, it seems no function for customer to get the partition key range id. So what is the suggested method to get the partition key range id, i only saw the description in rest-api interface. |
Relabeling this as a bug. Partition Key Range Id shouldn't be exposed here. We should instead be accepting a partition key and change feed is scoped to a single partition key value. Cross partition change feed is something we would eventually like to support, but it requires some additional work. |
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @anfeldma-ms, @zfoster, @southpolesteve. |
@srinathnarayanan Can you look into this issue? |
Fixed with #13857 |
[NetAppFiles] Anf 8187 update swagger rest api to 2020 08 01 (Azure#11689) * Add 2020-08-01 folder * Update api version * update readme * update readme * issue in readme * issue in readme * issue in readme * touch Co-authored-by: Audunn Baldvinsson <audunn.baldvinsson@netapp.com>
Describe the bug
query_items_change_feed fucntion return the same result with the parameter is_start_from_beginning=True and False
To Reproduce
Steps to reproduce the behavior:
Query
Expected behavior
Read the change feed from the last checkpoint, tried with the parameter continunation, did not find the sample to fetch the continunation token.
The text was updated successfully, but these errors were encountered: