Skip to content

Load Arrow mapper libraries on registry lookup - #999

Open
arnavdham wants to merge 3 commits into
AIDASoft:masterfrom
arnavdham:feature/arrow-dynamic-loading
Open

Load Arrow mapper libraries on registry lookup#999
arnavdham wants to merge 3 commits into
AIDASoft:masterfrom
arnavdham:feature/arrow-dynamic-loading

Conversation

@arnavdham

Copy link
Copy Markdown
Contributor

Make Arrow mapper registration follow the same runtime-loading model as SIO.
The generated *Arrow libraries register Arrow types and converters through static initialization. This changes the Arrow type registry lookup to trigger the Arrow converter library loader, ensuring generated Arrow mapper libraries are loaded via dlopen() before registry lookups

BEGINRELEASENOTES

  • Arrow mapper libraries are now loaded at registry lookup time, avoiding reliance on linker side effects for converter/type registration.

ENDRELEASENOTES

Comment on lines +24 to +25
* Registration is expected to happen during shared library loading/startup,
* before worker threads query the registry. After registration the registry is

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.

A bit misleading, the loading happens lazily on getConverter/getReader calls, so users must not use those in multi-threaded context.

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.

But this initialization is thread safe. Once lazy loading is complete MT is completely fine.

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.

Right, so it does matter when lazy loading happens. Races can occur if several threads start up and simultaneously try to initialize reader.


for (auto& lib : fs::directory_iterator(dir)) {
const auto filename = lib.path().filename().string();
if (filename.find("Arrow") != std::string::npos && filename.find("libarrow") == std::string::npos) {

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.

Why can it be either one? libarrow must come from arrow-cpp, which libpodioArrow is meant to link against, so it gets loaded as a dependency.

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.

2 participants