{"action":"created","issue":{"url":"https://api.github.com/repos/bendiken/lmdbxx/issues/2","labels_url":"https://api.github.com/repos/bendiken/lmdbxx/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/bendiken/lmdbxx/issues/2/comments","events_url":"https://api.github.com/repos/bendiken/lmdbxx/issues/2/events","html_url":"https://github.com/bendiken/lmdbxx/issues/2","id":99943938,"number":2,"title":"Example uses the same dbi instance with a different transaction","user":{"login":"varung","id":322258,"avatar_url":"https://avatars.githubusercontent.com/u/322258?v=3","gravatar_id":"","url":"https://api.github.com/users/varung","html_url":"https://github.com/varung","followers_url":"https://api.github.com/users/varung/followers","following_url":"https://api.github.com/users/varung/following{/other_user}","gists_url":"https://api.github.com/users/varung/gists{/gist_id}","starred_url":"https://api.github.com/users/varung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/varung/subscriptions","organizations_url":"https://api.github.com/users/varung/orgs","repos_url":"https://api.github.com/users/varung/repos","events_url":"https://api.github.com/users/varung/events{/privacy}","received_events_url":"https://api.github.com/users/varung/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/bendiken/lmdbxx/labels/help%20wanted","name":"help wanted","color":"159818"},{"url":"https://api.github.com/repos/bendiken/lmdbxx/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":{"login":"bendiken","id":4963,"avatar_url":"https://avatars.githubusercontent.com/u/4963?v=3","gravatar_id":"","url":"https://api.github.com/users/bendiken","html_url":"https://github.com/bendiken","followers_url":"https://api.github.com/users/bendiken/followers","following_url":"https://api.github.com/users/bendiken/following{/other_user}","gists_url":"https://api.github.com/users/bendiken/gists{/gist_id}","starred_url":"https://api.github.com/users/bendiken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bendiken/subscriptions","organizations_url":"https://api.github.com/users/bendiken/orgs","repos_url":"https://api.github.com/users/bendiken/repos","events_url":"https://api.github.com/users/bendiken/events{/privacy}","received_events_url":"https://api.github.com/users/bendiken/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2015-08-10T00:36:52Z","updated_at":"2015-08-11T04:16:10Z","closed_at":"2015-08-11T03:02:47Z","body":"In the example code provided in your Readme.MD, the second transaction uses the \"dbi\" instance that was opened using the first transaction:\r\n\r\n    auto dbi = lmdb::dbi::open(wtxn, nullptr);\r\n    ...\r\n    auto cursor = lmdb::cursor::open(rtxn, dbi);\r\n\r\nIs this recommended? Or should one open a new database for every transaction?\r\n"},"comment":{"url":"https://api.github.com/repos/bendiken/lmdbxx/issues/comments/129697252","html_url":"https://github.com/bendiken/lmdbxx/issues/2#issuecomment-129697252","issue_url":"https://api.github.com/repos/bendiken/lmdbxx/issues/2","id":129697252,"user":{"login":"varung","id":322258,"avatar_url":"https://avatars.githubusercontent.com/u/322258?v=3","gravatar_id":"","url":"https://api.github.com/users/varung","html_url":"https://github.com/varung","followers_url":"https://api.github.com/users/varung/followers","following_url":"https://api.github.com/users/varung/following{/other_user}","gists_url":"https://api.github.com/users/varung/gists{/gist_id}","starred_url":"https://api.github.com/users/varung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/varung/subscriptions","organizations_url":"https://api.github.com/users/varung/orgs","repos_url":"https://api.github.com/users/varung/repos","events_url":"https://api.github.com/users/varung/events{/privacy}","received_events_url":"https://api.github.com/users/varung/received_events","type":"User","site_admin":false},"created_at":"2015-08-11T04:16:10Z","updated_at":"2015-08-11T04:16:10Z","body":"It seems that the db handle outlives the transaction, iff it doesn't abort.\nIf it does abort, then the handle is closed. If I pass a closed handle to\nan operation with a new transaction, what would happen? Does the DB used\nwith a transaction get closed if any transaction that uses it aborts, or\njust the first one that created it?\n\nSorry to bother you: As a simpler interface, would it be reasonable to\nalways open the database again for every transaction I wish to perform? I\nunderstand I must create a lock around the \"open\" call, since it is not\nsupposed to be called by multiple transactions at the same time?\n\nWhat's the right way to use this library from a multithreaded program?\n\n\nOn Mon, Aug 10, 2015 at 8:02 PM, Arto Bendiken <notifications@github.com>\nwrote:\n\n> LMDB database handles outlive transactions; see upstream's documentation\n> for mdb_dbi_open()\n> <http://symas.com/mdb/doc/group__internal.html#gac08cad5b096925642ca359a6d6f0562a>\n> .\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/bendiken/lmdbxx/issues/2#issuecomment-129687173>.\n>\n"}}