{"action":"created","comment":{"url":"https://api.github.com/repos/apache/incubator-quickstep/pulls/comments/67097178","id":67097178,"diff_hunk":"@@ -60,12 +61,14 @@ class PolicyEnforcer {\n                  const std::size_t num_numa_nodes,\n                  CatalogDatabaseLite *catalog_database,\n                  StorageManager *storage_manager,\n-                 tmb::MessageBus *bus)\n+                 tmb::MessageBus *bus,\n+                 WorkerDirectory *worker_directory)","path":"query_execution/PolicyEnforcer.hpp","position":null,"original_position":14,"commit_id":"1e8f8032c9fc6f111a1fe414637c91a78155af0b","original_commit_id":"74e49fa7f91ab33e20d488ef9923b285214bc04e","user":{"login":"navsan","id":2507243,"avatar_url":"https://avatars.githubusercontent.com/u/2507243?v=3","gravatar_id":"","url":"https://api.github.com/users/navsan","html_url":"https://github.com/navsan","followers_url":"https://api.github.com/users/navsan/followers","following_url":"https://api.github.com/users/navsan/following{/other_user}","gists_url":"https://api.github.com/users/navsan/gists{/gist_id}","starred_url":"https://api.github.com/users/navsan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/navsan/subscriptions","organizations_url":"https://api.github.com/users/navsan/orgs","repos_url":"https://api.github.com/users/navsan/repos","events_url":"https://api.github.com/users/navsan/events{/privacy}","received_events_url":"https://api.github.com/users/navsan/received_events","type":"User","site_admin":false},"body":"Changed the order. BTW, this is not a convention that is followed elsewhere in the file. ","created_at":"2016-06-15T04:12:11Z","updated_at":"2016-06-15T04:12:11Z","html_url":"https://github.com/apache/incubator-quickstep/pull/33#discussion_r67097178","pull_request_url":"https://api.github.com/repos/apache/incubator-quickstep/pulls/33","_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-quickstep/pulls/comments/67097178"},"html":{"href":"https://github.com/apache/incubator-quickstep/pull/33#discussion_r67097178"},"pull_request":{"href":"https://api.github.com/repos/apache/incubator-quickstep/pulls/33"}}},"pull_request":{"url":"https://api.github.com/repos/apache/incubator-quickstep/pulls/33","id":73845694,"html_url":"https://github.com/apache/incubator-quickstep/pull/33","diff_url":"https://github.com/apache/incubator-quickstep/pull/33.diff","patch_url":"https://github.com/apache/incubator-quickstep/pull/33.patch","issue_url":"https://api.github.com/repos/apache/incubator-quickstep/issues/33","number":33,"state":"open","locked":false,"title":"BugFix: Update NumQueuedWorkOrders to fix scheduling","user":{"login":"navsan","id":2507243,"avatar_url":"https://avatars.githubusercontent.com/u/2507243?v=3","gravatar_id":"","url":"https://api.github.com/users/navsan","html_url":"https://github.com/navsan","followers_url":"https://api.github.com/users/navsan/followers","following_url":"https://api.github.com/users/navsan/following{/other_user}","gists_url":"https://api.github.com/users/navsan/gists{/gist_id}","starred_url":"https://api.github.com/users/navsan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/navsan/subscriptions","organizations_url":"https://api.github.com/users/navsan/orgs","repos_url":"https://api.github.com/users/navsan/repos","events_url":"https://api.github.com/users/navsan/events{/privacy}","received_events_url":"https://api.github.com/users/navsan/received_events","type":"User","site_admin":false},"body":"Quickstep scheduling is currently broken (since PR #14). The foreman only schedules work for one worker, leaving all other workers idle. This PR fixes that bug. \r\n\r\nThe foreman maintains the number of queued work orders for each worker in the WorkerDirectory. This state was not being incremented when WorkOrders are dispatched, and not being decremented when WorkOrders are completed. The search for LeastLoadedWorker would therefore always pick the first worker, resulting in serial execution of the entire query. \r\n\r\nIn this PR, I have incremented the number of queued work orders in the Foreman when it dispatches messages. \r\n\r\nWhen a WorkOrderCompletion message arrives, this number must be decremented. However, the worker's thread ID is not available to the Foreman, since PR #14 moved the message deserialization into the PolicyEnforcer. So, in this PR, I've added a pointer to the WorkerDirectory in the PolicyEnforcer. The PolicyEnforcer decrements the number of queued work orders while processing WorkOrderCompletion messages. \r\n\r\nThe WorkerDirectory is not thread-safe, so the decrement should only be done in the Foreman thread. Since the PolicyEnforcer is part of the Foreman thread, this change should be fine. \r\n\r\nTested on CloudLab machine  (40 workers) with a few example queries. \r\n\r\n[A big thanks to @rogersjeffreyl for helping me debug this!]","created_at":"2016-06-15T03:04:07Z","updated_at":"2016-06-15T04:12:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c9f51ac37211041c1b5473f487f12e99977d5f66","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/incubator-quickstep/pulls/33/commits","review_comments_url":"https://api.github.com/repos/apache/incubator-quickstep/pulls/33/comments","review_comment_url":"https://api.github.com/repos/apache/incubator-quickstep/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/incubator-quickstep/issues/33/comments","statuses_url":"https://api.github.com/repos/apache/incubator-quickstep/statuses/1e8f8032c9fc6f111a1fe414637c91a78155af0b","head":{"label":"apache:fix_scheduler","ref":"fix_scheduler","sha":"1e8f8032c9fc6f111a1fe414637c91a78155af0b","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":56214719,"name":"incubator-quickstep","full_name":"apache/incubator-quickstep","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/incubator-quickstep","description":"Mirror of Apache Quickstep Incubator","fork":false,"url":"https://api.github.com/repos/apache/incubator-quickstep","forks_url":"https://api.github.com/repos/apache/incubator-quickstep/forks","keys_url":"https://api.github.com/repos/apache/incubator-quickstep/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/incubator-quickstep/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/incubator-quickstep/teams","hooks_url":"https://api.github.com/repos/apache/incubator-quickstep/hooks","issue_events_url":"https://api.github.com/repos/apache/incubator-quickstep/issues/events{/number}","events_url":"https://api.github.com/repos/apache/incubator-quickstep/events","assignees_url":"https://api.github.com/repos/apache/incubator-quickstep/assignees{/user}","branches_url":"https://api.github.com/repos/apache/incubator-quickstep/branches{/branch}","tags_url":"https://api.github.com/repos/apache/incubator-quickstep/tags","blobs_url":"https://api.github.com/repos/apache/incubator-quickstep/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/incubator-quickstep/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/incubator-quickstep/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/incubator-quickstep/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/incubator-quickstep/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/incubator-quickstep/languages","stargazers_url":"https://api.github.com/repos/apache/incubator-quickstep/stargazers","contributors_url":"https://api.github.com/repos/apache/incubator-quickstep/contributors","subscribers_url":"https://api.github.com/repos/apache/incubator-quickstep/subscribers","subscription_url":"https://api.github.com/repos/apache/incubator-quickstep/subscription","commits_url":"https://api.github.com/repos/apache/incubator-quickstep/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/incubator-quickstep/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/incubator-quickstep/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/incubator-quickstep/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/incubator-quickstep/contents/{+path}","compare_url":"https://api.github.com/repos/apache/incubator-quickstep/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/incubator-quickstep/merges","archive_url":"https://api.github.com/repos/apache/incubator-quickstep/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/incubator-quickstep/downloads","issues_url":"https://api.github.com/repos/apache/incubator-quickstep/issues{/number}","pulls_url":"https://api.github.com/repos/apache/incubator-quickstep/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/incubator-quickstep/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/incubator-quickstep/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/incubator-quickstep/labels{/name}","releases_url":"https://api.github.com/repos/apache/incubator-quickstep/releases{/id}","deployments_url":"https://api.github.com/repos/apache/incubator-quickstep/deployments","created_at":"2016-04-14T07:00:07Z","updated_at":"2016-04-26T18:43:30Z","pushed_at":"2016-06-15T04:11:54Z","git_url":"git://github.com/apache/incubator-quickstep.git","ssh_url":"git@github.com:apache/incubator-quickstep.git","clone_url":"https://github.com/apache/incubator-quickstep.git","svn_url":"https://github.com/apache/incubator-quickstep","homepage":null,"size":7290,"stargazers_count":4,"watchers_count":4,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6,"mirror_url":"git://git.apache.org/incubator-quickstep.git","open_issues_count":6,"forks":6,"open_issues":6,"watchers":4,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"dd4495899e22437b9d64bbcb65edcbc7e25ce409","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":56214719,"name":"incubator-quickstep","full_name":"apache/incubator-quickstep","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/incubator-quickstep","description":"Mirror of Apache Quickstep Incubator","fork":false,"url":"https://api.github.com/repos/apache/incubator-quickstep","forks_url":"https://api.github.com/repos/apache/incubator-quickstep/forks","keys_url":"https://api.github.com/repos/apache/incubator-quickstep/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/incubator-quickstep/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/incubator-quickstep/teams","hooks_url":"https://api.github.com/repos/apache/incubator-quickstep/hooks","issue_events_url":"https://api.github.com/repos/apache/incubator-quickstep/issues/events{/number}","events_url":"https://api.github.com/repos/apache/incubator-quickstep/events","assignees_url":"https://api.github.com/repos/apache/incubator-quickstep/assignees{/user}","branches_url":"https://api.github.com/repos/apache/incubator-quickstep/branches{/branch}","tags_url":"https://api.github.com/repos/apache/incubator-quickstep/tags","blobs_url":"https://api.github.com/repos/apache/incubator-quickstep/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/incubator-quickstep/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/incubator-quickstep/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/incubator-quickstep/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/incubator-quickstep/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/incubator-quickstep/languages","stargazers_url":"https://api.github.com/repos/apache/incubator-quickstep/stargazers","contributors_url":"https://api.github.com/repos/apache/incubator-quickstep/contributors","subscribers_url":"https://api.github.com/repos/apache/incubator-quickstep/subscribers","subscription_url":"https://api.github.com/repos/apache/incubator-quickstep/subscription","commits_url":"https://api.github.com/repos/apache/incubator-quickstep/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/incubator-quickstep/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/incubator-quickstep/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/incubator-quickstep/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/incubator-quickstep/contents/{+path}","compare_url":"https://api.github.com/repos/apache/incubator-quickstep/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/incubator-quickstep/merges","archive_url":"https://api.github.com/repos/apache/incubator-quickstep/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/incubator-quickstep/downloads","issues_url":"https://api.github.com/repos/apache/incubator-quickstep/issues{/number}","pulls_url":"https://api.github.com/repos/apache/incubator-quickstep/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/incubator-quickstep/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/incubator-quickstep/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/incubator-quickstep/labels{/name}","releases_url":"https://api.github.com/repos/apache/incubator-quickstep/releases{/id}","deployments_url":"https://api.github.com/repos/apache/incubator-quickstep/deployments","created_at":"2016-04-14T07:00:07Z","updated_at":"2016-04-26T18:43:30Z","pushed_at":"2016-06-15T04:11:54Z","git_url":"git://github.com/apache/incubator-quickstep.git","ssh_url":"git@github.com:apache/incubator-quickstep.git","clone_url":"https://github.com/apache/incubator-quickstep.git","svn_url":"https://github.com/apache/incubator-quickstep","homepage":null,"size":7290,"stargazers_count":4,"watchers_count":4,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6,"mirror_url":"git://git.apache.org/incubator-quickstep.git","open_issues_count":6,"forks":6,"open_issues":6,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-quickstep/pulls/33"},"html":{"href":"https://github.com/apache/incubator-quickstep/pull/33"},"issue":{"href":"https://api.github.com/repos/apache/incubator-quickstep/issues/33"},"comments":{"href":"https://api.github.com/repos/apache/incubator-quickstep/issues/33/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/incubator-quickstep/pulls/33/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/incubator-quickstep/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/incubator-quickstep/pulls/33/commits"},"statuses":{"href":"https://api.github.com/repos/apache/incubator-quickstep/statuses/1e8f8032c9fc6f111a1fe414637c91a78155af0b"}}}}
{"actor":{"display_login":"navsan"}}