{"action":"created","comment":{"url":"https://api.github.com/repos/baidu/bfs/pulls/comments/80399588","id":80399588,"diff_hunk":"@@ -627,15 +627,18 @@ void ChunkServerManager::LogStats() {\n     int32_t w_qps = 0, r_qps = 0;\n     int64_t w_speed = 0, r_speed = 0, recover_speed = 0;\n     int32_t overload = 0;\n-    for (ServerMap::iterator it = chunkservers_.begin(); it != chunkservers_.end(); ++it) {\n-        ChunkServerInfo* cs = it->second;\n-        w_qps += cs->w_qps();\n-        w_speed += cs->w_speed();\n-        r_qps += cs->r_qps();\n-        r_speed += cs->r_speed();\n-        recover_speed += cs->recover_speed();\n-        if (cs->load() > kChunkServerLoadMax) {\n-            ++overload;\n+    {\n+        MutexLock lock(&mu_);\n+        for (ServerMap::iterator it = chunkservers_.begin(); it != chunkservers_.end(); ++it) {\n+            ChunkServerInfo* cs = it->second;\n+            w_qps += cs->w_qps();\n+            w_speed += cs->w_speed();\n+            r_qps += cs->r_qps();\n+            r_speed += cs->r_speed();\n+            recover_speed += cs->recover_speed();\n+            if (cs->load() > kChunkServerLoadMax) {\n+                ++overload;\n+            }\n         }\n     }\n     stats_.w_qps = w_qps;","path":"src/nameserver/chunkserver_manager.cc","position":27,"original_position":27,"commit_id":"305ef6e7043ac8dfa3aa72501b13e8c65e682ab6","original_commit_id":"305ef6e7043ac8dfa3aa72501b13e8c65e682ab6","user":{"login":"yvxiang","id":1382038,"avatar_url":"https://avatars.githubusercontent.com/u/1382038?v=3","gravatar_id":"","url":"https://api.github.com/users/yvxiang","html_url":"https://github.com/yvxiang","followers_url":"https://api.github.com/users/yvxiang/followers","following_url":"https://api.github.com/users/yvxiang/following{/other_user}","gists_url":"https://api.github.com/users/yvxiang/gists{/gist_id}","starred_url":"https://api.github.com/users/yvxiang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yvxiang/subscriptions","organizations_url":"https://api.github.com/users/yvxiang/orgs","repos_url":"https://api.github.com/users/yvxiang/repos","events_url":"https://api.github.com/users/yvxiang/events{/privacy}","received_events_url":"https://api.github.com/users/yvxiang/received_events","type":"User","site_admin":false},"body":"上面有必要，下面感觉可以不加","created_at":"2016-09-26T02:01:53Z","updated_at":"2016-09-26T02:01:53Z","html_url":"https://github.com/baidu/bfs/pull/490#discussion_r80399588","pull_request_url":"https://api.github.com/repos/baidu/bfs/pulls/490","_links":{"self":{"href":"https://api.github.com/repos/baidu/bfs/pulls/comments/80399588"},"html":{"href":"https://github.com/baidu/bfs/pull/490#discussion_r80399588"},"pull_request":{"href":"https://api.github.com/repos/baidu/bfs/pulls/490"}}},"pull_request":{"url":"https://api.github.com/repos/baidu/bfs/pulls/490","id":86643210,"html_url":"https://github.com/baidu/bfs/pull/490","diff_url":"https://github.com/baidu/bfs/pull/490.diff","patch_url":"https://github.com/baidu/bfs/pull/490.patch","issue_url":"https://api.github.com/repos/baidu/bfs/issues/490","number":490,"state":"open","locked":false,"title":"Add lock","user":{"login":"yvxiang","id":1382038,"avatar_url":"https://avatars.githubusercontent.com/u/1382038?v=3","gravatar_id":"","url":"https://api.github.com/users/yvxiang","html_url":"https://github.com/yvxiang","followers_url":"https://api.github.com/users/yvxiang/followers","following_url":"https://api.github.com/users/yvxiang/following{/other_user}","gists_url":"https://api.github.com/users/yvxiang/gists{/gist_id}","starred_url":"https://api.github.com/users/yvxiang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yvxiang/subscriptions","organizations_url":"https://api.github.com/users/yvxiang/orgs","repos_url":"https://api.github.com/users/yvxiang/repos","events_url":"https://api.github.com/users/yvxiang/events{/privacy}","received_events_url":"https://api.github.com/users/yvxiang/received_events","type":"User","site_admin":false},"body":"这个一秒一次，不知道会不会有点费","created_at":"2016-09-25T07:57:19Z","updated_at":"2016-09-26T02:01:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"404db752e32095aaa038ac844ffce9e3b0a051d3","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/baidu/bfs/pulls/490/commits","review_comments_url":"https://api.github.com/repos/baidu/bfs/pulls/490/comments","review_comment_url":"https://api.github.com/repos/baidu/bfs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/baidu/bfs/issues/490/comments","statuses_url":"https://api.github.com/repos/baidu/bfs/statuses/305ef6e7043ac8dfa3aa72501b13e8c65e682ab6","head":{"label":"yvxiang:lock","ref":"lock","sha":"305ef6e7043ac8dfa3aa72501b13e8c65e682ab6","user":{"login":"yvxiang","id":1382038,"avatar_url":"https://avatars.githubusercontent.com/u/1382038?v=3","gravatar_id":"","url":"https://api.github.com/users/yvxiang","html_url":"https://github.com/yvxiang","followers_url":"https://api.github.com/users/yvxiang/followers","following_url":"https://api.github.com/users/yvxiang/following{/other_user}","gists_url":"https://api.github.com/users/yvxiang/gists{/gist_id}","starred_url":"https://api.github.com/users/yvxiang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yvxiang/subscriptions","organizations_url":"https://api.github.com/users/yvxiang/orgs","repos_url":"https://api.github.com/users/yvxiang/repos","events_url":"https://api.github.com/users/yvxiang/events{/privacy}","received_events_url":"https://api.github.com/users/yvxiang/received_events","type":"User","site_admin":false},"repo":{"id":32985190,"name":"dfs","full_name":"yvxiang/dfs","owner":{"login":"yvxiang","id":1382038,"avatar_url":"https://avatars.githubusercontent.com/u/1382038?v=3","gravatar_id":"","url":"https://api.github.com/users/yvxiang","html_url":"https://github.com/yvxiang","followers_url":"https://api.github.com/users/yvxiang/followers","following_url":"https://api.github.com/users/yvxiang/following{/other_user}","gists_url":"https://api.github.com/users/yvxiang/gists{/gist_id}","starred_url":"https://api.github.com/users/yvxiang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yvxiang/subscriptions","organizations_url":"https://api.github.com/users/yvxiang/orgs","repos_url":"https://api.github.com/users/yvxiang/repos","events_url":"https://api.github.com/users/yvxiang/events{/privacy}","received_events_url":"https://api.github.com/users/yvxiang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yvxiang/dfs","description":"突然想写个分布式文件系统~","fork":true,"url":"https://api.github.com/repos/yvxiang/dfs","forks_url":"https://api.github.com/repos/yvxiang/dfs/forks","keys_url":"https://api.github.com/repos/yvxiang/dfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yvxiang/dfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yvxiang/dfs/teams","hooks_url":"https://api.github.com/repos/yvxiang/dfs/hooks","issue_events_url":"https://api.github.com/repos/yvxiang/dfs/issues/events{/number}","events_url":"https://api.github.com/repos/yvxiang/dfs/events","assignees_url":"https://api.github.com/repos/yvxiang/dfs/assignees{/user}","branches_url":"https://api.github.com/repos/yvxiang/dfs/branches{/branch}","tags_url":"https://api.github.com/repos/yvxiang/dfs/tags","blobs_url":"https://api.github.com/repos/yvxiang/dfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yvxiang/dfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yvxiang/dfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/yvxiang/dfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yvxiang/dfs/statuses/{sha}","languages_url":"https://api.github.com/repos/yvxiang/dfs/languages","stargazers_url":"https://api.github.com/repos/yvxiang/dfs/stargazers","contributors_url":"https://api.github.com/repos/yvxiang/dfs/contributors","subscribers_url":"https://api.github.com/repos/yvxiang/dfs/subscribers","subscription_url":"https://api.github.com/repos/yvxiang/dfs/subscription","commits_url":"https://api.github.com/repos/yvxiang/dfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/yvxiang/dfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/yvxiang/dfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/yvxiang/dfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/yvxiang/dfs/contents/{+path}","compare_url":"https://api.github.com/repos/yvxiang/dfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yvxiang/dfs/merges","archive_url":"https://api.github.com/repos/yvxiang/dfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yvxiang/dfs/downloads","issues_url":"https://api.github.com/repos/yvxiang/dfs/issues{/number}","pulls_url":"https://api.github.com/repos/yvxiang/dfs/pulls{/number}","milestones_url":"https://api.github.com/repos/yvxiang/dfs/milestones{/number}","notifications_url":"https://api.github.com/repos/yvxiang/dfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yvxiang/dfs/labels{/name}","releases_url":"https://api.github.com/repos/yvxiang/dfs/releases{/id}","deployments_url":"https://api.github.com/repos/yvxiang/dfs/deployments","created_at":"2015-03-27T12:37:26Z","updated_at":"2016-01-12T10:38:47Z","pushed_at":"2016-09-26T01:59:49Z","git_url":"git://github.com/yvxiang/dfs.git","ssh_url":"git@github.com:yvxiang/dfs.git","clone_url":"https://github.com/yvxiang/dfs.git","svn_url":"https://github.com/yvxiang/dfs","homepage":null,"size":11400,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"baidu:master","ref":"master","sha":"b5c0ec2de033b2ada61560f096b08fb2a3079d5b","user":{"login":"baidu","id":13245940,"avatar_url":"https://avatars.githubusercontent.com/u/13245940?v=3","gravatar_id":"","url":"https://api.github.com/users/baidu","html_url":"https://github.com/baidu","followers_url":"https://api.github.com/users/baidu/followers","following_url":"https://api.github.com/users/baidu/following{/other_user}","gists_url":"https://api.github.com/users/baidu/gists{/gist_id}","starred_url":"https://api.github.com/users/baidu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baidu/subscriptions","organizations_url":"https://api.github.com/users/baidu/orgs","repos_url":"https://api.github.com/users/baidu/repos","events_url":"https://api.github.com/users/baidu/events{/privacy}","received_events_url":"https://api.github.com/users/baidu/received_events","type":"Organization","site_admin":false},"repo":{"id":26562172,"name":"bfs","full_name":"baidu/bfs","owner":{"login":"baidu","id":13245940,"avatar_url":"https://avatars.githubusercontent.com/u/13245940?v=3","gravatar_id":"","url":"https://api.github.com/users/baidu","html_url":"https://github.com/baidu","followers_url":"https://api.github.com/users/baidu/followers","following_url":"https://api.github.com/users/baidu/following{/other_user}","gists_url":"https://api.github.com/users/baidu/gists{/gist_id}","starred_url":"https://api.github.com/users/baidu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baidu/subscriptions","organizations_url":"https://api.github.com/users/baidu/orgs","repos_url":"https://api.github.com/users/baidu/repos","events_url":"https://api.github.com/users/baidu/events{/privacy}","received_events_url":"https://api.github.com/users/baidu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/baidu/bfs","description":"The Baidu File System.","fork":false,"url":"https://api.github.com/repos/baidu/bfs","forks_url":"https://api.github.com/repos/baidu/bfs/forks","keys_url":"https://api.github.com/repos/baidu/bfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/baidu/bfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/baidu/bfs/teams","hooks_url":"https://api.github.com/repos/baidu/bfs/hooks","issue_events_url":"https://api.github.com/repos/baidu/bfs/issues/events{/number}","events_url":"https://api.github.com/repos/baidu/bfs/events","assignees_url":"https://api.github.com/repos/baidu/bfs/assignees{/user}","branches_url":"https://api.github.com/repos/baidu/bfs/branches{/branch}","tags_url":"https://api.github.com/repos/baidu/bfs/tags","blobs_url":"https://api.github.com/repos/baidu/bfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/baidu/bfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/baidu/bfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/baidu/bfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/baidu/bfs/statuses/{sha}","languages_url":"https://api.github.com/repos/baidu/bfs/languages","stargazers_url":"https://api.github.com/repos/baidu/bfs/stargazers","contributors_url":"https://api.github.com/repos/baidu/bfs/contributors","subscribers_url":"https://api.github.com/repos/baidu/bfs/subscribers","subscription_url":"https://api.github.com/repos/baidu/bfs/subscription","commits_url":"https://api.github.com/repos/baidu/bfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/baidu/bfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/baidu/bfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/baidu/bfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/baidu/bfs/contents/{+path}","compare_url":"https://api.github.com/repos/baidu/bfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/baidu/bfs/merges","archive_url":"https://api.github.com/repos/baidu/bfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/baidu/bfs/downloads","issues_url":"https://api.github.com/repos/baidu/bfs/issues{/number}","pulls_url":"https://api.github.com/repos/baidu/bfs/pulls{/number}","milestones_url":"https://api.github.com/repos/baidu/bfs/milestones{/number}","notifications_url":"https://api.github.com/repos/baidu/bfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/baidu/bfs/labels{/name}","releases_url":"https://api.github.com/repos/baidu/bfs/releases{/id}","deployments_url":"https://api.github.com/repos/baidu/bfs/deployments","created_at":"2014-11-13T00:00:29Z","updated_at":"2016-09-25T14:44:09Z","pushed_at":"2016-09-26T01:59:49Z","git_url":"git://github.com/baidu/bfs.git","ssh_url":"git@github.com:baidu/bfs.git","clone_url":"https://github.com/baidu/bfs.git","svn_url":"https://github.com/baidu/bfs","homepage":"","size":12108,"stargazers_count":87,"watchers_count":87,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":40,"mirror_url":null,"open_issues_count":63,"forks":40,"open_issues":63,"watchers":87,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/baidu/bfs/pulls/490"},"html":{"href":"https://github.com/baidu/bfs/pull/490"},"issue":{"href":"https://api.github.com/repos/baidu/bfs/issues/490"},"comments":{"href":"https://api.github.com/repos/baidu/bfs/issues/490/comments"},"review_comments":{"href":"https://api.github.com/repos/baidu/bfs/pulls/490/comments"},"review_comment":{"href":"https://api.github.com/repos/baidu/bfs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/baidu/bfs/pulls/490/commits"},"statuses":{"href":"https://api.github.com/repos/baidu/bfs/statuses/305ef6e7043ac8dfa3aa72501b13e8c65e682ab6"}}}}
{"actor":{"display_login":"yvxiang"}}