-
Notifications
You must be signed in to change notification settings - Fork 3
Using the DM Backend with MySQL
DM stores most of its data on the backend using a real RDF datastore, but there are a few things which are implemented as ORM models using a traditional relational database. Because the specified maximum length for URIs (which identify RDF resources) is 2000 characters, these models use VARCHAR(2000) fields to represent these URIs, and for obvious reasons, many of these fields are indexed. In order for MySQL to support this, you must set innodb_large_prefix to true. See https://dev.mysql.com/doc/refman/5.5/en/innodb-parameters.html#sysvar_innodb_large_prefix.
SET GLOBAL innodb_large_prefix = true;
SET GLOBAL innodb_file_format = 'barracuda';
SET GLOBAL innodb_file_per_table = true;You must also set the offending tables to use either ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED. In order to do this, you should run through each migration where a table is created, and then run
ALTER TABLE <table_name> ROW_FORMAT=<format>;At the time of writing, you could run migration 0001 (./manage.py syncdb && ./manage.py migrate semantic_store 0001), then run
ALTER TABLE semantic_store_projectpermission ROW_FORMAT=DYNAMIC;
ALTER TABLE semantic_store_text ROW_FORMAT=DYNAMIC;followed by a migration up to 0006 to achieve this (./manage.py migrate semantic_store). Essentially, this has to be done anytime a new table is created, but before the index is added, because there is no way using South or Django to specify the MySQL row format at the time of table creation.