-
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
New unified internal table names format: part 2, generating new names #15178
New unified internal table names format: part 2, generating new names #15178
Conversation
Signed-off-by: Shlomi Noach <[email protected]>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #15178 +/- ##
==========================================
- Coverage 70.63% 67.37% -3.27%
==========================================
Files 1377 1560 +183
Lines 182801 192773 +9972
==========================================
+ Hits 129127 129876 +749
- Misses 53674 62897 +9223 ☔ View full report in Codecov by Sentry. |
Good to review. |
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.
LGTM. I only had a few minor comments/notes/questions that you can resolve as you feel best.
// If uuid is given, then it must be in condensed-UUID format. If empty, the function auto-generates a UUID. | ||
func GenerateInternalTableName(hint string, uuid string, t time.Time) (tableName string, err error) { | ||
if len(hint) != 3 { | ||
return "", fmt.Errorf("Invalid hint: %s, expected 3 characters", hint) |
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.
Any reason not to use vterrors here so that we have codes? IIRC you added some error handling not too long ago that relied on error codes. Error messages also aren't supposed to be capitalized (for wrapping).
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.
go/vt/schema/name_test.go
Outdated
assert.NoError(t, err) | ||
|
||
readableTimestamp := ToReadableTimestamp(ti) | ||
assert.Equal(t, readableTimestamp, "20150225110639") |
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 think it would be more meaningful if we didn't use a string literal here but instead used ti
here.
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.
The point was to validate that a transformation of ti
lands at an expected value. So that constant should remain IMO. I did, however, switch between readableTimestamp
and "20150225110639"
because the constant is the expected one.
go/vt/schema/tablegc.go
Outdated
switch s { | ||
case HoldTableGCState: | ||
return InternalTableGCHoldHint | ||
case PurgeTableGCState: | ||
return InternalTableGCPurgeHint | ||
case EvacTableGCState: | ||
return InternalTableGCEvacHint | ||
case DropTableGCState: | ||
return InternalTableGCDropHint | ||
default: | ||
return InternalTableUnknownHint | ||
} |
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.
Any reason not to make a map of these states like protobuf does? Not a big deal, but the use of Internal (capital I) and Hint here are not obvious to the average reader (me).
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!
Signed-off-by: Shlomi Noach <[email protected]>
Description
This is the 2nd part of introducing the new vitess internal table names. This PR is post
v19
, and will be merged inv20
.In this PR, we still support both old name format and new name format. However, we now generate internal table names in new format only. This means:
_vt_hld_6ace8bcef73211ea87e9f875a4d24e90_20200915120410_
_vt_vrp_6ace8bcef73211ea87e9f875a4d24e90_20200915120410_
Some implementation notes:
InternalTableHint
, which is also used inTableGCState
"_vrepl"
table name by itself, directly; now it usesgo/vt/schema
to do so.v21
we will remove them.gh-ost
table names andpt-osc
table names are unaffected by this change.gh-ost
is a bit of a problem because there's no way right now to force it to accept the new naming format. We could updategh-ost
, but then don't really have control over thegh-ost
version the user chooses to install. Also, we're moving away fromgh-ost
and so it's not as important. This is a discussion for another issue.Related Issue(s)
Checklist
Deployment Notes