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

Switch query events to just send ranges instead of full query text #19823

Merged
merged 4 commits into from
Jun 24, 2022

Conversation

Charles-Gagnon
Copy link
Contributor

Sending over the entire query text each time has perf implications - and it turns out there's no need for this since the extension can just get the text from the range directly. The extension host keeps its own copy of the text documents locally so it doesn't have go ever go outside of the process when doing it this way. This allowed me to greatly simplify the event logic as well.

Note that there are still perf issues with executing queries for large documents (I started hitting issues in the 100MB range). But I didn't see any noticeable impact from having these events firing (even with query history enabled) compared to stable ADS.

  • Changed IQueryInfo/IQueryMessage to just QueryInfo and QueryMessage to more align with how VS code extensibility names their types
  • Fixed core logic typing for the range - it was defined as optional but there's currently no way it'll ever be undefined so removing that makes things a lot simpler
  • Fixed the extension to properly handle batches - previously (and in current stable) I was only getting the first batch since I hadn't realized that the range array had multiple entries when there were batched executions


public set uri(newUri: string) {
this.queryRunner.uri = newUri;
this.dataService.uri = newUri;
if (this.queryRunner) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I was here fixed these as well since we're not guaranteed to have them exist when this is called

@coveralls
Copy link

coveralls commented Jun 24, 2022

Pull Request Test Coverage Report for Build 2557389573

  • 0 of 8 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.007%) to 42.147%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/sql/workbench/services/query/common/queryModelService.ts 0 8 0.0%
Totals Coverage Status
Change from base Build 2557023030: 0.007%
Covered Lines: 28195
Relevant Lines: 62424

💛 - Coveralls

if (this._captureEnabled && queryInfo && type === 'queryStop') {
const queryText = queryInfo.queryText ?? '';
const textDocuments = vscode.workspace.textDocuments;
const textDocument = textDocuments.find(e => e.uri.toString() === vscode.Uri.parse(document.uri).toString());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, are e.uri.toString() and document.uri different?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not, but I wanted to be absolutely sure - hence the parsing to Uri and then toString'ing that

@Charles-Gagnon Charles-Gagnon merged commit ed5a64f into main Jun 24, 2022
@Charles-Gagnon Charles-Gagnon deleted the chgagnon/useRange branch June 24, 2022 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants