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

Olap error message fix #7448

Merged
merged 2 commits into from
Feb 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions go/vt/vtgate/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1095,10 +1095,6 @@ func (e *Executor) StreamExecute(ctx context.Context, method string, safeSession
// These may or may not all work, but getPlan() should either return a plan with instructions
// or an error, so it's safe to try.
break
case sqlparser.StmtBegin, sqlparser.StmtCommit, sqlparser.StmtRollback:
// These statements don't populate plan.Instructions. We want to make sure we don't try to
// dereference nil Instructions which would panic.
fallthrough
case sqlparser.StmtVStream:
log.Infof("handleVStream called with target %v", target)
return e.handleVStream(ctx, sql, target, callback, vcursor, logStats)
Expand Down
20 changes: 20 additions & 0 deletions go/vt/vtgate/executor_stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,26 @@ func TestStreamSQLSharded(t *testing.T) {
}
}

func TestStreamError(t *testing.T) {
executor, _, _, _ := createLegacyExecutorEnv()
logChan := QueryLogger.Subscribe("TestStreamError")
defer QueryLogger.Unsubscribe(logChan)

queries := []string{
"start transaction",
"begin",
"rollback",
"commit",
}
for _, query := range queries {
t.Run(query, func(t *testing.T) {
_, err := executorStreamMessages(executor, query)
require.Error(t, err)
require.Contains(t, err.Error(), "unsupported statement type for OLAP")
})
}
}

func executorStreamMessages(executor *Executor, sql string) (qr *sqltypes.Result, err error) {
results := make(chan *sqltypes.Result, 100)
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Millisecond)
Expand Down