Skip to content

vtexplain get query result types from schema#3266

Closed
demmer wants to merge 6 commits intovitessio:masterfrom
tinyspeck:vtexplain-query-types-from-schema
Closed

vtexplain get query result types from schema#3266
demmer wants to merge 6 commits intovitessio:masterfrom
tinyspeck:vtexplain-query-types-from-schema

Conversation

@demmer
Copy link
Copy Markdown
Member

@demmer demmer commented Sep 30, 2017

NOT YET FOR MERGE: Depends on changes in #3264 and #3265.

Previously, when returning results from queries, vtexplain used the default SingleRowResult that was used in the various tablet tests and as such had a fixed schema of two fields. This caused confusing results for queries involving secondary indexes as the results are used as part of the plan generation.

Instead, rework the implementation so that it tries to parse the query sent to the fake mysql and in the cases of simple select expressions, uses the knowledge of the table schema to produce Result objects with the correct types and synthetic values.

As part of this work, replace the QueryLogger hook in fakesqldb with a more generic hook that enables overriding the query handler.

@demmer demmer requested a review from sougou September 30, 2017 19:16
Previously, when returning results from queries, vtexplain used
the default SingleRowResult that was used in the various tablet
tests and as such had a fixed schema of two fields. This caused
confusing results for queries involving econdary indexes as the
results are used as part of the plan generation.

Instead, rework the implementation so that instead it tries to
parse the query sent to the fake mysql and in the cases of simple
select expressions, uses the knowledge of the table schema to
produce Result objects with the correct types and synthetic
values.

As part of this work, replace the QueryLogger hook in fakesqldb
with a more generic hook that enables overriding the query handler.
Modify the fake healthcheck module to allow other types of fake
connections to be created in addition to SandboxConn.

Remove the Executor interface from SandboxConn.

Both of these pave the way for reworking how vtexplain is plumbed
to avoid using SandboxConn at all and instead just implement the
QueryService interface directly.
The previous method of hijacking the SandboxConn didn't properly
execute all of the logic for transactions and instead relied on
autocommit behavior at the tablet.

Instead, implement the QueryService directly and route the calls
to the tabletserver implementation.

This does a better job of emulating the actual vtgate transaction
flow and opens up the opportunity to demonstrate other things such
as 2PC.
@demmer demmer force-pushed the vtexplain-query-types-from-schema branch from 855909c to 7e3cc1f Compare September 30, 2017 23:47
@demmer
Copy link
Copy Markdown
Member Author

demmer commented Oct 1, 2017

Will rework in light of #3265

@demmer demmer closed this Oct 1, 2017
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.

2 participants