{"action":"created","issue":{"url":"https://api.github.com/repos/jankotek/MapDB/issues/97","labels_url":"https://api.github.com/repos/jankotek/MapDB/issues/97/labels{/name}","comments_url":"https://api.github.com/repos/jankotek/MapDB/issues/97/comments","events_url":"https://api.github.com/repos/jankotek/MapDB/issues/97/events","html_url":"https://github.com/jankotek/MapDB/issues/97","id":12602718,"number":97,"title":"BTreeMap online compaction","user":{"login":"jankotek","id":359021,"avatar_url":"https://avatars.githubusercontent.com/u/359021?v=3","gravatar_id":"","url":"https://api.github.com/users/jankotek","html_url":"https://github.com/jankotek","followers_url":"https://api.github.com/users/jankotek/followers","following_url":"https://api.github.com/users/jankotek/following{/other_user}","gists_url":"https://api.github.com/users/jankotek/gists{/gist_id}","starred_url":"https://api.github.com/users/jankotek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jankotek/subscriptions","organizations_url":"https://api.github.com/users/jankotek/orgs","repos_url":"https://api.github.com/users/jankotek/repos","events_url":"https://api.github.com/users/jankotek/events{/privacy}","received_events_url":"https://api.github.com/users/jankotek/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jankotek/MapDB/labels/2.0","name":"2.0","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2013-03-29T12:17:06Z","updated_at":"2015-04-21T06:38:48Z","closed_at":null,"body":"MapDB uses B-Linked-Tree described by Lehman and Yao. This is nearly lock-free concurrent structure. Trade-off is that empty tree nodes are not released after deletes. Instead empty nodes are left behind after delete. This may become problem for long-term use. \r\n\r\nCurrent workaround for this fragmentation is to recreate BTreeMap (create new, insert all data, replace original). However there is compaction algorithm which requires minimal locking and can work while tree is online. It is described here:\r\nhttp://www.doc.ic.ac.uk/~td202/\r\n\r\nMapDB should implement this compaction and make it optionally running on back-round thread."},"comment":{"url":"https://api.github.com/repos/jankotek/MapDB/issues/comments/94654365","html_url":"https://github.com/jankotek/MapDB/issues/97#issuecomment-94654365","issue_url":"https://api.github.com/repos/jankotek/MapDB/issues/97","id":94654365,"user":{"login":"freakolowsky","id":6906386,"avatar_url":"https://avatars.githubusercontent.com/u/6906386?v=3","gravatar_id":"","url":"https://api.github.com/users/freakolowsky","html_url":"https://github.com/freakolowsky","followers_url":"https://api.github.com/users/freakolowsky/followers","following_url":"https://api.github.com/users/freakolowsky/following{/other_user}","gists_url":"https://api.github.com/users/freakolowsky/gists{/gist_id}","starred_url":"https://api.github.com/users/freakolowsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freakolowsky/subscriptions","organizations_url":"https://api.github.com/users/freakolowsky/orgs","repos_url":"https://api.github.com/users/freakolowsky/repos","events_url":"https://api.github.com/users/freakolowsky/events{/privacy}","received_events_url":"https://api.github.com/users/freakolowsky/received_events","type":"User","site_admin":false},"created_at":"2015-04-21T06:38:48Z","updated_at":"2015-04-21T06:38:48Z","body":"That i understand.\r\n\r\nI could:\r\n- create a snapshot\r\n- clear my database\r\n- reinsert everything from snapshot\r\n\r\nBut i have a few other questions:\r\n- i'm using async writer, how do pause it and make sure it has no more pending operations, i can guarantee that no more new operations will be performed on the target database\r\n- iz a snaphsot a duplicate of a real database or is it a clone copy? does a snapshot retain same fragmentation as original. if it does not have the fragmentation as does the original, could i somehow replace original with the snapshot online?\r\n- how do i clear my database(or collection) so that it's really clear, as if it was just created"}}