{"action":"created","comment":{"url":"https://api.github.com/repos/cvmfs/cvmfs/pulls/comments/39742712","id":39742712,"diff_hunk":"@@ -58,16 +58,25 @@ class Statistics;\n }\n \n namespace catalog {\n+template <class CatalogMgrT>\n+class CatalogBalancer;\n+}\n+\n+namespace catalog {\n \n class WritableCatalogManager : public SimpleCatalogManager {\n  public:\n+  friend class CatalogBalancer<WritableCatalogManager>;\n   WritableCatalogManager(const shash::Any  &base_hash,\n                          const std::string &stratum0,\n                          const std::string &dir_temp,\n                          upload::Spooler   *spooler,\n                          download::DownloadManager *download_manager,\n                          uint64_t catalog_entry_warn_threshold,\n-                         perf::Statistics *statistics);\n+                         perf::Statistics *statistics,\n+                         bool is_balanceable,","path":"cvmfs/catalog_mgr_rw.h","position":21,"original_position":21,"commit_id":"6983757ee43f8e9cc92545dedef7324667a8ebc4","original_commit_id":"6983757ee43f8e9cc92545dedef7324667a8ebc4","user":{"login":"Moliholy","id":2722756,"avatar_url":"https://avatars.githubusercontent.com/u/2722756?v=3","gravatar_id":"","url":"https://api.github.com/users/Moliholy","html_url":"https://github.com/Moliholy","followers_url":"https://api.github.com/users/Moliholy/followers","following_url":"https://api.github.com/users/Moliholy/following{/other_user}","gists_url":"https://api.github.com/users/Moliholy/gists{/gist_id}","starred_url":"https://api.github.com/users/Moliholy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Moliholy/subscriptions","organizations_url":"https://api.github.com/users/Moliholy/orgs","repos_url":"https://api.github.com/users/Moliholy/repos","events_url":"https://api.github.com/users/Moliholy/events{/privacy}","received_events_url":"https://api.github.com/users/Moliholy/received_events","type":"User","site_admin":false},"body":"Renamed the parameter to make it more understandable","created_at":"2015-09-17T13:12:32Z","updated_at":"2015-09-17T13:12:32Z","html_url":"https://github.com/cvmfs/cvmfs/pull/1091#discussion_r39742712","pull_request_url":"https://api.github.com/repos/cvmfs/cvmfs/pulls/1091","_links":{"self":{"href":"https://api.github.com/repos/cvmfs/cvmfs/pulls/comments/39742712"},"html":{"href":"https://github.com/cvmfs/cvmfs/pull/1091#discussion_r39742712"},"pull_request":{"href":"https://api.github.com/repos/cvmfs/cvmfs/pulls/1091"}}},"pull_request":{"url":"https://api.github.com/repos/cvmfs/cvmfs/pulls/1091","id":44361196,"html_url":"https://github.com/cvmfs/cvmfs/pull/1091","diff_url":"https://github.com/cvmfs/cvmfs/pull/1091.diff","patch_url":"https://github.com/cvmfs/cvmfs/pull/1091.patch","issue_url":"https://api.github.com/repos/cvmfs/cvmfs/issues/1091","number":1091,"state":"open","locked":false,"title":"Catalog balancer feature","user":{"login":"Moliholy","id":2722756,"avatar_url":"https://avatars.githubusercontent.com/u/2722756?v=3","gravatar_id":"","url":"https://api.github.com/users/Moliholy","html_url":"https://github.com/Moliholy","followers_url":"https://api.github.com/users/Moliholy/followers","following_url":"https://api.github.com/users/Moliholy/following{/other_user}","gists_url":"https://api.github.com/users/Moliholy/gists{/gist_id}","starred_url":"https://api.github.com/users/Moliholy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Moliholy/subscriptions","organizations_url":"https://api.github.com/users/Moliholy/orgs","repos_url":"https://api.github.com/users/Moliholy/repos","events_url":"https://api.github.com/users/Moliholy/events{/privacy}","received_events_url":"https://api.github.com/users/Moliholy/received_events","type":"User","site_admin":false},"body":"This new feature allows the WritableCatalogManager to (if configured to do so), rebalance those catalogs that have more/less entries than a maximum/minimum threshold in an optimal way.\r\nIt has been introduced right before the actual publishing operation occurs, and it creates the corresponding \".cvmfscatalog\" files plus the new \".cvmfsautocatalog\" files.\r\n\r\nIf a catalog is autogenerated (from now on they will be called \"autocatalogs\") then it can be removed if necessary. The same way every catalog can be automatically rebalanced according to the provided parameters. However, a catalog that has been manually created by the user will never be deleted, including those included in the .cvmfsdirtab.\r\n\r\nThese already mentioned parameters can be specified in the server configuration file, being CVMFS_AUTOCATALOG the only mandatory one, and false by default. The two others will be CVMFS_AUTOCATALOG_MAX_WEIGHT for the overflow threshold, and CVMFS_AUTOCATALOG_MIN_WEIGHT for the underflow threshold.\r\n\r\nNew unit test and integration test have been added for this new feature.\r\n\r\nThis pull request uses https://github.com/cvmfs/cvmfs/pull/1057 and https://github.com/cvmfs/cvmfs/pull/1058 as starting point.","created_at":"2015-09-07T14:36:27Z","updated_at":"2015-09-17T13:12:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"08f37a916db36dfd5b4abf6bff164f49616a5f31","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cvmfs/cvmfs/pulls/1091/commits","review_comments_url":"https://api.github.com/repos/cvmfs/cvmfs/pulls/1091/comments","review_comment_url":"https://api.github.com/repos/cvmfs/cvmfs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cvmfs/cvmfs/issues/1091/comments","statuses_url":"https://api.github.com/repos/cvmfs/cvmfs/statuses/6983757ee43f8e9cc92545dedef7324667a8ebc4","head":{"label":"Moliholy:catalog-balancer","ref":"catalog-balancer","sha":"6983757ee43f8e9cc92545dedef7324667a8ebc4","user":{"login":"Moliholy","id":2722756,"avatar_url":"https://avatars.githubusercontent.com/u/2722756?v=3","gravatar_id":"","url":"https://api.github.com/users/Moliholy","html_url":"https://github.com/Moliholy","followers_url":"https://api.github.com/users/Moliholy/followers","following_url":"https://api.github.com/users/Moliholy/following{/other_user}","gists_url":"https://api.github.com/users/Moliholy/gists{/gist_id}","starred_url":"https://api.github.com/users/Moliholy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Moliholy/subscriptions","organizations_url":"https://api.github.com/users/Moliholy/orgs","repos_url":"https://api.github.com/users/Moliholy/repos","events_url":"https://api.github.com/users/Moliholy/events{/privacy}","received_events_url":"https://api.github.com/users/Moliholy/received_events","type":"User","site_admin":false},"repo":{"id":32462131,"name":"cvmfs","full_name":"Moliholy/cvmfs","owner":{"login":"Moliholy","id":2722756,"avatar_url":"https://avatars.githubusercontent.com/u/2722756?v=3","gravatar_id":"","url":"https://api.github.com/users/Moliholy","html_url":"https://github.com/Moliholy","followers_url":"https://api.github.com/users/Moliholy/followers","following_url":"https://api.github.com/users/Moliholy/following{/other_user}","gists_url":"https://api.github.com/users/Moliholy/gists{/gist_id}","starred_url":"https://api.github.com/users/Moliholy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Moliholy/subscriptions","organizations_url":"https://api.github.com/users/Moliholy/orgs","repos_url":"https://api.github.com/users/Moliholy/repos","events_url":"https://api.github.com/users/Moliholy/events{/privacy}","received_events_url":"https://api.github.com/users/Moliholy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Moliholy/cvmfs","description":"The CernVM File System","fork":true,"url":"https://api.github.com/repos/Moliholy/cvmfs","forks_url":"https://api.github.com/repos/Moliholy/cvmfs/forks","keys_url":"https://api.github.com/repos/Moliholy/cvmfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Moliholy/cvmfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Moliholy/cvmfs/teams","hooks_url":"https://api.github.com/repos/Moliholy/cvmfs/hooks","issue_events_url":"https://api.github.com/repos/Moliholy/cvmfs/issues/events{/number}","events_url":"https://api.github.com/repos/Moliholy/cvmfs/events","assignees_url":"https://api.github.com/repos/Moliholy/cvmfs/assignees{/user}","branches_url":"https://api.github.com/repos/Moliholy/cvmfs/branches{/branch}","tags_url":"https://api.github.com/repos/Moliholy/cvmfs/tags","blobs_url":"https://api.github.com/repos/Moliholy/cvmfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Moliholy/cvmfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Moliholy/cvmfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/Moliholy/cvmfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Moliholy/cvmfs/statuses/{sha}","languages_url":"https://api.github.com/repos/Moliholy/cvmfs/languages","stargazers_url":"https://api.github.com/repos/Moliholy/cvmfs/stargazers","contributors_url":"https://api.github.com/repos/Moliholy/cvmfs/contributors","subscribers_url":"https://api.github.com/repos/Moliholy/cvmfs/subscribers","subscription_url":"https://api.github.com/repos/Moliholy/cvmfs/subscription","commits_url":"https://api.github.com/repos/Moliholy/cvmfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/Moliholy/cvmfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/Moliholy/cvmfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/Moliholy/cvmfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/Moliholy/cvmfs/contents/{+path}","compare_url":"https://api.github.com/repos/Moliholy/cvmfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Moliholy/cvmfs/merges","archive_url":"https://api.github.com/repos/Moliholy/cvmfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Moliholy/cvmfs/downloads","issues_url":"https://api.github.com/repos/Moliholy/cvmfs/issues{/number}","pulls_url":"https://api.github.com/repos/Moliholy/cvmfs/pulls{/number}","milestones_url":"https://api.github.com/repos/Moliholy/cvmfs/milestones{/number}","notifications_url":"https://api.github.com/repos/Moliholy/cvmfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Moliholy/cvmfs/labels{/name}","releases_url":"https://api.github.com/repos/Moliholy/cvmfs/releases{/id}","created_at":"2015-03-18T14:00:48Z","updated_at":"2015-05-07T13:17:12Z","pushed_at":"2015-09-17T12:19:16Z","git_url":"git://github.com/Moliholy/cvmfs.git","ssh_url":"git@github.com:Moliholy/cvmfs.git","clone_url":"https://github.com/Moliholy/cvmfs.git","svn_url":"https://github.com/Moliholy/cvmfs","homepage":"http://cernvm.cern.ch/portal/filesystem","size":91543,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"devel"}},"base":{"label":"cvmfs:devel","ref":"devel","sha":"0bf4ec19883434ef2561f1d44c5f2d71f9e73398","user":{"login":"cvmfs","id":1560859,"avatar_url":"https://avatars.githubusercontent.com/u/1560859?v=3","gravatar_id":"","url":"https://api.github.com/users/cvmfs","html_url":"https://github.com/cvmfs","followers_url":"https://api.github.com/users/cvmfs/followers","following_url":"https://api.github.com/users/cvmfs/following{/other_user}","gists_url":"https://api.github.com/users/cvmfs/gists{/gist_id}","starred_url":"https://api.github.com/users/cvmfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvmfs/subscriptions","organizations_url":"https://api.github.com/users/cvmfs/orgs","repos_url":"https://api.github.com/users/cvmfs/repos","events_url":"https://api.github.com/users/cvmfs/events{/privacy}","received_events_url":"https://api.github.com/users/cvmfs/received_events","type":"Organization","site_admin":false},"repo":{"id":3784908,"name":"cvmfs","full_name":"cvmfs/cvmfs","owner":{"login":"cvmfs","id":1560859,"avatar_url":"https://avatars.githubusercontent.com/u/1560859?v=3","gravatar_id":"","url":"https://api.github.com/users/cvmfs","html_url":"https://github.com/cvmfs","followers_url":"https://api.github.com/users/cvmfs/followers","following_url":"https://api.github.com/users/cvmfs/following{/other_user}","gists_url":"https://api.github.com/users/cvmfs/gists{/gist_id}","starred_url":"https://api.github.com/users/cvmfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvmfs/subscriptions","organizations_url":"https://api.github.com/users/cvmfs/orgs","repos_url":"https://api.github.com/users/cvmfs/repos","events_url":"https://api.github.com/users/cvmfs/events{/privacy}","received_events_url":"https://api.github.com/users/cvmfs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cvmfs/cvmfs","description":"The CernVM File System","fork":false,"url":"https://api.github.com/repos/cvmfs/cvmfs","forks_url":"https://api.github.com/repos/cvmfs/cvmfs/forks","keys_url":"https://api.github.com/repos/cvmfs/cvmfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cvmfs/cvmfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cvmfs/cvmfs/teams","hooks_url":"https://api.github.com/repos/cvmfs/cvmfs/hooks","issue_events_url":"https://api.github.com/repos/cvmfs/cvmfs/issues/events{/number}","events_url":"https://api.github.com/repos/cvmfs/cvmfs/events","assignees_url":"https://api.github.com/repos/cvmfs/cvmfs/assignees{/user}","branches_url":"https://api.github.com/repos/cvmfs/cvmfs/branches{/branch}","tags_url":"https://api.github.com/repos/cvmfs/cvmfs/tags","blobs_url":"https://api.github.com/repos/cvmfs/cvmfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cvmfs/cvmfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cvmfs/cvmfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/cvmfs/cvmfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cvmfs/cvmfs/statuses/{sha}","languages_url":"https://api.github.com/repos/cvmfs/cvmfs/languages","stargazers_url":"https://api.github.com/repos/cvmfs/cvmfs/stargazers","contributors_url":"https://api.github.com/repos/cvmfs/cvmfs/contributors","subscribers_url":"https://api.github.com/repos/cvmfs/cvmfs/subscribers","subscription_url":"https://api.github.com/repos/cvmfs/cvmfs/subscription","commits_url":"https://api.github.com/repos/cvmfs/cvmfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/cvmfs/cvmfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/cvmfs/cvmfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/cvmfs/cvmfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/cvmfs/cvmfs/contents/{+path}","compare_url":"https://api.github.com/repos/cvmfs/cvmfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cvmfs/cvmfs/merges","archive_url":"https://api.github.com/repos/cvmfs/cvmfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cvmfs/cvmfs/downloads","issues_url":"https://api.github.com/repos/cvmfs/cvmfs/issues{/number}","pulls_url":"https://api.github.com/repos/cvmfs/cvmfs/pulls{/number}","milestones_url":"https://api.github.com/repos/cvmfs/cvmfs/milestones{/number}","notifications_url":"https://api.github.com/repos/cvmfs/cvmfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cvmfs/cvmfs/labels{/name}","releases_url":"https://api.github.com/repos/cvmfs/cvmfs/releases{/id}","created_at":"2012-03-21T09:10:41Z","updated_at":"2015-08-21T09:25:14Z","pushed_at":"2015-09-17T13:09:56Z","git_url":"git://github.com/cvmfs/cvmfs.git","ssh_url":"git@github.com:cvmfs/cvmfs.git","clone_url":"https://github.com/cvmfs/cvmfs.git","svn_url":"https://github.com/cvmfs/cvmfs","homepage":"http://cernvm.cern.ch/portal/filesystem","size":98666,"stargazers_count":38,"watchers_count":38,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":42,"mirror_url":null,"open_issues_count":8,"forks":42,"open_issues":8,"watchers":38,"default_branch":"devel"}},"_links":{"self":{"href":"https://api.github.com/repos/cvmfs/cvmfs/pulls/1091"},"html":{"href":"https://github.com/cvmfs/cvmfs/pull/1091"},"issue":{"href":"https://api.github.com/repos/cvmfs/cvmfs/issues/1091"},"comments":{"href":"https://api.github.com/repos/cvmfs/cvmfs/issues/1091/comments"},"review_comments":{"href":"https://api.github.com/repos/cvmfs/cvmfs/pulls/1091/comments"},"review_comment":{"href":"https://api.github.com/repos/cvmfs/cvmfs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cvmfs/cvmfs/pulls/1091/commits"},"statuses":{"href":"https://api.github.com/repos/cvmfs/cvmfs/statuses/6983757ee43f8e9cc92545dedef7324667a8ebc4"}}}}