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

Fix MySQL support #32

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Fix MySQL support #32

wants to merge 2 commits into from

Conversation

mennozon
Copy link

As per issue #25 these changes allow the use of MySQL as backend.

@wamdam
Copy link
Owner

wamdam commented Mar 26, 2019

Looks nice. However postgres' varchar limit is 10485760. Not that this would be required. But 128 chars seems a bit restrictive. Are there any limits in mysql that would prevent - say - 2048 or even 4096 characters?

@mennozon
Copy link
Author

Maximum seems to be 65535 for MySQL >5.0.3.

I have to admit I didn't know how large this had to be and 128 seemed to work, I figured just specifying something really large might waste space somewhere so I guess 2048 or 4096 shouldn't be a problem.

As is backy2 was unable to use sqlalchemy's MySQL backend. This is
resolved by defining the length of strings and enable
PrimaryKeyConstraint.
It's the same as postgresql because of the used backend but an example
prevents some guessing.
@mennozon
Copy link
Author

It seems there's some other limit I'm running into, I'm getting an error [1] on initdb when using 1024, 2048 or 4096.

I've updated the values to 512 and initdb works, I've created 2 backups and restored them, all seems fine. My other cluster is still using 128 since march without any (known) issues, the new cluster will be using 512 like in this pull request, unless I run into issues with this.

[1]
sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (1071, 'Specified key was too long; max key length is 3072 bytes') [SQL: '\nCREATE TABLE tags (\n\tversion_uid VARCHAR(36) NOT NULL, \n\tname VARCHAR(4096) NOT NULL, \n\tPRIMARY KEY (version_uid, name), \n\tFOREIGN KEY(version_uid) REFERENCES versions (uid)\n)\n\n'] (Background on this error at: http://sqlalche.me/e/e3q8) INFO: Backy failed.

@flames
Copy link

flames commented Apr 7, 2020

[s]iirc, mysql varchar limit is 255 with utf8. 767 bytes indexing[/s] never mind, i was wrong.
65535 bytes. so depending on character encoding different character lengths.

@andrewbogott
Copy link

I would love to see this change merged -- is there anything I can do to move it along?

@anomaly256
Copy link

Also running with this file hand-modified in a few places. Would be good to get it merged

wamdam added a commit that referenced this pull request Jun 1, 2021
@wamdam
Copy link
Owner

wamdam commented Jun 1, 2021

Pushed a fix. Could you try again with the master branch?

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

5 participants