-
Notifications
You must be signed in to change notification settings - Fork 367
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
use unlogged table for cataloger diff results #685
Conversation
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.
Looks cool, except for xid. I read the docs, xid relies heavily on nonrandomness for uniqueness, and the nonrandom hostid component used by this particular implementation seems already to have known failure modes.
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 unquoted UUID also fails. nanoid or prepend a string, see below.
// contextWithDiffResultsDispose generate diff results id used for temporary table name | ||
func contextWithDiffResultsDispose(ctx context.Context, tx sq.Execer) (context.Context, context.CancelFunc) { | ||
id := xid.New().String() | ||
// withDiffResultsContext generate diff results id used for temporary table name |
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.
// withDiffResultsContext generate diff results id used for temporary table name | |
// withDiffResultsContext generates diff results id used for temporary table name |
id := xid.New().String() | ||
// withDiffResultsContext generate diff results id used for temporary table name | ||
func (c *cataloger) withDiffResultsContext(ctx context.Context) (context.Context, context.CancelFunc) { | ||
id := strings.ReplaceAll(uuid.New().String(), "-", "") |
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.
Actually, this produces a valid table name only 37.5% of the time, when the first hex digit is a-f. You might prepend "diff_table_" to this string.
Or just use nanoid, which is designed to produce useful unescaped names :-/
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.
yeah, it already gets a prefix.
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.
Sorry, this is of course cool.
See golang func comment grammar fix to use the approved golang present tense.
id := xid.New().String() | ||
// withDiffResultsContext generate diff results id used for temporary table name | ||
func (c *cataloger) withDiffResultsContext(ctx context.Context) (context.Context, context.CancelFunc) { | ||
id := strings.ReplaceAll(uuid.New().String(), "-", "") |
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.
yeah, it already gets a prefix.
No description provided.