Skip to content

Commit 5ac6d83

Browse files
authored
Revert "Implement continuation token size limit (Azure#30600)" (Azure#30685)
This reverts commit cc81110.
1 parent 714bb03 commit 5ac6d83

File tree

9 files changed

+1
-74
lines changed

9 files changed

+1
-74
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,4 @@ sdk/cosmos/azure-cosmos/test/test_config.py
148148
*_python.json
149149

150150
# temporary folder to refresh SDK with cadl
151-
TempTypeSpecFiles/
151+
TempTypeSpecFiles/

sdk/cosmos/azure-cosmos/CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#### Features Added
1616
* Added conditional patching for Patch operations. See [PR 30455](https://github.com/Azure/azure-sdk-for-python/pull/30455).
17-
* Added **provisional** ability to limit Continuation Token size when querying for items. See [PR 30600](https://github.com/Azure/azure-sdk-for-python/pull/30600)
1817

1918
#### Bugs Fixed
2019
* Fixed bug with non english locales causing an error with the RFC 1123 Date Format. See [PR 30125](https://github.com/Azure/azure-sdk-for-python/pull/30125).

sdk/cosmos/azure-cosmos/azure/cosmos/_base.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,6 @@ def GetHeaders( # pylint: disable=too-many-statements,too-many-branches
223223
if options.get("populateQueryMetrics"):
224224
headers[http_constants.HttpHeaders.PopulateQueryMetrics] = options["populateQueryMetrics"]
225225

226-
if options.get("responseContinuationTokenLimitInKb"):
227-
headers[http_constants.HttpHeaders.ResponseContinuationTokenLimitInKb] = options["responseContinuationTokenLimitInKb"] # pylint: disable=line-too-long
228-
229226
if cosmos_client_connection.master_key:
230227
#formatedate guarantees RFC 1123 date format regardless of current locale
231228
headers[http_constants.HttpHeaders.XDate] = formatdate(timeval=None, localtime=False, usegmt=True)

sdk/cosmos/azure-cosmos/azure/cosmos/aio/_container.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,6 @@ def query_items(
320320
:keyword dict[str, str] initial_headers: Initial headers to be sent as part of the request.
321321
:keyword response_hook: A callable invoked with the response metadata.
322322
:paramtype response_hook: Callable[[Dict[str, str], AsyncItemPaged[Dict[str, Any]]], None]
323-
:keyword int response_continuation_token_limit_in_kb: **provisional keyword** The size limit in kb of the
324-
response continuation token in the query response. Valid values are positive integers.
325-
A value of 0 is the same as not passing a value (default no limit).
326323
:keyword int max_integrated_cache_staleness_in_ms: The max cache staleness for the integrated cache in
327324
milliseconds. For accounts configured to use the integrated cache, using Session or Eventual consistency,
328325
responses are guaranteed to be no staler than this value.
@@ -369,13 +366,9 @@ def query_items(
369366
feed_options["maxIntegratedCacheStaleness"] = max_integrated_cache_staleness_in_ms
370367
correlated_activity_id = GenerateGuidId()
371368
feed_options["correlatedActivityId"] = correlated_activity_id
372-
response_continuation_token_limit_in_kb = kwargs.pop("response_continuation_token_limit_in_kb", None)
373-
if response_continuation_token_limit_in_kb is not None:
374-
feed_options["responseContinuationTokenLimitInKb"] = response_continuation_token_limit_in_kb
375369
if hasattr(response_hook, "clear"):
376370
response_hook.clear()
377371

378-
379372
parameters = kwargs.pop('parameters', None)
380373
items = self.client_connection.QueryItems(
381374
database_or_container_link=self.container_link,

sdk/cosmos/azure-cosmos/azure/cosmos/container.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,6 @@ def query_items(
354354
:keyword str session_token: Token for use with Session consistency.
355355
:keyword dict[str,str] initial_headers: Initial headers to be sent as part of the request.
356356
:keyword Callable response_hook: A callable invoked with the response metadata.
357-
:keyword int response_continuation_token_limit_in_kb: **provisional keyword** The size limit in kb of the
358-
response continuation token in the query response. Valid values are positive integers.
359-
A value of 0 is the same as not passing a value (default no limit).
360357
:keyword int max_integrated_cache_staleness_in_ms: The max cache staleness for the integrated cache in
361358
milliseconds. For accounts configured to use the integrated cache, using Session or Eventual consistency,
362359
responses are guaranteed to be no staler than this value.
@@ -399,9 +396,6 @@ def query_items(
399396
feed_options["maxIntegratedCacheStaleness"] = max_integrated_cache_staleness_in_ms
400397
correlated_activity_id = GenerateGuidId()
401398
feed_options["correlatedActivityId"] = correlated_activity_id
402-
response_continuation_token_limit_in_kb = kwargs.pop("response_continuation_token_limit_in_kb", None)
403-
if response_continuation_token_limit_in_kb is not None:
404-
feed_options["responseContinuationTokenLimitInKb"] = response_continuation_token_limit_in_kb
405399
if hasattr(response_hook, "clear"):
406400
response_hook.clear()
407401

sdk/cosmos/azure-cosmos/azure/cosmos/http_constants.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ class HttpHeaders(object):
9999
# Our custom DocDB headers
100100
Continuation = "x-ms-continuation"
101101
PageSize = "x-ms-max-item-count"
102-
ResponseContinuationTokenLimitInKb = "x-ms-documentdb-responsecontinuationtokenlimitinkb" # cspell:disable-line
103102

104103
# Request sender generated. Simply echoed by backend.
105104
ActivityId = "x-ms-activity-id"

sdk/cosmos/azure-cosmos/samples/document_management.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -191,23 +191,6 @@ def delete_all_items_by_partition_key(db, partitionkey):
191191
for doc in item_list:
192192
print('Item Id: {0}; Partition Key: {1}'.format(doc.get('id'), doc.get("company")))
193193

194-
195-
def query_items_with_continuation_token_size_limit(container, doc_id):
196-
print('\n1.11 Query Items With Continuation Token Size Limit.\n')
197-
198-
size_limit_in_kb = 8
199-
sales_order = get_sales_order(doc_id)
200-
container.create_item(body=sales_order)
201-
202-
# set response_continuation_token_limit_in_kb to 8 to limit size to 8KB
203-
items = list(container.query_items(
204-
query="SELECT * FROM r",
205-
partition_key=doc_id,
206-
response_continuation_token_limit_in_kb=size_limit_in_kb
207-
))
208-
209-
print('Continuation Token size has been limited to {}KB.'.format(size_limit_in_kb))
210-
211194
def get_sales_order(item_id):
212195
order1 = {'id' : item_id,
213196
'account_number' : 'Account1',
@@ -276,7 +259,6 @@ def run_sample():
276259
patch_item(container, 'SalesOrder1')
277260
delete_item(container, 'SalesOrder1')
278261
delete_all_items_by_partition_key(db, "CompanyA")
279-
query_items_with_continuation_token_size_limit(container, 'SalesOrder1')
280262

281263
# cleanup database after sample
282264
try:

sdk/cosmos/azure-cosmos/samples/document_management_async.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -208,23 +208,6 @@ async def delete_all_items_by_partition_key(db, partitionkey):
208208
for doc in item_list:
209209
print('Item Id: {0}; Partition Key: {1}'.format(doc.get('id'), doc.get("company")))
210210

211-
212-
async def query_items_with_continuation_token_size_limit(container, doc_id):
213-
print('\n1.11 Query Items With Continuation Token Size Limit.\n')
214-
215-
size_limit_in_kb = 8
216-
sales_order = get_sales_order(doc_id)
217-
await container.create_item(body=sales_order)
218-
219-
# set response_continuation_token_limit_in_kb to 8 to limit size to 8KB
220-
items = container.query_items(
221-
query="SELECT * FROM r",
222-
partition_key=doc_id,
223-
response_continuation_token_limit_in_kb=size_limit_in_kb
224-
)
225-
226-
print('Continuation Token size has been limited to {}KB.'.format(size_limit_in_kb))
227-
228211
def get_sales_order(item_id):
229212
order1 = {'id' : item_id,
230213
'account_number' : 'Account1',
@@ -295,7 +278,6 @@ async def run_sample():
295278
await patch_item(container, 'SalesOrder1')
296279
await delete_item(container, 'SalesOrder1')
297280
await delete_all_items_by_partition_key(db, "CompanyA")
298-
await query_items_with_continuation_token_size_limit(container, 'SalesOrder1')
299281

300282
# cleanup database after sample
301283
try:

sdk/cosmos/azure-cosmos/test/test_query.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
import pytest
1111
import collections
1212
import test_config
13-
from unittest.mock import MagicMock
14-
from azure.cosmos import http_constants
1513

1614
pytestmark = pytest.mark.cosmosEmulator
1715

@@ -830,23 +828,6 @@ def test_value_max_query(self):
830828

831829
self.assertListEqual(list(query_results), [None])
832830

833-
def side_effect_continuation_token_size_limit(self, *args, **kwargs):
834-
# Extract request headers from args
835-
self.assertTrue(args[2][http_constants.HttpHeaders.ResponseContinuationTokenLimitInKb] is 8)
836-
raise StopIteration
837-
838-
def test_continuation_token_size_limit_query(self):
839-
container = self.created_db.create_container_if_not_exists(
840-
self.config.TEST_COLLECTION_MULTI_PARTITION_WITH_CUSTOM_PK_ID, PartitionKey(path="/pk"))
841-
cosmos_client_connection = container.client_connection
842-
cosmos_client_connection._CosmosClientConnection__Get = MagicMock(
843-
side_effect=self.side_effect_continuation_token_size_limit)
844-
try:
845-
query = "Select * from c"
846-
container.query_items(query, response_continuation_token_limit_in_kb=8)
847-
except StopIteration:
848-
pass
849-
850831
def _MockNextFunction(self):
851832
if self.count < len(self.payloads):
852833
item, result = self.get_mock_result(self.payloads, self.count)

0 commit comments

Comments
 (0)