-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Refactor tabletmanager table filtering logic #6242
Conversation
} | ||
|
||
for _, tc := range tcs { | ||
f, err := NewTableFilter(tc.tables, tc.excludeTables, tc.includeViews) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: t.Run(...)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
@@ -63,94 +63,129 @@ func (tds TableDefinitions) Swap(i, j int) { | |||
tds[i], tds[j] = tds[j], tds[i] | |||
} | |||
|
|||
// FilterTables returns a copy which includes only whitelisted tables | |||
type TableFilter struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: a doc comment will be nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's already docs in both NewTableFilter and FilterTables, so I felt it was redundant. if you insist, i will copy the content.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to duplicate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Precommit didn't catch this? All exported names require a comment.
If it's not useful outside this package, it's better to make it unexported.
Same with NewTableFilter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added comment. This is intended to actually be used outside in the mysqlctl
package, and replace FilterTables, in a separate PR. Hence these are exported methods.
Signed-off-by: Toliver Jue <toliver@planetscale.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
…aking-change Reverting breaking change relating to filter regular expressions in #6242
Break up
tabletmanager
FilterTables into a filter and application, so that filtering is reusable.Signed-off-by: Toliver Jue toliver@planetscale.com