Saturday, October 25, 2008

Unfsck your redland RDF.

Again, for those who are using the unpatched db4 redland backend, if you get issues where libferris apps just eat CPU and seem to hang, if your backtrace includes Ferris::RDF::RedlandIterator::__advance() calling librdf_iterator_next() then there is a fair chance your RDF db4 files are screwed. You can try to recover them with the below.... sorry about the long standing issue folks.

#!/bin/bash

cd ~/.ferris/rdfdb

for if in myrdf-po2s.db myrdf-so2p.db myrdf-sp2o.db
do
echo "Fixing: $if"
db_dump -r $if >| dump
rm -f $if
db_load -f dump $if
rm -f dump
done