Resolving Fedora Corrupted Thumbnail Issue

Fedora

Corrupted thumbnail

Symptom

Item cannot be opened. Fetching the MasterFile in Rails console returns:

Ldp::HttpError: STATUS: 500 org.modeshape.persistence.relational.RelationalProviderException: java.nio.charset.MalformedInputException: Input length = 1

Remedy

The following steps attempt to reverse engineer and modify DB blobs. They should be tested thoroughly on a non-production replica first.

Stop Tomcat/Fedora.

Find the Modeshape uuid for the MasterFile using its noid (eg 4q77fs77w)

select * from MODESHAPE_REPOSITORY where content like '%4q77fs77w%';

Look in the result and find the last uuid, fcf96b47505d64ecc9ea96-31cf-49c4-b4e3-f4b193723378 in this case 

| fcf96b47505d644a95ff85-b6ab-4bdb-a150-6d5f21c9cda0 | 2017-06-08 01:17:35 | h  metadata @   id 3   fcf96b47505d644a95ff85-b6ab-4bdb-a150-6d5f21c9cda0  content   key 3   fcf96b47505d644a95ff85-b6ab-4bdb-a150-6d5f21c9cda0 parent 3   fcf96b47505d64454d94d5-2fb7-48d9-8847-90a8b0d79f07 properties �   http://www.jcp.org/jcr/1.0 �   createdBy 
                                                                 bypassAdmin primaryType    $name 
   nt:folder  created .   $date    2017-06-08T01:17:35.518-04:00  mixinTypes P   0 H   $name 8   {http://fedora.info/definitions/v4/repository#}Pairtree     children ]   0 U   key 3   fcf96b47505d64ecc9ea96-31cf-49c4-b4e3-f4b193723378 name 
   4q77fs77w   childrenInfo    count              |

Dump the MasterFile row using this uuid

mysqldump -u mysql_user -h mysql_host -p fedora_db --skip-add-drop-table --no-create-info --where="id = 'fcf96b47505d64ecc9ea96-31cf-49c4-b4e3-f4b193723378'" MODESHAPE_REPOSITORY > masterfile.sql

Edit masterfile.sql using vim and delete everything after poster through thumbnail

\0\0\0poster\0\0^C1\0U\0\0\0^Bkey\03\0\0\0fcf96b47505d643edfc8a7-a84d-46a8-ae6f-38767eed38d3\0^Bname\0\n\0\0\0thumbnail\0\0\0^CchildrenInfo\0^T\

Drop the existing DB row

delete from MODESHAPE_REPOSITORY where id='fcf96b47505d64ecc9ea96-31cf-49c4-b4e3-f4b193723378';

Insert the updated row back

mysql -u mysql_user -h mysql_host -p fedora_db < masterfile.sql

Start Tomcat/Fedora.

Open the item in a web browser and recreate the thumbnail using the player's built-in function.