Everyday I store data to one shelve file . Today I discovered some last keys missing. The dat-file size is not changed. The dir file and the bak file contains all keys except some last keys. How can I recreate this files, or how can I rescan my dat file and restore all stored items?
I solved my problem by hex editor and hands. There is simple steps:
open dat file with hex editor.
open our dir file
find data offset. It should be 0. This is offset 1. Fig 1
find block of ten zero and find the offset at start of this block. This is offset 2. Fig 2
substract offset 1 from offset 2. In my case it be 71768182 - 0 = 71768182. This is data length.
We should write to dir file:
'1', (0, 71768182)
1 - key of this item in our db.
0 - offset of start datablock
71768182 - length of datablock;
Go to start of the new datablock. Fig 3