Skip to content

WASM support for Multi-DB #221

Description

@blazeroni

It appears custom WASM endpoints do not have the additional databases attached when Trailbase initializes. I've done some experimenting and it seems that I'm able to have a dedicated WASM endpoint attach the database and all other requests can call queries referencing it, including to other WASM endpoints.

Since Trailbase appears to make internal HTTP requests for queries in WASM endpoints, I was concerned that it would only apply to a single connection and would randomly fail. Based on some basic testing it appears to apply to all requests, but I could just be getting the same connection each time. So, I made a second WASM endpoint that made repeated queries and made a script to hit that endpoint with simultaneous requests. The result was that all queries saw the attached database.

So, a few questions:

  • What is the intended way to use ATTACH DATABASE within custom WASM endpoints?
  • Is every request guaranteed to see the attached database after it's attached?
  • Since ATTACH DATABASE is connection local, is there only a single connection serving WASM endpoints or is the attachment being propagated somehow?
  • Can this be made simpler -- either automatically attach databases already linked in the UI, or allow this to be done during initialization and not require an initial request?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions