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

Json support for RBR. #2800

Merged
merged 3 commits into from
May 1, 2017
Merged

Json support for RBR. #2800

merged 3 commits into from
May 1, 2017

Conversation

alainjobart
Copy link
Contributor

For now, only support JSON expressions as SQL, for binlog. UpdateStream support is somewhat different, as values must be printed as JSON strings (like '{"a":25}') instead of the SQL needed to recreate the exact same MySQL internal object (like JSON_OBJECT("a", 25)).

Copy link
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.

Some clarifications needed.

if toplevel {
result.WriteString("CAST(")
}
fmt.Fprintf(result, "CAST('%04d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, minute, second)
Copy link
Contributor

Choose a reason for hiding this comment

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

Not doing UTC here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a DATETIME, not a TIMESTAMP. So it is always UTC.


// FIXME(alainjobart) this is broken for now. The lack of metadata
// makes the parsing fail. The MySQL source code is too obscure
// to make any sense of this.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we just return an error here?
If we know what json construct could cause this, we can also document it, and may be block it from vttablet.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 on blocking from writing in vttablet, if possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

This is using the JSON type to echo SQL statements.
This is used by binlog streamer for JSON.
@alainjobart alainjobart merged commit ebbddd9 into vitessio:master May 1, 2017
@alainjobart alainjobart deleted the json branch May 1, 2017 16:04
frouioui pushed a commit to planetscale/vitess that referenced this pull request Mar 26, 2024
…ces.SortFunc (vitessio#2800)

* cherry pick of 13644

Signed-off-by: Matt Layher <mdlayher@planetscale.com>

* go/boost: fix uses of x/exp/slices.SortFunc

Signed-off-by: Matt Layher <mdlayher@planetscale.com>

---------

Signed-off-by: Matt Layher <mdlayher@planetscale.com>
Co-authored-by: Matt Layher <mdlayher@planetscale.com>
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.

4 participants