Skip to content

[IO] Honor READ_WITHOUT_GLOBALREGISTRATION in TNetXNGFile#11321

Merged
eguiraud merged 3 commits intoroot-project:masterfrom
eguiraud:fix-no-globalregistration
Sep 8, 2022
Merged

[IO] Honor READ_WITHOUT_GLOBALREGISTRATION in TNetXNGFile#11321
eguiraud merged 3 commits intoroot-project:masterfrom
eguiraud:fix-no-globalregistration

Conversation

@eguiraud
Copy link
Copy Markdown
Contributor

@eguiraud eguiraud commented Sep 6, 2022

...as well as in TNetFile and TWebFile.
This fixes #10742.

@pcanal can you please suggest a test?

@eguiraud eguiraud requested a review from gganis as a code owner September 6, 2022 07:56
@eguiraud eguiraud self-assigned this Sep 6, 2022
@eguiraud eguiraud requested a review from pcanal as a code owner September 6, 2022 07:56
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu18.04/nortcxxmod, ROOT-ubuntu2004/python3, mac1015/cxx17, mac11/cxx14, windows10/cxx14
How to customize builds

TNetXNGFile::TNetXNGFile(const char *url, const char *lurl, Option_t *mode, const char *title, Int_t compress,
Int_t /*netopt*/, Bool_t parallelopen)
: TFile((lurl ? lurl : url),
strcmp(mode, "READ_WITHOUT_GLOBALREGISTRATION") == 0 ? "NET_WITHOUT_GLOBALREGISTRATION" : "NET", title,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
strcmp(mode, "READ_WITHOUT_GLOBALREGISTRATION") == 0 ? "NET_WITHOUT_GLOBALREGISTRATION" : "NET", title,
strstr(mode, "_WITHOUT_GLOBALREGISTRATION") != nullptr ? "NET_WITHOUT_GLOBALREGISTRATION" : "NET", title,

would allow to seamlessly support the other opening type.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what other opening type? NET_WITHOUT_GLOBALREGISTRATION is not available to client code, it's just for internal use (and it's not documented anywhere). the documented option is only READ_WITHOUT_GLOBALREGISTRATION. I think it's simpler this way? (also considering the behavior before this patch)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the change on line 364 and related, we now support (even if not documented yet) all combination of opening type and _WITHOUT_GLOBALREGISTRATION, including RECREATE_WITHOUT_GLOBALREGISTRATION, UPDATE_WITHOUT_GLOBALREGISTRATION etc. And I think this is a good thing (and should be documented of course :) ).
And without the proposed, change we keep at supporting 'only' READ_WITHOUT_GLOBALREGISTRATION for 'only' theNET/WEB case.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding support for RECREATE_WITHOUT_GLOBALREGISTRATION etc., adding documentation for them and the corresponding tests is beyond the scope of this PR. The intent is just to fix #10742 .

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But to be consistent, you would have to add code to explicitly reject the new supported mode; where as extending is 'simply' using the strstr and extending the doc which is currently bare:

204:/// READ_WITHOUT_GLOBALREGISTRATION   | Used by TTreeProcessorMT, not a user callable option.

and could simply be as bare:

204:/// [READ|NEW|UPDATE|RECREATE]_WITHOUT_GLOBALREGISTRATION   | Used by TTreeProcessorMT, not a user callable option.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eg. TTreeProcessorMT could use RECREATE_WITHOUT_GLOBALREGISTRATION for Snapshot output file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be consistent, you would have to add code to explicitly reject the new supported mode

That's not the behavior anywhere in TFile:

$ root -l
root [0] TFile::Open("f.root", "alskjdalksjd")
(TFile *) 0x559fa18d0200
root [1] TFile::Open("root://eospublic.cern.ch//eos/root-eos/cms_opendata_2012_nanoaod_skimmed/ZZTo4mu.root", "alsjalsjdalsdjka")
(TFile *) 0x555fc11ba680

I just picked up #10742 although it was not assigned to me because that specific issue is problematic for RDF. Adding new features to TFile that were not requested or discussed before can be done in a different PR, and it does not seem reasonable to me to request them from me in the context of a bug fix.

With that said, I applied your suggestion in the original comment so it will be easier to extend this in the future.

@pcanal
Copy link
Copy Markdown
Member

pcanal commented Sep 6, 2022

Using the file "http://root.cern.ch/files/h1/dstarmb.root" and (when xrootd in enabled) "root://eospublic.cern.ch//eos/root-eos/h1/dstarmb.root" maybe something like:

bool tester(const char *filename) {
   auto f = TFile::Open(filename, "READ_WITHOUT_GLOBALREGISTRATION");
   if (f && ! f->IsZombie() && nullptr == gROOT->GetListOfFiles()->FindObject(filename)) {
      delete f;
      return true;
   } else {
      // failure;
      return false;
  }
}

(possibly separating all 3 failures types).

@eguiraud eguiraud force-pushed the fix-no-globalregistration branch from 4dcae88 to a4630cc Compare September 7, 2022 08:52
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu18.04/nortcxxmod, ROOT-ubuntu2004/python3, mac1015/cxx17, mac11/cxx14, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-performance-centos8-multicore/cxx17.
Running on olbdw-01.cern.ch:/data/sftnight/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-ubuntu2004/python3.
Running on root-ubuntu-2004-1.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-ubuntu18.04/nortcxxmod.
Running on sft-ubuntu-1804-2.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-debian10-i386/soversion.
Running on pcepsft10.dyndns.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Build failed on mac11/cxx14.
Running on macphsft23.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Build failed on windows10/cxx14.
Running on null:C:\build\workspace\root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Build failed on mac1015/cxx17.
Running on macitois22.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@eguiraud
Copy link
Copy Markdown
Contributor Author

eguiraud commented Sep 7, 2022

The problem with the test is that on those platforms TDavixFile is used, while on my laptop TWebFile is used instead so I only applied the fix there. Now patching TDavixFile

@eguiraud eguiraud force-pushed the fix-no-globalregistration branch from a4630cc to a35c5c7 Compare September 7, 2022 15:45
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu18.04/nortcxxmod, ROOT-ubuntu2004/python3, mac1015/cxx17, mac11/cxx14, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-performance-centos8-multicore/cxx17.
Running on olbdw-01.cern.ch:/data/sftnight/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Build failed on windows10/cxx14.
Running on null:C:\build\workspace\root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Build failed on mac11/cxx14.
Running on macphsft23.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

It might work on more platforms.

Co-authored-by: Philippe Canal <[email protected]>
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu18.04/nortcxxmod, ROOT-ubuntu2004/python3, mac1015/cxx17, mac11/cxx14, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-performance-centos8-multicore/cxx17.
Running on olbdw-01.cern.ch:/data/sftnight/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Build failed on mac11/cxx14.
Running on macphsft20.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Build failed on windows10/cxx14.
Running on null:C:\build\workspace\root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Build failed on mac1015/cxx17.
Running on macitois21.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@pcanal
Copy link
Copy Markdown
Member

pcanal commented Sep 8, 2022

The failures are unrelated.

Copy link
Copy Markdown
Member

@pcanal pcanal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@eguiraud eguiraud merged commit 7150f6b into root-project:master Sep 8, 2022
@eguiraud eguiraud deleted the fix-no-globalregistration branch September 8, 2022 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

READ_WITHOUT_GLOBALREGISTRATION has no effect on remote files

3 participants