Dear Charles,
Am 17.03.2012 22:59, schrieb Charles Duffy:
I have a BaseX database with a pin-* file in its directory, reporting as locked and unavailable. However, OS-level tools such as fuser report that no programs have open file handles for any processes in this directory.
the pin file is created the moment between finishing an updating query and persisting the updates in the Pending Update List to the database. It is deleted when the database files have been successfully updated.
If the pin file wasn't deleted, this is an indicator that a) there were read or write errors or b) the update operation was aborted, e.g. by Ctrl-C.
So the database should be considered corrupted.
Unfortunately there are no sophisticated recovery tools available for corrupted databases, but (assuming you don't have an up-to-date backup) you could try this:
- (make a backup of the database folder) - delete the pin file, it's the only corruption marker - issue an `OPTIMIZE ALL` command on the database
This tries to read the complete database into SAX-like events and build a new database from those. It should produce errors in most cases of corruption, but if it succeeds, you should still check manually.
Hope this helps, cheers, Leo