Skip to content

support SCATTER_ERRORS_AS_WARNINGS query directive#4228

Merged
sougou merged 10 commits intovitessio:masterfrom
tinyspeck:partial-scatter
Oct 27, 2018
Merged

support SCATTER_ERRORS_AS_WARNINGS query directive#4228
sougou merged 10 commits intovitessio:masterfrom
tinyspeck:partial-scatter

Conversation

@demmer
Copy link
Copy Markdown
Member

@demmer demmer commented Oct 1, 2018

Description

Adds the SCATTER_ERRORS_AS_WARNINGS query directive. (Part 1 of #4279)

Details

Specific changes include:

  • Refactor scatter conn and vindex internals to return an array of per-shard errors
  • Planner support for the SCATTER_WARNINGS_AS_ERRORS query comment directive
  • Engine support for returning partial results when this is enabled
  • End to end tests

@demmer
Copy link
Copy Markdown
Member Author

demmer commented Oct 1, 2018

@sougou I'd love your thoughts on the syntax proposal here.

@demmer demmer closed this Oct 1, 2018
@demmer demmer reopened this Oct 1, 2018
@demmer demmer force-pushed the partial-scatter branch 2 times, most recently from e2318ca to ed19e00 Compare October 9, 2018 01:49
In order to enable callers to remember errors positionally for a given
input array, add new RecordErrorAt and GetErrors interfaces. This feature
will be used to store the errors for each shard in a parallel scatter query
operation.

Signed-off-by: Michael Demmer <mdemmer@slack-corp.com>
When running a multi-shard query, instead of returning a single
aggregated array if any single shard fails, return an array of
errors, one for each shard.

This adds the necessary infrastructure for the executor to be able
to return partial success if some shard queries fail but others
succeed.

Signed-off-by: Michael Demmer <mdemmer@slack-corp.com>
Add a ShardPartial option to the route plan. If true, when there is
at least one successful shard query, return the results that were
obtained instead of an error.

Signed-off-by: Michael Demmer <mdemmer@slack-corp.com>
Signed-off-by: Michael Demmer <mdemmer@slack-corp.com>
Signed-off-by: Michael Demmer <mdemmer@slack-corp.com>
@demmer demmer force-pushed the partial-scatter branch 2 times, most recently from ae1ea1b to bfdc161 Compare October 16, 2018 16:11
Signed-off-by: Michael Demmer <mdemmer@slack-corp.com>
Given the updated design whereby vtgate will return any shard
error as a warning, change the comment directive to more
intuitively express what the behavior is.

Signed-off-by: Michael Demmer <mdemmer@slack-corp.com>
@demmer demmer changed the title support partial results on scatter queries support SCATTER_ERRORS_AS_WARNINGS query directive Oct 17, 2018
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.

The overall approach is good. But I think the error handling changes are not needed. Let me know if you had something else in mind.

})
return qr, err

// If there were any errors, return the
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.

nit: them?

// given capacity if required, so any future calls to
// RecordError will append to the array _after_ any
// nil entries created by growing the representation.
func (aer *AllErrorRecorder) GetErrors(n int) []error {
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.

Do we need this? I think having multiGoTransaction return aer.AggrError(vterrors.Aggregate) will do the same thing. Then we won't have to change ExecuteMultiShard at all.

Along the same lines, RecordErrorAt is currently not useful because all code paths end up using vterrors.Aggregate which does its own sorting. So, if you want to retain the original order, you'll need to add an option to vterrors.Aggregate.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You’re right. I needed to retain the position in the original design in which the executor would need to know which shard had an error.

Now that we just append all the errors to the warning list, we can remove this and go back to the simpler collector.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Actually just to be clear — we still need the list of errors to come out of the engine but not necessarily with the positional correspondence with the shards array.

It’s not exactly evident why in this pr but if you look at the one which puts it all together it makes more sense.

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 see. You need them for the upcoming RecordWarnings. Sounds good. So, we only need to get rid of RecordErrorAt.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@sougou I just pushed the change to remove RecordErrorAt.

Since the design for partial scatter evolved to no longer require
errors be associated with their position in the shards array, remove
the now unnecessary support in the AllErrorRecorder.

This reverts commit 47e09f6.

Signed-off-by: Michael Demmer <mdemmer@slack-corp.com>
Signed-off-by: Michael Demmer <mdemmer@slack-corp.com>
Signed-off-by: Michael Demmer <mdemmer@slack-corp.com>
@sougou sougou merged commit 41d3c1b into vitessio:master Oct 27, 2018
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