Re: Recovering badly closed file?

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Fri, 22 Jan 2010 10:53:07 -0600


Hi Brett,

Can you send me this file?

Cheers,
Philippe.

Brett Viren wrote:
> Hi again,
>
> Brett Viren <bv_at_bnl.gov> writes:
>
>
>> Using the same versions as was used to produce the file lets me
>> to a TTree::Scan() and it looks like the majority of the data is
>> recoverable!
>>
>
> Sorry, I spoke too soon.
>
> While I can recover the file "live" just after I open it when using the
> same code versions, I can not "save" this recovery by opening the file
> with "UPDATE" as indicated by TFile::Recover() documentation. Also, if
> I do an explicit call to Recover() on the file after it is opened with
> "UPDATE" I can not access the contents even in the immediate session.
>
> If worse comes to worse, I can write code to manually copy the contents
> into a new file but maybe there is a way this should "just work"?
>
> The following four sessions show the cases for with and without using
> the "UPDATE" option and with and without an implicit call to Recover().
>
>
> Implicit Recover(), no UPDATE works, but file is unmodified:
>
> ----------------------------------------------------------------------
> shell> loon
> loon [0] TFile* f = new TFile("B100112_080001.mbeam.tofix.root")
> loon [1] TTree* t = (TTree*)f->FindObjectAny("BeamMon")
> loon [2] t->Scan()
> ...
> ----------------------------------------------------------------------
>
> Explicit Recover(), no UPDATE works, but file is unmodified:
>
> ----------------------------------------------------------------------
> shell> loon
> loon [0] TFile* f = new TFile("B100112_080001.mbeam.tofix.root")
> loon [1] f->Recover()
> Info in <TFile::Recover>: B100112_080001.mbeam.tofix.root, recovered key TTree:BeamMon at address 167327993
> (Int_t)(1)
> loon [2] TTree* t = (TTree*)f->FindObjectAny("BeamMon")
> loon [3] t->Scan()
> ...
> ----------------------------------------------------------------------
>
> Implicit Recover, with UPDATE works, but file is unmodified:
>
> ----------------------------------------------------------------------
> shell> loon
> loon [0] TFile* f = new TFile("B100112_080001.mbeam.tofix.root","UPDATE")
> Warning in <TFile::Init>: file B100112_080001.mbeam.tofix.root probably not closed, cannot read free segments
> loon [1] TTree* t = (TTree*)f->FindObjectAny("BeamMon")
> loon [2] t->Scan()
> ...
> loon [3] f->Close()
> loon [4] delete f
>
> shell> md5sum B100112_080001.mbeam.{original,tofix}.root
> 27ea3c7e18d287eaaec13bd2357a924d B100112_080001.mbeam.original.root
> 27ea3c7e18d287eaaec13bd2357a924d B100112_080001.mbeam.tofix.root
> ----------------------------------------------------------------------
>
> Explicit Recover with UPDATE will update the file but the file becomes
> usable both immediately and if saved and (re)opened in a new session.
>
> ----------------------------------------------------------------------
> shell> loon
> loon [0] TFile* f = new TFile("B100112_080001.mbeam.tofix.root","UPDATE")
> Warning in <TFile::Init>: file B100112_080001.mbeam.tofix.root probably not closed, cannot read free segments
> loon [1] f->Recover()
> Info in <TFile::Recover>: B100112_080001.mbeam.tofix.root, recovered key TTree:BeamMon at address 167327993
> (Int_t)(1)
> loon [2] TTree* t = (TTree*)f->FindObjectAny("BeamMon")
> R__unzip: error in header
> loon [3] t->Scan()
> Error: illegal pointer to class object t 0x0 326 (tmpfile):1:
> *** Interpreter error recovered ***
> loon [4] f->Close()
> loon [5] delete f
>
> shell> md5sum B100112_080001.mbeam.{original,tofix}.root
> 27ea3c7e18d287eaaec13bd2357a924d B100112_080001.mbeam.original.root
> bbf601f6855c0f845b9fb36dd9fa3e08 B100112_080001.mbeam.tofix.root
>
> shell> loon
> loon [0] TFile* f = new TFile("B100112_080001.mbeam.tofix.root")
> loon [1] TTree* t = (TTree*)f->FindObjectAny("BeamMon")
> R__unzip: error in header
> loon [2] t->Scan()
> Error: illegal pointer to class object t 0x0 326 (tmpfile):1:
> ----------------------------------------------------------------------
>
>
> -Brett.
>
>
>
>
Received on Fri Jan 22 2010 - 17:53:12 CET

This archive was generated by hypermail 2.2.0 : Fri Jan 22 2010 - 23:50:01 CET