Skip to content

[ntuple] Enable shared access to RNTupleFileWriter#21593

Merged
silverweed merged 2 commits into
root-project:masterfrom
silverweed:minifile_shared
Jun 23, 2026
Merged

[ntuple] Enable shared access to RNTupleFileWriter#21593
silverweed merged 2 commits into
root-project:masterfrom
silverweed:minifile_shared

Conversation

@silverweed

@silverweed silverweed commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

Allow for multiple RNTupleFileWriters to share a single underlying Simple file. This is required for attribute writing support in Minifile-backed RNTuples.
The idea is turning all shared properties of RImplSimple into a shared_ptr-accessed struct which is referenced by all clones of a Writer. Access is strictly single-threaded but that's enough for attribute writing.

@silverweed silverweed self-assigned this Mar 13, 2026
@github-actions

github-actions Bot commented Mar 13, 2026

Copy link
Copy Markdown

Test Results

    21 files      21 suites   3d 15h 40m 7s ⏱️
 3 868 tests  3 859 ✅   0 💤 9 ❌
72 644 runs  72 526 ✅ 109 💤 9 ❌

For more details on these failures, see this check.

Results for commit f7a7b61.

♻️ This comment has been updated with latest results.

@silverweed silverweed force-pushed the minifile_shared branch 2 times, most recently from 4df8bec to 0e31934 Compare March 17, 2026 10:26
@silverweed silverweed marked this pull request as ready for review March 18, 2026 09:55
@silverweed silverweed requested a review from jblomer as a code owner March 18, 2026 09:55
@silverweed silverweed requested review from enirolf and hahnjo March 18, 2026 09:55
@silverweed silverweed changed the title [do not merge] Enabling shared access to RMiniFileWriter [ntuple] Enable shared access to RMiniFileWriter Mar 18, 2026
@silverweed silverweed changed the title [ntuple] Enable shared access to RMiniFileWriter [ntuple] Enable shared access to RNTupleFileWriter Mar 18, 2026
@silverweed silverweed force-pushed the minifile_shared branch 2 times, most recently from 613f3e4 to f2c8fde Compare March 18, 2026 10:03

@jblomer jblomer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! Apologies for the huge reviewing delay!

Comment thread tree/ntuple/inc/ROOT/RMiniFile.hxx Outdated
Comment thread tree/ntuple/inc/ROOT/RMiniFile.hxx Outdated
@silverweed silverweed force-pushed the minifile_shared branch 2 times, most recently from ccdccdc to c7f4119 Compare June 16, 2026 07:49
@silverweed silverweed merged commit 6598334 into root-project:master Jun 23, 2026
52 of 58 checks passed
@silverweed silverweed deleted the minifile_shared branch June 23, 2026 07:02
Comment on lines 159 to 160
/// Whether the C file stream has been opened with Direct I/O, introducing alignment requirements.
bool fDirectIO = false;

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.

Sorry, didn't find the time before to look at this PR: what's the reason for leaving fDirectIO out? I think all clones must follow the same alignment procedure, or the offsets in the RSharedData might be wrong / inconsistent...

new RNTupleFileWriter(ntupleName, fNTupleAnchor.GetMaxKeySize(), /*hidden=*/true));
auto &clonedFile = std::get<RImplSimple>(writer->fFile);
clonedFile.fShared = file->fShared;
clonedFile.fDirectIO = file->fDirectIO;

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.

Ah, I see you are also copying fDirectIO here, so the code is correct. But wouldn't it be easier to move the member into the shared data?

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.

I believe I wasn't sure whether we would want/need fDirectIO to be necessarily the same for all clones; if that is the case I can make a small PR to move it in as well

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.

Yes, it must be the same for all clones that share the 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants