{"action":"closed","issue":{"url":"https://api.github.com/repos/clibs/lmdb/issues/1","labels_url":"https://api.github.com/repos/clibs/lmdb/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/clibs/lmdb/issues/1/comments","events_url":"https://api.github.com/repos/clibs/lmdb/issues/1/events","html_url":"https://github.com/clibs/lmdb/issues/1","id":106200614,"number":1,"title":"MDB_MAP_FULL error","user":{"login":"darshan-ghumare","id":10231034,"avatar_url":"https://avatars.githubusercontent.com/u/10231034?v=3","gravatar_id":"","url":"https://api.github.com/users/darshan-ghumare","html_url":"https://github.com/darshan-ghumare","followers_url":"https://api.github.com/users/darshan-ghumare/followers","following_url":"https://api.github.com/users/darshan-ghumare/following{/other_user}","gists_url":"https://api.github.com/users/darshan-ghumare/gists{/gist_id}","starred_url":"https://api.github.com/users/darshan-ghumare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darshan-ghumare/subscriptions","organizations_url":"https://api.github.com/users/darshan-ghumare/orgs","repos_url":"https://api.github.com/users/darshan-ghumare/repos","events_url":"https://api.github.com/users/darshan-ghumare/events{/privacy}","received_events_url":"https://api.github.com/users/darshan-ghumare/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-13T05:45:19Z","updated_at":"2015-09-17T03:48:19Z","closed_at":"2015-09-17T03:48:19Z","body":"HI All,\r\n\r\nI am getting following errors when running IOMeter for random writes with 4K block size,\r\n\r\nqemu-system-x86_64: Write at offset 38834094 failed, error MDB_MAP_FULL: Environment mapsize limit reached\r\n\r\nqemu-system-x86_64: Write at offset 38834094 failed, error MDB_MAP_FULL: Environment mapsize limit reached\r\n\r\nqemu-system-x86_64: Write at offset 38834094 failed, error MDB_MAP_FULL: Environment mapsize limit reached\r\n\r\nqemu-system-x86_64: Write at offset 38834094 failed, error MDB_MAP_FULL: Environment mapsize limit reached\r\n\r\nqemu-system-x86_64: Write at offset 38834094 failed, error MDB_MAP_FULL: Environment mapsize limit reached\r\n\r\nqemu-system-x86_64: Write at offset 38834094 failed, error MDB_MAP_FULL: Environment mapsize limit reached\r\n\r\nqemu-system-x86_64: Write at offset 38834094 failed, error MDB_MAP_FULL: Environment mapsize limit reached\r\n\r\nqemu-system-x86_64: Write at offset 38834094 failed, error MDB_MAP_FULL: Environment mapsize limit reached\r\n\r\nqemu-system-x86_64: Write at offset 38834094 failed, error MDB_MAP_FULL: Environment mapsize limit reached\r\n\r\nqemu-system-x86_64: Write at offset 4402334 failed, error MDB_MAP_FULL: Environment mapsize limit reached\r\n\r\nqemu-system-x86_64: Write at offset 4402334 failed, error MDB_MAP_FULL: Environment mapsize limit reached\r\n\r\nqemu-system-x86_64: Write at offset 4402334 failed, error MDB_MAP_FULL: Environment mapsize limit reached\r\n\r\nFollowing is my setup,\r\n    QEMU block driver which help me trap VM IOs. I am running IOMeter in VM.\r\n    This driver has 2 threads, one for write and other for read.\r\n    I have 16GB MMAP size, \r\nret = mdb_env_create(&s->env);\r\nif (ret != MDB_SUCCESS)\r\n{\r\n    error_setg_errno(errp, -EIO, \"error: Can't create environment for LMDB, error %s\\n\", mdb_strer\r\n    ret = -EIO;\r\n    goto out;\r\n}\r\nret = mdb_env_set_maxreaders(s->env, 1);\r\nif (ret != MDB_SUCCESS)\r\n{\r\n    error_setg_errno(errp, -EIO, \"error: Can't set max reader to 1, error %s\\n\", mdb_strerror(ret)\r\n    ret = -EIO;\r\n    goto out;\r\n}\r\nret = mdb_env_set_mapsize(s->env, MMAP_SIZE);\r\nif (ret != MDB_SUCCESS)\r\n{\r\n    error_setg_errno(errp, -EIO, \"error: Can't set mmap size, error %s\\n\", mdb_strerror(ret));\r\n    ret = -EIO;\r\n    goto out;\r\n}\r\nret = mdb_env_open(s->env, DBPath, MDB_FIXEDMAP | MDB_NOSYNC, 0664);\r\nif (ret != MDB_SUCCESS)\r\n{\r\n    error_setg_errno(errp, -EIO, \"error: Can't open db for given environment, error %s\\n\", mdb_strerror(ret));\r\n    ret = -EIO;\r\n    goto out;\r\n}\r\nret = mdb_dbi_open(txn, NULL, 0, &s->dbi);\r\nif (ret != MDB_SUCCESS)\r\n{\r\n    error_report(\"error: Can't open main db handle for given environment, error %s\\n\", mdb_strerror(ret));\r\n    ret = -EIO;\r\n    goto out;\r\n}\r\n\r\n       There is only one DBI shared between above thread (one DB, MAIN DB).\r\n       Read thread has one transaction (which reset then renew before using). \r\n       Write starts new transaction for each IO.\r\n\r\nMy observation,\r\nWhen DB size increases IOPS start dropping.\r\n   Ex. For 4K random writes I am getting 9.3K when DB size is ~0GB, after couple of minutes when size reaches 16GB its drop down to 1K (and keeps dropping) at the same time I starts getting MDB_MAP_FULL error.\r\n\r\nPlease help.\r\n\r\nThanks,\r\nDarshan"}}