WeBWorK Main Forum

Can't update OPL

Can't update OPL

by Lars Jensen -
Number of replies: 6
Hi everyone,

We're moving webwork to a new server, and things are have been testing out good, except that we get an error when running OPL-update. The error is:

Library version is 2.5; using OPLtables!
DBD::mysql::db do failed: Specified key was too long; max key length is 1000 bytes at ./OPL-update line 266.

I'm not sure what this means - it looks to have to do with the database. I had backed up the database from the old server and installed it to the new server, and the database on the new server looks normal when viewed from phpmyadmin.

Any ideas?

Thanks,
Lars.
In reply to Lars Jensen

Re: Can't update OPL

by Danny Glin -
What version of WeBWorK are you running?

Others have encountered similar issues, and it usually has something to do with character sets. There have been several tweaks to the code to try to account for this.

I don't think that copying your old database would have anything to do with the problem. IIRC the OPL-update script drops the OPL tables from the database completely, then recreates them.
In reply to Danny Glin

Re: Can't update OPL

by Michael Gage -
In WeBWorK 2.13 a change was made to limit the size of the author key:

https://github.com/openwebwork/webwork2/commit/ced367cbd88e7bf4f72289abacce24e7edf55ca0#diff-3afe7ab31034facfb4de6f59971132bc

Have you updated to version 2.13? Can you figure out
which key is causing the problem? The error might come
from using different character codes in the database.

I don't expect things to be completely resolved until we have switched
everything (webwork2 code and database) over to utf8mb (the extended character code that print alphabets for all languages). Hopefully we'll complete that this summer -- but it will require a lot of checking to make sure everything continues to work. Meantime we deal with temporary hacks.

Check the settings on your new mysql database and check them against the old settings. That might help provide a clue.


In reply to Michael Gage

Re: Can't update OPL

by Lars Jensen -
Hi Mike,

Thanks again for your help. It turns out that when I created the empty webwork database in mariadb on my new server, it somehow was created with a DEFAULT_CHARACTER_SET_NAME equal to utf8mb4. My old server had latin1. When I changed it back to latin1 on the new server, OPL-update ran just fine.

In case anyone else runs into the same problem:
  1. Go to phpmyadmin > information_schema > schemata to check the webwork database DEFAULT_CHARACTER_SET_NAME
  2. If necessary, see here how to change it: https://mediatemple.net/community/products/dv/204403914/default-mysql-character-set-and-collation
Thanks,
Lars.
In reply to Lars Jensen

Re: Can't update OPL, Docker, testing, and future intenationalization of WeBWorK

by Michael Gage -
Glad that helped. In future releases look for enabling full internationalization by turning the utf8mb4 character set variable back on in the mysql database and adjusting the size of the database fields to accommodate the extra bytes required.

You can already see the pull requests for internationalization lined up, anything with utf8 in its title.
(https://github.com/openwebwork/webwork2/pulls) and (https://github.com/openwebwork/pg/pulls)

It's taking a while to get all of these changes tested to make sure they are backward compatible. However helping out with this testing is becoming easier and easier. On a mac at least (i"ve done it), and almost certainly on windows and linux, you can install a program called Docker which is a light weight virtual machine. Following the instructions at https://github.com/openwebwork/webwork2/wiki/Docker-newbie-instructions
you can download a completely functioning webwork site and set it up, including populating the OPL database with metadata (this takes 20 minutes)
in about an hour. Once set up it takes seconds to start up and shut down a local webwork site for testing. This enables you to start up your own local mini-development site on your laptop or desktop machine, incorporate proposed changes via a pull request test them and report back (via the review buttons on github) any issues or whether the proposed changes pass.

I invite everyone to start with testing an easy pull request such as the fix for the sage.pl file at https://github.com/openwebwork/pg/pull/329 (mgage:develop_sagefix). This corrects some error messages that occur because of changes in the way sagecell operates.

The webwork site that you set up on your laptop via Docker could probably serve 20 or so students, but it's meant for private development at this point. I foresee an optimized docker installation mechanism that would allow one to easily spin up a webwork site for a much larger group of students. Meantime this early version of the docker setup, created by Pan Luo (@xcompass) at UBC ,is a good way to get started.

I also foresee a version of the Dockerfile that includes WeBWorK and R together so that you can spin up a complete webwork site for creating and checking webwork statistics problems in a matter of minutes.
In reply to Michael Gage

Re: Can't update OPL, Docker, testing, and future intenationalization of WeBWorK

by David Reagan -
Hey all, apologies for posting on an old topic, but I've been running into the same error as the original post. On 2.15...

Due to issues getting an account here, I posted on github about it first. See: https://github.com/openwebwork/webwork2/issues/1007

I have been able to get it running when using MariaDB, but that's not what I'll be able to use in production. So any thoughts on what could be up with MySQL 5.7?
In reply to David Reagan

Re: Can't update OPL, Docker, testing, and future intenationalization of WeBWorK

by Nathan Wallach -
I posted a reply on GitHub about the issue.

It seems to be a difference in how mySQL is calculating the maximum number of bytes a key may have somewhat differently than MariaDB.