Skip to content

Vcursor refactor#5982

Merged
sougou merged 13 commits intovitessio:masterfrom
planetscale:vcursor-refactor
Mar 30, 2020
Merged

Vcursor refactor#5982
sougou merged 13 commits intovitessio:masterfrom
planetscale:vcursor-refactor

Conversation

@harshit-gangal
Copy link
Copy Markdown
Member

Removed usage of resolver in handleExec by using bypass plan.

@harshit-gangal harshit-gangal requested a review from sougou as a code owner March 27, 2020 11:59
@systay systay force-pushed the vcursor-refactor branch from cf8eb1e to 1a2968b Compare March 30, 2020 12:42
harshit-gangal and others added 11 commits March 30, 2020 14:47
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
@systay systay force-pushed the vcursor-refactor branch from 1a2968b to c4658bf Compare March 30, 2020 12:49
systay and others added 2 commits March 30, 2020 15:05
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Copy link
Copy Markdown
Contributor

@sougou sougou left a comment

Choose a reason for hiding this comment

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

Some nits that you can fix forward.

var _ Primitive = (*Send)(nil)

// Send is an operator to send query to the specific keyspace, tabletType and destination
type Send struct {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd recommend a custom JSON marshaller that emits an additional fake "Opcode": "Send", which will make the output plan more readable (look at engine/limit.go).


// GetFields implements Primitive interface
func (s *Send) GetFields(vcursor VCursor, bindVars map[string]*query.BindVariable) (*sqltypes.Result, error) {
return nil, vterrors.Errorf(vtrpcpb.Code_INTERNAL, "not reachable") // TODO: systay - @sugu, is this correct?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Correct for now. We have to watch out if/when we allow these primitives to become composable.


// Send is an operator to send query to the specific keyspace, tabletType and destination
type Send struct {
// Keyspace specifies the keyspace to send the query to.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I also see that Send is mostly a subset of Route, but it's good to keep it separate for now.

}
func (e *Executor) handleExec(ctx context.Context, safeSession *SafeSession, sql string, bindVars map[string]*querypb.BindVariable, logStats *LogStats, stmtType sqlparser.StatementType) (*sqltypes.Result, error) {

// V3 mode.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove comment.

}
}

//TODO - what about these?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Clarify comment.

@sougou sougou merged commit a294ce8 into vitessio:master Mar 30, 2020
@systay systay mentioned this pull request Mar 31, 2020
dweitzman added a commit to dweitzman/vitess that referenced this pull request Apr 17, 2020
In vitessio#5982 queries after `use keyspace[shard]` were changed to use a new "Send" engine primitive instead of v2 routing, which caused OLAP to stop working for queries targeted in that way. This PR fixes those OLAP queries.

This PR does not implement GetFields, so prepared statements still aren't going to work with this kind of targeting.

As a bonus this also fixes an issue where trying to start/rollback/commit a transaction in OLAP mode caused a panic due to plan.Instructions being nil in that case.

Signed-off-by: David Weitzman <dweitzman@pinterest.com>
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.

3 participants