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

Driver Compression Enablement #859

Open
kvolmar opened this issue Apr 24, 2024 · 4 comments
Open

Driver Compression Enablement #859

kvolmar opened this issue Apr 24, 2024 · 4 comments

Comments

@kvolmar
Copy link

kvolmar commented Apr 24, 2024

Is there a way to enable compression when using the Driver rather than the Client?

@kvolmar
Copy link
Author

kvolmar commented Apr 24, 2024

Specifically I've seen

go-mysql/client/conn.go

Lines 124 to 128 in 7c31dc4

if c.ccaps&CLIENT_COMPRESS > 0 {
c.Conn.Compression = MYSQL_COMPRESS_ZLIB
} else if c.ccaps&CLIENT_ZSTD_COMPRESSION_ALGORITHM > 0 {
c.Conn.Compression = MYSQL_COMPRESS_ZSTD
}
. Where is ccaps set and is there a way to configure them when using the Driver?

@lance6716
Copy link
Collaborator

Specifically I've seen

go-mysql/client/conn.go

Lines 124 to 128 in 7c31dc4

if c.ccaps&CLIENT_COMPRESS > 0 {
c.Conn.Compression = MYSQL_COMPRESS_ZLIB
} else if c.ccaps&CLIENT_ZSTD_COMPRESSION_ALGORITHM > 0 {
c.Conn.Compression = MYSQL_COMPRESS_ZSTD
}

. Where is ccaps set and is there a way to configure them when using the Driver?

go-mysql/client/conn.go

Lines 177 to 180 in 7c31dc4

// SetCapability enables the use of a specific capability
func (c *Conn) SetCapability(cap uint32) {
c.ccaps |= cap
}

@kvolmar
Copy link
Author

kvolmar commented Apr 25, 2024

Thank you @lance6716.

A few more questions:

I am currently using the go-sql-driver/mysql and interested in migrating to go-mysql-org/go-mysql specifically for the driver. I am evaluating the feasibility of using the database/sql library with your driver and enabling compression. I'm currently importing the driver with side effects and able to write to MySQL, but without compression. Are the compression settings configurable with env vars or in the DSN?

@lance6716
Copy link
Collaborator

Sorry I think this library does not have this way to configurate compression. Welcome to help us implement it, related files should be under driver folder.

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

No branches or pull requests

2 participants