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

[DO NOT MERGE] traffic mirroring proof-of-concept #14872

Closed

Conversation

maxenglander
Copy link
Collaborator

Description

This is a proof-of-concept PR.

Related Issue(s)

#13772

@maxenglander maxenglander added Type: RFC Request For Comment Do Not Merge Skip CI Skip CI actions from running labels Dec 31, 2023
@vitess-bot vitess-bot bot added NeedsBackportReason If backport labels have been applied to a PR, a justification is required NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsWebsiteDocsUpdate What it says labels Dec 31, 2023
@vitessio vitessio deleted a comment from vitess-bot bot Dec 31, 2023
@github-actions github-actions bot added this to the v19.0.0 milestone Dec 31, 2023
@maxenglander maxenglander removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsWebsiteDocsUpdate What it says NeedsIssue A linked issue is missing for this Pull Request NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Dec 31, 2023
@maxenglander maxenglander removed this from the v19.0.0 milestone Dec 31, 2023
@maxenglander maxenglander changed the title [DO NOT REVIEW OR MERGE] traffic mirroring proof-of-concept [DO NOT MERGE] traffic mirroring proof-of-concept Dec 31, 2023
Signed-off-by: Max Englander <[email protected]>
@maxenglander maxenglander force-pushed the maxeng-mirror-routingrules branch from d12e2cf to bee9858 Compare January 3, 2024 06:04
Copy link
Contributor

github-actions bot commented Feb 3, 2024

This PR is being marked as stale because it has been open for 30 days with no activity. To rectify, you may do any of the following:

  • Push additional commits to the associated branch.
  • Remove the stale label.
  • Add a comment indicating why it is not stale.

If no action is taken within 7 days, this PR will be closed.

@github-actions github-actions bot added the Stale Marks PRs as stale after a period of inactivity, which are then closed after a grace period. label Feb 3, 2024
@maxenglander maxenglander removed the Stale Marks PRs as stale after a period of inactivity, which are then closed after a grace period. label Feb 4, 2024
Signed-off-by: Max Englander <[email protected]>
@maxenglander maxenglander force-pushed the maxeng-mirror-routingrules branch from 50a6f4d to c963fd7 Compare February 4, 2024 04:18
Signed-off-by: Max Englander <[email protected]>
@maxenglander maxenglander force-pushed the maxeng-mirror-routingrules branch from c963fd7 to 8d21447 Compare February 4, 2024 04:29
@@ -37,7 +38,7 @@ type Plan struct {
Instructions Primitive // Instructions contains the instructions needed to fulfil the query.
BindVarNeeds *sqlparser.BindVarNeeds // Stores BindVars needed to be provided as part of expression rewriting
Warnings []*query.QueryWarning // Warnings that need to be yielded every time this query runs
TablesUsed []string // TablesUsed is the list of tables that this plan will query
TablesUsed sqlparser.TableNames // TablesUsed is the list of tables that this plan will query
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This change was made to enable planbuilder to figure out which keyspaces the original plan touches, and use that information to figure out whether/how to build a mirror plan, without having to do strings.Split.

engine.NewPercentMirrorTarget(percent, target.primitive),
)
tables := append(from.tables, target.tables...)
operators.SortTableNames(tables)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

AFAICT we only need table names to be sorted for logging/stats purposes, e.g. so that planbuilder tests are consistent. Maybe we can delay sorting until it's needed?

Signed-off-by: Max Englander <[email protected]>
Comment on lines +82 to +86
if table.Qualifier.NotEmpty() {
tablesUsed[i] = fmt.Sprintf("%s.%s", table.Qualifier.String(), table.Name.String())
} else {
tablesUsed[i] = table.Name.String()
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if table.Qualifier.NotEmpty() {
tablesUsed[i] = fmt.Sprintf("%s.%s", table.Qualifier.String(), table.Name.String())
} else {
tablesUsed[i] = table.Name.String()
}
tablesUsed[i] = sqlparser.String(table)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@systay the problem with that is it adds backticks around keyspace names and tables. Which I guess isn't really a problem if we're OK with updating all the planbuilder tests and any other tests that use this info?

HasMirrorRules() bool
}

// mirrorVSchema is a wrapper which returns mirrored versions of values
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we move mirrorVSchema to it's own file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Do Not Merge Skip CI Skip CI actions from running Type: RFC Request For Comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants