{"action":"created","comment":{"url":"https://api.github.com/repos/youtube/vitess/pulls/comments/165827196","pull_request_review_id":93828958,"id":165827196,"diff_hunk":"@@ -140,6 +142,87 @@ spec:\n       shard: {{ $shardClean | quote }}\n       type: {{ $tablet.type | quote }}\n \n+{{ if eq $tablet.type \"replica\" }}\n+---\n+###################################\n+# vttablet InitShardMaster Job\n+###################################\n+apiVersion: batch/v1\n+kind: Job\n+metadata:\n+  name: {{ $shardName }}-init-shard-master\n+spec:\n+  backoffLimit: 0\n+  template:\n+    spec:\n+      restartPolicy: OnFailure\n+      containers:\n+      - name: init-shard-master\n+        image: \"vitess/vtctlclient:{{$vitessTag}}\"\n+\n+        command: [\"bash\"]\n+        args:\n+          - \"-c\"\n+          - |\n+            set -ex\n+\n+            SECONDS=0\n+            TIMEOUT_SECONDS=600\n+\n+            # poll every 5 seconds to see if vtctld is ready\n+            until vtctlclient -server vtctld.{{ $namespace }}:15999 ListAllTablets {{ $cellClean }} > /dev/null 2>&1; do \n+              if (( $SECONDS > $TIMEOUT_SECONDS )); then\n+                echo \"timed out waiting for vtctlclient to be ready\"\n+                exit 1\n+              fi\n+              sleep 5\n+            done\n+\n+            until [ $TABLETS_READY ]; do\n+              # get all the tablets in the current cell\n+              cellTablets=\"$(vtctlclient -server vtctld.{{ $namespace }}:15999 ListAllTablets {{ $cellClean }})\"\n+              \n+              # filter to only the tablets in our current shard\n+              shardTablets=$( echo \"$cellTablets\" | awk 'substr( $5,1,{{ len $shardName }} ) == \"{{ $shardName }}\" {print $0}')\n+\n+              # check for a master tablet\n+              masterTablet=$( echo \"$shardTablets\" | awk '$4 == \"master\" {print $1}')","path":"helm/vitess/templates/_vttablet.tpl","position":64,"original_position":64,"commit_id":"224a6bd908147e600a05e28cf161fd46390b3614","original_commit_id":"eb73a0c5dc6abf170ec60f4abb525a9629d28ee1","user":{"login":"enisoc","id":6733629,"avatar_url":"https://avatars3.githubusercontent.com/u/6733629?v=4","gravatar_id":"","url":"https://api.github.com/users/enisoc","html_url":"https://github.com/enisoc","followers_url":"https://api.github.com/users/enisoc/followers","following_url":"https://api.github.com/users/enisoc/following{/other_user}","gists_url":"https://api.github.com/users/enisoc/gists{/gist_id}","starred_url":"https://api.github.com/users/enisoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enisoc/subscriptions","organizations_url":"https://api.github.com/users/enisoc/orgs","repos_url":"https://api.github.com/users/enisoc/repos","events_url":"https://api.github.com/users/enisoc/events{/privacy}","received_events_url":"https://api.github.com/users/enisoc/received_events","type":"User","site_admin":false},"body":"It's possible that there could temporarily be no tablet of type master, even post-ISM. We need to be careful not to run ISM again in this case (especially with `-force`), since it can cause data loss.\r\n\r\nI think a somewhat more reliable signal would be an empty `master_alias` entry in the result of `GetShard`. I think even if we transiently don't have a running master, the shard record should still contain the alias of the last known master. I'm not 100% on that though, so we should still try to think if there's a better way to be sure the shard has never been initialized.","created_at":"2018-02-03T22:18:06Z","updated_at":"2018-02-03T22:24:10Z","html_url":"https://github.com/youtube/vitess/pull/3612#discussion_r165827196","pull_request_url":"https://api.github.com/repos/youtube/vitess/pulls/3612","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/youtube/vitess/pulls/comments/165827196"},"html":{"href":"https://github.com/youtube/vitess/pull/3612#discussion_r165827196"},"pull_request":{"href":"https://api.github.com/repos/youtube/vitess/pulls/3612"}}},"pull_request":{"url":"https://api.github.com/repos/youtube/vitess/pulls/3612","id":166339072,"html_url":"https://github.com/youtube/vitess/pull/3612","diff_url":"https://github.com/youtube/vitess/pull/3612.diff","patch_url":"https://github.com/youtube/vitess/pull/3612.patch","issue_url":"https://api.github.com/repos/youtube/vitess/issues/3612","number":3612,"state":"open","locked":false,"title":"helm: add InitShardMaster Job","user":{"login":"derekperkins","id":3588778,"avatar_url":"https://avatars0.githubusercontent.com/u/3588778?v=4","gravatar_id":"","url":"https://api.github.com/users/derekperkins","html_url":"https://github.com/derekperkins","followers_url":"https://api.github.com/users/derekperkins/followers","following_url":"https://api.github.com/users/derekperkins/following{/other_user}","gists_url":"https://api.github.com/users/derekperkins/gists{/gist_id}","starred_url":"https://api.github.com/users/derekperkins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derekperkins/subscriptions","organizations_url":"https://api.github.com/users/derekperkins/orgs","repos_url":"https://api.github.com/users/derekperkins/repos","events_url":"https://api.github.com/users/derekperkins/events{/privacy}","received_events_url":"https://api.github.com/users/derekperkins/received_events","type":"User","site_admin":false},"body":"To make the `helm install` process more seamless, this will automatically initialize the shard master. One job is created per shard.","created_at":"2018-01-31T18:23:01Z","updated_at":"2018-02-03T22:24:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"532b4494e56d7ce4a90837ac2cd78927e974a550","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/youtube/vitess/pulls/3612/commits","review_comments_url":"https://api.github.com/repos/youtube/vitess/pulls/3612/comments","review_comment_url":"https://api.github.com/repos/youtube/vitess/pulls/comments{/number}","comments_url":"https://api.github.com/repos/youtube/vitess/issues/3612/comments","statuses_url":"https://api.github.com/repos/youtube/vitess/statuses/224a6bd908147e600a05e28cf161fd46390b3614","head":{"label":"derekperkins:init-shard-master","ref":"init-shard-master","sha":"224a6bd908147e600a05e28cf161fd46390b3614","user":{"login":"derekperkins","id":3588778,"avatar_url":"https://avatars0.githubusercontent.com/u/3588778?v=4","gravatar_id":"","url":"https://api.github.com/users/derekperkins","html_url":"https://github.com/derekperkins","followers_url":"https://api.github.com/users/derekperkins/followers","following_url":"https://api.github.com/users/derekperkins/following{/other_user}","gists_url":"https://api.github.com/users/derekperkins/gists{/gist_id}","starred_url":"https://api.github.com/users/derekperkins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derekperkins/subscriptions","organizations_url":"https://api.github.com/users/derekperkins/orgs","repos_url":"https://api.github.com/users/derekperkins/repos","events_url":"https://api.github.com/users/derekperkins/events{/privacy}","received_events_url":"https://api.github.com/users/derekperkins/received_events","type":"User","site_admin":false},"repo":{"id":103196675,"name":"vitess","full_name":"derekperkins/vitess","owner":{"login":"derekperkins","id":3588778,"avatar_url":"https://avatars0.githubusercontent.com/u/3588778?v=4","gravatar_id":"","url":"https://api.github.com/users/derekperkins","html_url":"https://github.com/derekperkins","followers_url":"https://api.github.com/users/derekperkins/followers","following_url":"https://api.github.com/users/derekperkins/following{/other_user}","gists_url":"https://api.github.com/users/derekperkins/gists{/gist_id}","starred_url":"https://api.github.com/users/derekperkins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derekperkins/subscriptions","organizations_url":"https://api.github.com/users/derekperkins/orgs","repos_url":"https://api.github.com/users/derekperkins/repos","events_url":"https://api.github.com/users/derekperkins/events{/privacy}","received_events_url":"https://api.github.com/users/derekperkins/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/derekperkins/vitess","description":"Vitess is a database clustering system for horizontal scaling of MySQL.","fork":true,"url":"https://api.github.com/repos/derekperkins/vitess","forks_url":"https://api.github.com/repos/derekperkins/vitess/forks","keys_url":"https://api.github.com/repos/derekperkins/vitess/keys{/key_id}","collaborators_url":"https://api.github.com/repos/derekperkins/vitess/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/derekperkins/vitess/teams","hooks_url":"https://api.github.com/repos/derekperkins/vitess/hooks","issue_events_url":"https://api.github.com/repos/derekperkins/vitess/issues/events{/number}","events_url":"https://api.github.com/repos/derekperkins/vitess/events","assignees_url":"https://api.github.com/repos/derekperkins/vitess/assignees{/user}","branches_url":"https://api.github.com/repos/derekperkins/vitess/branches{/branch}","tags_url":"https://api.github.com/repos/derekperkins/vitess/tags","blobs_url":"https://api.github.com/repos/derekperkins/vitess/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/derekperkins/vitess/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/derekperkins/vitess/git/refs{/sha}","trees_url":"https://api.github.com/repos/derekperkins/vitess/git/trees{/sha}","statuses_url":"https://api.github.com/repos/derekperkins/vitess/statuses/{sha}","languages_url":"https://api.github.com/repos/derekperkins/vitess/languages","stargazers_url":"https://api.github.com/repos/derekperkins/vitess/stargazers","contributors_url":"https://api.github.com/repos/derekperkins/vitess/contributors","subscribers_url":"https://api.github.com/repos/derekperkins/vitess/subscribers","subscription_url":"https://api.github.com/repos/derekperkins/vitess/subscription","commits_url":"https://api.github.com/repos/derekperkins/vitess/commits{/sha}","git_commits_url":"https://api.github.com/repos/derekperkins/vitess/git/commits{/sha}","comments_url":"https://api.github.com/repos/derekperkins/vitess/comments{/number}","issue_comment_url":"https://api.github.com/repos/derekperkins/vitess/issues/comments{/number}","contents_url":"https://api.github.com/repos/derekperkins/vitess/contents/{+path}","compare_url":"https://api.github.com/repos/derekperkins/vitess/compare/{base}...{head}","merges_url":"https://api.github.com/repos/derekperkins/vitess/merges","archive_url":"https://api.github.com/repos/derekperkins/vitess/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/derekperkins/vitess/downloads","issues_url":"https://api.github.com/repos/derekperkins/vitess/issues{/number}","pulls_url":"https://api.github.com/repos/derekperkins/vitess/pulls{/number}","milestones_url":"https://api.github.com/repos/derekperkins/vitess/milestones{/number}","notifications_url":"https://api.github.com/repos/derekperkins/vitess/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/derekperkins/vitess/labels{/name}","releases_url":"https://api.github.com/repos/derekperkins/vitess/releases{/id}","deployments_url":"https://api.github.com/repos/derekperkins/vitess/deployments","created_at":"2017-09-11T23:03:11Z","updated_at":"2017-09-11T23:03:18Z","pushed_at":"2018-02-03T22:21:06Z","git_url":"git://github.com/derekperkins/vitess.git","ssh_url":"git@github.com:derekperkins/vitess.git","clone_url":"https://github.com/derekperkins/vitess.git","svn_url":"https://github.com/derekperkins/vitess","homepage":"http://vitess.io","size":92785,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"youtube:master","ref":"master","sha":"ca018c7d29f3586b6b019cd88d073321ff9599cc","user":{"login":"youtube","id":4052902,"avatar_url":"https://avatars0.githubusercontent.com/u/4052902?v=4","gravatar_id":"","url":"https://api.github.com/users/youtube","html_url":"https://github.com/youtube","followers_url":"https://api.github.com/users/youtube/followers","following_url":"https://api.github.com/users/youtube/following{/other_user}","gists_url":"https://api.github.com/users/youtube/gists{/gist_id}","starred_url":"https://api.github.com/users/youtube/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/youtube/subscriptions","organizations_url":"https://api.github.com/users/youtube/orgs","repos_url":"https://api.github.com/users/youtube/repos","events_url":"https://api.github.com/users/youtube/events{/privacy}","received_events_url":"https://api.github.com/users/youtube/received_events","type":"Organization","site_admin":false},"repo":{"id":11008207,"name":"vitess","full_name":"youtube/vitess","owner":{"login":"youtube","id":4052902,"avatar_url":"https://avatars0.githubusercontent.com/u/4052902?v=4","gravatar_id":"","url":"https://api.github.com/users/youtube","html_url":"https://github.com/youtube","followers_url":"https://api.github.com/users/youtube/followers","following_url":"https://api.github.com/users/youtube/following{/other_user}","gists_url":"https://api.github.com/users/youtube/gists{/gist_id}","starred_url":"https://api.github.com/users/youtube/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/youtube/subscriptions","organizations_url":"https://api.github.com/users/youtube/orgs","repos_url":"https://api.github.com/users/youtube/repos","events_url":"https://api.github.com/users/youtube/events{/privacy}","received_events_url":"https://api.github.com/users/youtube/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/youtube/vitess","description":"Vitess is a database clustering system for horizontal scaling of MySQL.","fork":false,"url":"https://api.github.com/repos/youtube/vitess","forks_url":"https://api.github.com/repos/youtube/vitess/forks","keys_url":"https://api.github.com/repos/youtube/vitess/keys{/key_id}","collaborators_url":"https://api.github.com/repos/youtube/vitess/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/youtube/vitess/teams","hooks_url":"https://api.github.com/repos/youtube/vitess/hooks","issue_events_url":"https://api.github.com/repos/youtube/vitess/issues/events{/number}","events_url":"https://api.github.com/repos/youtube/vitess/events","assignees_url":"https://api.github.com/repos/youtube/vitess/assignees{/user}","branches_url":"https://api.github.com/repos/youtube/vitess/branches{/branch}","tags_url":"https://api.github.com/repos/youtube/vitess/tags","blobs_url":"https://api.github.com/repos/youtube/vitess/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/youtube/vitess/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/youtube/vitess/git/refs{/sha}","trees_url":"https://api.github.com/repos/youtube/vitess/git/trees{/sha}","statuses_url":"https://api.github.com/repos/youtube/vitess/statuses/{sha}","languages_url":"https://api.github.com/repos/youtube/vitess/languages","stargazers_url":"https://api.github.com/repos/youtube/vitess/stargazers","contributors_url":"https://api.github.com/repos/youtube/vitess/contributors","subscribers_url":"https://api.github.com/repos/youtube/vitess/subscribers","subscription_url":"https://api.github.com/repos/youtube/vitess/subscription","commits_url":"https://api.github.com/repos/youtube/vitess/commits{/sha}","git_commits_url":"https://api.github.com/repos/youtube/vitess/git/commits{/sha}","comments_url":"https://api.github.com/repos/youtube/vitess/comments{/number}","issue_comment_url":"https://api.github.com/repos/youtube/vitess/issues/comments{/number}","contents_url":"https://api.github.com/repos/youtube/vitess/contents/{+path}","compare_url":"https://api.github.com/repos/youtube/vitess/compare/{base}...{head}","merges_url":"https://api.github.com/repos/youtube/vitess/merges","archive_url":"https://api.github.com/repos/youtube/vitess/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/youtube/vitess/downloads","issues_url":"https://api.github.com/repos/youtube/vitess/issues{/number}","pulls_url":"https://api.github.com/repos/youtube/vitess/pulls{/number}","milestones_url":"https://api.github.com/repos/youtube/vitess/milestones{/number}","notifications_url":"https://api.github.com/repos/youtube/vitess/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/youtube/vitess/labels{/name}","releases_url":"https://api.github.com/repos/youtube/vitess/releases{/id}","deployments_url":"https://api.github.com/repos/youtube/vitess/deployments","created_at":"2013-06-27T21:20:28Z","updated_at":"2018-02-03T02:29:02Z","pushed_at":"2018-02-03T22:21:07Z","git_url":"git://github.com/youtube/vitess.git","ssh_url":"git@github.com:youtube/vitess.git","clone_url":"https://github.com/youtube/vitess.git","svn_url":"https://github.com/youtube/vitess","homepage":"http://vitess.io","size":93730,"stargazers_count":5457,"watchers_count":5457,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":715,"mirror_url":null,"archived":false,"open_issues_count":163,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":715,"open_issues":163,"watchers":5457,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/youtube/vitess/pulls/3612"},"html":{"href":"https://github.com/youtube/vitess/pull/3612"},"issue":{"href":"https://api.github.com/repos/youtube/vitess/issues/3612"},"comments":{"href":"https://api.github.com/repos/youtube/vitess/issues/3612/comments"},"review_comments":{"href":"https://api.github.com/repos/youtube/vitess/pulls/3612/comments"},"review_comment":{"href":"https://api.github.com/repos/youtube/vitess/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/youtube/vitess/pulls/3612/commits"},"statuses":{"href":"https://api.github.com/repos/youtube/vitess/statuses/224a6bd908147e600a05e28cf161fd46390b3614"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"enisoc"}}