Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Dbi creation within transaction not supported #192

Copy link
Copy link
@fbiricotti

Description

@fbiricotti
Issue body actions

The APIs for creating a database (openDbi) don't take a transaction as input parameter (it's generated internally and immediately committed). This code works:

    Dbi<ByteBuffer> dbi = env.openDbi("TEST", new DbiFlags [] { DbiFlags.MDB_CREATE });
    Txn<ByteBuffer> txn = renv.txnWrite();
    dbi.put(txn, key, val);
    txn.commit();

This code DOES NOT:

    Txn<ByteBuffer> txn = repoEnv.txnWrite();
    Dbi<ByteBuffer> dbi = repoEnv.openDbi("TEST", new DbiFlags [] { DbiFlags.MDB_CREATE });
    dbi.put(txn, key, val);
    txn.commit();

by throwing this exception:

Exception in thread "main" org.lmdbjava.LmdbNativeException$ConstantDerivedException: Platform constant error code: EINVAL Invalid argument (22)
at org.lmdbjava.ResultCodeMapper.checkRc(ResultCodeMapper.java:114)
at org.lmdbjava.Dbi.put(Dbi.java:411)
at test.TestMain.main(TestMain.java:34)

This seems to be a blocking issue in a complex application where databases may be require to be created on-demand while a write transaction is already up and running. Or there is an alternative ? Please note that the native LMDB API for opening/creating a database do require a transaction., why not exposing it as parameter?

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.