{"action":"opened","issue":{"url":"https://api.github.com/repos/jankotek/mapdb/issues/664","labels_url":"https://api.github.com/repos/jankotek/mapdb/issues/664/labels{/name}","comments_url":"https://api.github.com/repos/jankotek/mapdb/issues/664/comments","events_url":"https://api.github.com/repos/jankotek/mapdb/issues/664/events","html_url":"https://github.com/jankotek/mapdb/issues/664","id":126066892,"number":664,"title":"Size() returns less than the actual number of items in the BTreeMap","user":{"login":"datumbox","id":5347466,"avatar_url":"https://avatars.githubusercontent.com/u/5347466?v=3","gravatar_id":"","url":"https://api.github.com/users/datumbox","html_url":"https://github.com/datumbox","followers_url":"https://api.github.com/users/datumbox/followers","following_url":"https://api.github.com/users/datumbox/following{/other_user}","gists_url":"https://api.github.com/users/datumbox/gists{/gist_id}","starred_url":"https://api.github.com/users/datumbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/datumbox/subscriptions","organizations_url":"https://api.github.com/users/datumbox/orgs","repos_url":"https://api.github.com/users/datumbox/repos","events_url":"https://api.github.com/users/datumbox/events{/privacy}","received_events_url":"https://api.github.com/users/datumbox/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-12T00:03:12Z","updated_at":"2016-01-12T00:03:12Z","closed_at":null,"body":"Hello,\r\n\r\nI will try to provide as much info as possive for a bug that affects the size() method of the BTreeMap and appears randomly about 1 every 10 times.\r\n\r\nThe problem is straight forward to explain: I put 50 items in the tree, the size reports 49 but when you list all of them or use an iterator you get 50 back. Here are some screenshots that show the problem:\r\nhttp://postimg.org/image/s7qnxmzl1/\r\nhttp://postimg.org/image/nxw4fxuyh/\r\nhttp://postimg.org/image/ir7jei5gr/\r\n\r\nHere is a screenshot of how the iterator looks like:\r\nhttp://postimg.org/image/8omth78x3/\r\n\r\nAs you can see in the above screenshot the lastReturnedKey was 49 which is the 50th item (indexing starts from 0) nevertheless again the reported size is 49.\r\n\r\nThe Map was populated using multiple threads. I am using version 1.0.8 and here are the options used on mapdb:\r\n```\r\nDBMaker m = DBMaker.newTempFileDB().deleteFilesAfterClose();\r\nm = m.transactionDisable();\r\nm = m.compressionEnable();\r\nm = m.cacheDisable();\r\nm = m.asyncWriteEnable();\r\nm = m.closeOnJvmShutdown();\r\nDB db = m.make();\r\nMap<Object,Object> tmp = db.createTreeMap(name)\r\n                .counterEnable()\r\n                .makeOrGet();\r\n```\r\n\r\nLet me know if I can provide any additional info to assist."}}