TFile recovery does not appear to be working

Hello,
This message concerns a TFile that was generated with root version 5.22/00 and read with the same version of root - reading and writing on win32 platform.

I have a large (26 GB) TFile that was not closed properly and produces the following errors when I open it:

[quote]root [1] TFile *f = new TFile(“y:/hitdata/0041/r41_131471-repaired.rraw”,“UPDATE”)
Warning in TFile::Init: file y:/hitdata/0041/r41_131471-repaired.rraw probably not closed, cannot read free segments
Warning in TFile::Init: file y:/hitdata/0041/r41_131471-repaired.rraw probably not closed, trying to recover
Info in TFile::Recover: y:/hitdata/0041/r41_131471-repaired.rraw, recovered key CDetectorCal:CDetectorCal at address 268
Info in TFile::Recover: y:/hitdata/0041/r41_131471-repaired.rraw, recovered key CPromptIfb:CPromptIfb at address 453271
Info in TFile::Recover: y:/hitdata/0041/r41_131471-repaired.rraw, recovered key CVoltage:CVoltage at address 457729
Info in TFile::Recover: y:/hitdata/0041/r41_131471-repaired.rraw, recovered key CBowl:CBowl at address 465605
Info in TFile::Recover: y:/hitdata/0041/r41_131471-repaired.rraw, recovered key CCalibMass:CCalibMass at address 481348[/quote]

After a long wait (network, old computer) the output continues with the following lines:

[quote]Info in TFile::Recover: y:/hitdata/0041/r41_131471-repaired.rraw, recovered key CRunHeader:CRunHeader at address 26009098197
Info in TFile::Recover: y:/hitdata/0041/r41_131471-repaired.rraw, recovered key TObjArray:CPeakRatioArray at address 26009099151
Info in TFile::Recover: y:/hitdata/0041/r41_131471-repaired.rraw, recovered key TTree:nt at address 26024055416
Warning in TFile::Init: successfully recovered 8 keys[/quote]

If I then use .ls to see what’s in the file, I see all the object I was expecting:

[quote]root [2] .ls
TFile** y:/hitdata/0041/r41_131471-repaired.rraw raw data
TFile* y:/hitdata/0041/r41_131471-repaired.rraw raw data
KEY: CDetectorCal CDetectorCal;1
KEY: CPromptIfb CPromptIfb;1
KEY: CVoltage CVoltage;1
KEY: CBowl CBowl;1
KEY: CCalibMass CCalibMass;1
KEY: CRunHeader CRunHeader;2549 R41_131471 LO-081313CamMad817NiCr_1:M-7 08-20-2013
KEY: TObjArray CPeakRatioArray;1 An array of objects
KEY: TTree nt;1640 Leap raw data[/quote]

The problem is, when I delete the TFile object and try to read a second time, I get the same TFile::Recover messages and the long wait all over again. Is there anything I need to do the TFile object other than open in UPDATE mode and delete the object? I have also tried TFile::Write() and TTree::AutoSave(“SaveSelf”) for the TTree that’s in the file.

Thank you
Ed

Hi,

Opening the file in update mode and calling TFile::Write on it after the recovery should have solved the problem.

Cheers,
Philippe.