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

sqlserver compression / encryption #1161

Merged
merged 1 commit into from Nov 29, 2021

Conversation

mialinx
Copy link
Contributor

@mialinx mialinx commented Nov 26, 2021

SQLServer

Enables WAL-G standard compression and encryption methods for SQLServer.
Option WALG_COMPRESSION_METHOD=sqlserver has special meaning: WAL-G will request SQLServer to compress data itself.

@mialinx mialinx requested review from ostinru and a team as code owners November 26, 2021 09:25
@@ -72,6 +80,21 @@ func NewServer(folder storage.Folder) (*Server, error) {
bs.server = http.Server{Addr: bs.endpoint, Handler: bs}
bs.indexes = make(map[string]*Index)
bs.leases = make(map[string]Lease)
compressor, err := internal.ConfigureCompressor()
if err != nil {
if _, ok := err.(internal.UnknownCompressionMethodError); !ok {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add some warning log to notify the user that WAL-G failed to configure the compressor?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree.
Will return error unless special builtin compression method specified.

if idx.Encryption != bs.encryption {
return fmt.Errorf("blob encryption (%s) does not match configured (%s)", idx.Encryption, bs.encryption)
}
if idx.Compression != bs.compression {
Copy link
Member

Choose a reason for hiding this comment

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

Let's assume the following case: Index with some encryption configured but without compression. Server has both encryption and compression enabled. Encryption check is passed, but compressors are obviously mismatched. In this setup, WAL-G will fail to download the uncompressed encrypted file. Maybe allow this scenario (with some warnings)?

Also, maybe go even further and allow to download the file using all currently supported compressors without the requirement that it should match the currently configured one? WAL-G supports this behavior, at least in Postgres (see DownloadAndDecompressStorageFile).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changing compression algorithm - one part of the problem. The second one is changing encryption.
The proper solution is to keep metainfo with files (as file extension or in some JSON) and choose decompressor/crypter by it's name. But it's not possible for the crypter at the moment.

I wouldn't like to solve only half of the problem, especially it's pretty hypothetical for the SQLServer.

Copy link
Member

@usernamedt usernamedt left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@ostinru ostinru left a comment

Choose a reason for hiding this comment

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

no criminality

@mialinx mialinx merged commit 0c9ad27 into wal-g:master Nov 29, 2021
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.

None yet

3 participants