Handle "File corrupted while reading record: null. Possible solution: use the recovery tool [90030-199]"

This happens on Lenses 5.x and before when H2 database is used to store the Lenses state. To recover from this corruption follow these steps:

  1. bash into the machine running Lenses
  2. stop lenses
supervisorctl stop lenses
  1. Download the H2 1.4.200 from Maven and store it to /tmp.

  2. Run this command

java -cp /tmp/h2-1.4.200.jar \
 org.h2.tools.Recover \ 
 -dir /data/lenses \ 
 -db lensesdb
  1. The previous command creates some files with the data to restore
java -cp /opt/lenses/lib/h2-1.4.199.jar \
  org.h2.tools.RunScript \
  -url jdbc:h2:/data/lenses/lenses_new \
  -script /data/lenses/lensesdb.h2.sql
  1. Replace the old file
rm /data/lenses/lenses.mv.db \ 
mv /data/lenses/lenses_new.mv.db /data/lenses/lensesdb.mv.db
  1. Restart lenses
supervisorctl start lenses
1 Like