[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: mdb_dbi_open and threads



Sorry for the late reply.

I finally went with the solution Klaus Malorny stated. Storing all the data in in one big database named "main" and prep-ending a 4 byte int (database id or collection id) to the key.
These collection ids are stored in a seperate database named "collections".
And the query handler has been modified to take care of the "range" queries that corresponds to a logical database.

Thanks for all the response and suggestions.





On Mon, Jun 19, 2017 at 6:52 PM, Muhammed Muneer <elendilm@gmail.com> wrote:
I know. But that is not my problem.

On Mon, Jun 19, 2017 at 2:31 PM, Klaus Malorny <Klaus.Malorny@knipp.de> wrote:
On 6/19/17 10:31 AM, Muhammed Muneer wrote:
Sorry for the late reply, I was on vacation.

Klaus wrote:
"I am still unsure what you are trying to achieve. If you are in a read transaction and discover that your database does not exist, what can you do anyway? You cannot create the database at this point, since it is a write operation."

When I discover a dbi does not exist in a read transaction, I can assume it to be the same as a dbi which is empty and create it when and only when there is a write-request into that dbi later.



To my understanding, the API does not prevent you from doing so. As long as you do not specify the MDB_CREATE flag, you can call mdb_dbi_open and will get informed whether the database exists or not (MDB_NOTFOUND).

Klaus