Skip to content
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] move system_key logic to query_iterable #22893

Merged
merged 10 commits into from
Mar 4, 2022
Merged

[Cosmos] move system_key logic to query_iterable #22893

merged 10 commits into from
Mar 4, 2022

Conversation

simorenoh
Copy link
Member

@simorenoh simorenoh commented Feb 3, 2022

This is a problem that came up while we were having the big conversations around the async client in December, with the network call that is made through the set_partition_key() method that was present in most container methods. It seems as though the changes with moving the await to the QueryIterableAsync class' aiter method did not end up working, and it has been reported by a customer that queries with partition keys didn't work, and I also verified myself (not sure how I tested this before that it didn't break, but here we are).

With these changes we move the overhead of this call to the container initialization instead, since regardless any method a user would've first used with the container would have spent time on this network call regardless. This way, we also simplify the query logic in the back, and make sure that containers all have that check done when initialized.

Edit: This change is no longer what it previously described - although it was a good solution, it does not affect users who initialize their container proxies by calling get_container_client(). Instead, the logic is now in the query_iterable class, and takes place during query execution.

Verified

This commit was signed with the committer’s verified signature.
Atul9 Atul Bhosale
@azure-sdk
Copy link
Collaborator

API changes have been detected in azure-cosmos. You can review API changes here

Verified

This commit was signed with the committer’s verified signature.
Atul9 Atul Bhosale
@azure-sdk
Copy link
Collaborator

API changes have been detected in azure-cosmos. You can review API changes here

@simorenoh simorenoh added Client This issue points to a problem in the data-plane of the library. Do Not Merge labels Feb 4, 2022
@simorenoh simorenoh marked this pull request as draft February 4, 2022 18:32
@simorenoh
Copy link
Member Author

simorenoh commented Feb 22, 2022

@annatisch helped me out by spending time debugging the query code and seeing if it was possible to move the logic elsewhere within the query context in order to keep the logic based around this method. She found that it is possible, albeit not in the most efficient way since the method gets called every time for the first query's results on each iterator. I have tried doing some digging on my own as well and haven't been able to move past this in some way or another.

I believe the way to move forward (for now) would be to make these inefficient changes that make the network calls with each iterator for the first query invoked by the user in order to unblock users in this month's release... and then work on getting a more efficient solution for the following release (since the async client is still in beta regardless). Would this be ok? @tjprescott @johanste

@check-enforcer
Copy link

This pull request is protected by Check Enforcer.

What is Check Enforcer?

Check Enforcer helps ensure all pull requests are covered by at least one check-run (typically an Azure Pipeline). When all check-runs associated with this pull request pass then Check Enforcer itself will pass.

Why am I getting this message?

You are getting this message because Check Enforcer did not detect any check-runs being associated with this pull request within five minutes. This may indicate that your pull request is not covered by any pipelines and so Check Enforcer is correctly blocking the pull request being merged.

What should I do now?

If the check-enforcer check-run is not passing and all other check-runs associated with this PR are passing (excluding license-cla) then you could try telling Check Enforcer to evaluate your pull request again. You can do this by adding a comment to this pull request as follows:
/check-enforcer evaluate
Typically evaulation only takes a few seconds. If you know that your pull request is not covered by a pipeline and this is expected you can override Check Enforcer using the following command:
/check-enforcer override
Note that using the override command triggers alerts so that follow-up investigations can occur (PRs still need to be approved as normal).

What if I am onboarding a new service?

Often, new services do not have validation pipelines associated with them, in order to bootstrap pipelines for a new service, you can issue the following command as a pull request comment:
/azp run prepare-pipelines
This will run a pipeline that analyzes the source tree and creates the pipelines necessary to build and validate your pull request. Once the pipeline has been created you can trigger the pipeline using the following comment:
/azp run python - [service] - ci

@azure-sdk
Copy link
Collaborator

API changes have been detected in azure-cosmos. You can review API changes here

@simorenoh simorenoh marked this pull request as ready for review March 2, 2022 15:30
@simorenoh simorenoh changed the title [Cosmos] move system_key logic and overhead to container initialization [Cosmos] move system_key logic to query_iterable Mar 2, 2022
@simorenoh simorenoh requested a review from annatisch March 3, 2022 15:25
@simorenoh simorenoh merged commit 730f091 into Azure:main Mar 4, 2022
@simorenoh simorenoh deleted the async-queries-fix branch March 4, 2022 18:01
iscai-msft added a commit to iscai-msft/azure-sdk-for-python that referenced this pull request Mar 4, 2022
…into new_metrics_advisor

* 'main' of https://github.com/Azure/azure-sdk-for-python: (92 commits)
  [Mgmt Compute] Sanitize recordings (Azure#23331)
  [Tables] Release prep (Azure#23297)
  [Cosmos] move system_key logic to query_iterable (Azure#22893)
  [Cosmos] added additional warning to default consistency change (Azure#23225)
  update template (Azure#23333)
  [Storage] Address comments from API Review for March release (Azure#23294)
  code and test (Azure#23273)
  [textanalytics] release prep + fixing docstrings and links (Azure#23315)
  [Schema Registry] rename request kwargs to request options (Azure#23325)
  update new app service api version (Azure#23034)
  [SchemaRegistry] add tests for error codes (Azure#23140)
  Increment package version after release of azure-core (Azure#23319)
  Sync eng/common directory with azure-sdk-tools for PR 2824 (Azure#23314)
  Add python credscan in ci.yml (Azure#23307)
  [SchemaRegistry] avro api changes (Azure#23259)
  [KeyVualt KV] Fix cspell errors (Azure#23255)
  [KeyVault Certs] Fix cspell errors (Azure#23251)
  [AutoRelease] t2-containerregistry-2022-02-21-89653(Do not merge) (Azure#23155)
  [KeyVault Keys] Fix cspell errors (Azure#23250)
  Sync eng/common directory with azure-sdk-tools for PR 2830 (Azure#23267)
  ...
rakshith91 pushed a commit to rakshith91/azure-sdk-for-python that referenced this pull request Apr 7, 2022
* moving system_key overhead to container creation for queries to work

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update database.py

* moved awaiting logic to query_iterable_async.py

* Update CHANGELOG.md

* Update database.py
rakshith91 pushed a commit to rakshith91/azure-sdk-for-python that referenced this pull request Apr 10, 2022
* moving system_key overhead to container creation for queries to work

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update database.py

* moved awaiting logic to query_iterable_async.py

* Update CHANGELOG.md

* Update database.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. Cosmos Do Not Merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants