Print

Print


     Hi Ofer,

     By default the missing components of the path are not created (just 
for 'fopen(...)' or 'open(...)').
     However, you can force their creation in the following way:

         1. At file level, by adding the option 'mkpath=1' in the URL 
(e.g. 'root://theserver//new/path/file.root?mkpath=1')
         2. Globally using the setting

                   XNet.Mkpath: 1

             in the relevant .rootrc file ($HOME/.rootrc or 
$ROOTSYS/etc/system.rootrc or /etc/root/system.rootrc)

     When this option is set, TXNetFile sets the 'kXR_mkpath' bit in the 
option field when opening the file.
     Most likely xrdcp sets always this bit, which would explain the 
different behavior.

     Hope it helps.

     Gerri

On 10/06/2010 04:24 AM, Ofer Rind wrote:
> Hi all,
>
> Are there any known issues trying to create a new file using 
> TFile::Open() within ROOT when the parent directory has not been 
> created previously?  We seem to be unable to do this on the small 
> xrootd deployment we have here at BNL for the Daya Bay group.  With 
> xrdcp, the parent directories get created automatically.  Also, there 
> is no problem creating the new file from within ROOT if the parent 
> directories have been created previously on the selected storage 
> server.  Is this a server configuration issue, or possibly something 
> missing in ROOT?
>
> We are using ROOT v5.26/00b and xrd version 20091028-1003_dbg.  I have 
> attached a ROOT log executing
>
> TFile* file = TFile::Open(url,"RECREATE");
>
> when the url is pointing to a nonexisting directory.  The error we get is
>
> 101005 17:53:36 001 Xrd: ReadPartialAnswer: Server 
> [daya0002.rcf.bnl.gov:1094] answered [kXR_error] (4003)
> 101005 17:53:36 001 Xrd: CheckErrorStatus: Server 
> [daya0001.rcf.bnl.gov:1094] declared: Unable to create 
> /xrootd/bv/test/does-not-exist/file.root; No such file or 
> directory(error code: 3011)
> 101005 17:53:36 001 Xrd: Open: Error opening the file 
> /xrootd/bv/test/does-not-exist/file.root on host 
> daya0001.rcf.bnl.gov:1094
> Error in <TXNetFile::CreateXClient>: open attempt failed on 
> root://daya0001//xrootd/bv/test/does-not-exist/file.root
>
> I have also attached our xrootd.cf.  Any advice would be much 
> appreciated and sincere apologies if this has been discussed and 
> answered before.
>
> Thanks!
> Ofer Rind
>
> PS  This is the same problem discussed in 
> http://root.cern.ch/phpBB3//viewtopic.php?p=41410&sid=a528e02dc23a6c9a6697dd7fa78e3818  
> (the problem was not the server but rather the absence of the parent 
> directories).
>
>


-- 
+--------------------------------------------------------------------------+
   Gerardo GANIS    CERN, PH Dept, SFT group, CH 1211 Geneve 23
                    room: 32-RC-017, tel: +41 22 7676439
                    email: [log in to unmask], fax: +41 22 7669133
+--------------------------------------------------------------------------+