Closed tessus closed 3 years ago
Suggested solution:
$ sudo mysql -u root -p
MariaDB [(none)]> use nextcloud;
MariaDB [nextcloud]> set global innodb_large_prefix=on;
MariaDB [nextcloud]> set global innodb_file_format=Barracuda;
$ sudo -u www-data php occ maintenance:repair
Hello
It has nothing to do with the error, but why the unique on (poll_id, poll_option_text, timestamp)
and not only on (poll_id, poll_option_text)
??
I don't the a Use Case where you would like to have several times the sames option in a poll?
It has nothing to do with the error,
Right. So it is better to open a new issue, so it can be tracked.
Thanks for the info. I will have to look into it this evening. Although I'm not very keen on setting a global var in mysql, unless they really only persist for the selected database. I have to look into this as well. I certainly do not want to set those 2 things for 20 other databases.
I certainly do not want to set those 2 things for 20 other databases.
Understandable. Unfortunately we rely on the unique index to avoid duplicates, and they need full column width.
I updated some instances with the new version without any problems. Seems that these admins have enabled large_prefix for some reason. BTW: Be aware, that NC21 drops support for MySQL <8
What about altering the poll_option_text column to a varchar(255) instead of a varchar(256)
Ok, so I read up on those parameters, but unfortunately some info is missing. They are global, thus this will change all my databases. But there's no information on whether my other databases will require additional maintenance or not. Can I just set these 2 vars and my other databases will still work?
Be aware, that NC21 drops support for MySQL <8
That's a problem, because my server has an uptime of more than 6 years, so you can imagine that no mysql8 packages exist for a 7 year old Linux distro. This is just great.
What about altering the poll_option_text column to a varchar(255) instead of a varchar(256)
Possibly a silly question, but I am not a database pro: What do we win besides 1 byte?
The column is in utf8 so you win 3 bytes, So no more error (255*3 + 1 byte for poll_id and 1 byte for timstamp = 767)
poll_id
and timestamp
are int
, which means 4 bytes each.
Woops yes, but try it, it works for me (weird) At worst, remove timestamp from the multiple key and put a varchar(254)
Can I just set these 2 vars and my other databases will still work?
Something I can't predict. I don't know your databases. But you can find more information here about the how and why of this setting: https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_large_prefix
Be aware, that NC21 drops support for MySQL <8
That's a problem, because my server has an uptime of more than 6 years, so you can imagine that no mysql8 packages exist for a 7 year old Linux distro. This is just great.
Your MySQL version is 25 patch levels behind the latest release and and end of support for MySQL 5.6 is Feb 2021. So I would recommend to think about an update or maybe better switch to the current version of MariaDB.
About the discussion of field lengths: The option table will get another field which will be added to the index and since innodb_large_prefix
is defaulted to ON
since MySQL 5.7, I think we can rely on this setting.
Can we close this issue?
I wanted to upgrade to version 1.7.5 and I got:
Es ist ein Fehler bei der Anfrage aufgetreten. Es kann nicht fortgefahren werden. An exception occurred while executing 'CREATE UNIQUE INDEX UNIQ_options ON oc_polls_options (poll_id, poll_option_text, timestamp)': SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
and then when I tried to recover: (occ upgrade)
Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'CREATE UNIQUE INDEX UNIQ_options ON oc_polls_options (poll_id, poll_option_text, timestamp)':
I had to disable polls to continue to work.
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes Update failed
My instance failed
I wanted to upgrade to version 1.7.5 and I got:
Es ist ein Fehler bei der Anfrage aufgetreten. Es kann nicht fortgefahren werden. An exception occurred while executing 'CREATE UNIQUE INDEX UNIQ_options ON oc_polls_options (poll_id, poll_option_text, timestamp)': SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
and then when I tried to recover: (occ upgrade)
Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'CREATE UNIQUE INDEX UNIQ_options ON oc_polls_options (poll_id, poll_option_text, timestamp)':
I had to disable polls to continue to work.
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes Update failed
My instance failed
do as I said, in oc_polls_options , alter the vote_option_text column to a varchar(255) instead of varchar(256) AND do the same in table oc_polls_votes with the column vote_option_text it s the quickest and safest fix
It is not a good idea to change system internals, because the app could rely on it's setup. Later changes may occur also. And as I said: the index will grow due to a new field in the next version. So this hack will become obsolete.
As innodb_large_prefix is a default since MySQL 5.7 and 5.6 runs out of support this month, it is a good advice to set this global to ON.
@beccon4 Read the comment above: https://github.com/nextcloud/polls/issues/1375#issuecomment-770616281
@beccon4 Read the comment above: #1375 (comment)
I ve already read comments (on other related issues / nextcloud forum as well)
the problem is that you also have to change
innodb_file_format = Barracuda
changing this globally on a mysql server that has other databases than nextcloud is risky I think
Later changes may occur also. And as I said: the index will grow due to a new field in the next version. So this hack will become obsolete.
I ve already tested adding a field in the unique key, this won't trigger the mysql error Mysql max key length seems to apply on each field, not for the sum of their length
I think both arguments are valid.
At one point the dbms has to be upgraded to make it future proof. Changing the db structure as a quick hack seems the easy path forward, but might only result in trouble in the future.
The problem is that we still don't know what innodb_file_format = Barracuda
means for the other dbs on the server. Do they require us to run a maintenance (mysql) admin script/command? There's no proper info in the docs, which is slightly concerning.
Either way, I think we can close this topic. Although I certainly would appreciate a reply as to what innodb_file_format = Barracuda
really means and what the consequences are.
I could only speculate and google for answers, what effects are to expect, as you would do. But as far as I understood, the change does not affect existing tables. So it should be safe (of course with a backup). But don't quote me on this 😉
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
What is going wrong?
Upgrading from 1.6.3 to 1.7.4 gives the following error:
I also had to deactivate the app, because it requires
occ upgrade
which fails because of above error.To Reproduce Steps to reproduce the behavior:
Update to 1.7.4
Expected behavior No error and successful update
Screenshots If applicable, add screenshots to help explain your problem.
Information about your polls installation
Polls version? 1.7.4
Fresh installation or update from a prior version (from which one)? 1.6.3
How did you install this version?(Appstore or describe installation) Appstore
Information about your Instance of Nextcloud
Nextcloud version: 19.0.8
List of activated apps:
Nextcloud configuration:
Server configuration
Operating system: Linux
Webserver: Apache/2.4.46 (Unix) (fpm-fcgi)
Database: mysql 5.6.25
PHP version: 7.3.26
Nextcloud version: 19.0.8 - 19.0.8.1
Are you using an external user-backend, if yes which one: No
Client configuration
Irrelevant
Logs
Nextcloud log (data/nextcloud.log)
Browser log