Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedded SQL example outdated and missing MultiDBHandler implementation #2047

Open
HoneyBBQ opened this issue Feb 18, 2025 · 2 comments
Open
Labels
bug Something isn't working

Comments

@HoneyBBQ
Copy link

What happened

The embedded SQL example in the official documentation (https://docs.immudb.io/1.9.5/embedded/embeddingSQL.html) is outdated and doesn't work with immudb v1.9.5. When trying to run the example, I encountered two errors:

  1. illegal state: multi-indexing must be enabled
  2. illegal state: unspecified multidbHanlder

After fixing the first error by enabling multi-indexing:
store.Open("data", store.DefaultOptions().WithMultiIndexing(true))

I found that the SQL engine requires a MultiDBHandler implementation, but:

  1. There's no public implementation of the MultiDBHandler interface in the sql package
  2. No guidance in the documentation about how to implement or use it
  3. The example code doesn't mention this requirement at all

What you expected to happen

  1. The example code in the documentation should work as-is with the current version
  2. If MultiDBHandler is required, the documentation should:
    • Explain this requirement
    • Provide a basic implementation example or point to one
    • Explain when and why it's needed

How to reproduce it (as minimally and precisely as possible)

  1. Create a new Go project
  2. Copy the example code from the documentation
  3. Run the code:

Environment
shell
go1.23.6 darwin/arm64
immudb v1.9.5

@HoneyBBQ HoneyBBQ added the bug Something isn't working label Feb 18, 2025
@ostafen
Copy link
Collaborator

ostafen commented Feb 20, 2025

Hi, @HoneyBBQ, thanks for reporting the issue.

The MultiDBHandler should not be required for running the embedded sql engine, unless you are using operations that require explicit support for multiple database operations.

Can you also report exactly the query/operation that is causing the error to be triggered?

@HoneyBBQ
Copy link
Author

Thank you for your response!

First, I apologize if I misunderstood the MultiDBHandler concept. I was following the official documentation example step by step, and let me detail the issues I encountered:

  1. When I first ran the example code from the documentation directly, I encountered the first error:
    illegal state: multi-indexing must be enabled

  2. By examining the methods in store.ImmuStore, I found the solution - enabling multi-indexing when creating the store:
    st, err := store.Open("data", store.DefaultOptions().WithMultiIndexing(true))

  3. After resolving the first error, I encountered the second one:
    illegal state: unspecified multidbHanlder

While I found the WithMultiDBHandler interface in the SQL configuration, I couldn't find any public implementation of this interface to use.

This error occurred when executing the CREATE DATABASE db1 statement.

If possible, it would be helpful to add this information to the documentation to help other new users get started with immudb more smoothly. Thank you again for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants