{"action":"created","comment":{"url":"https://api.github.com/repos/pingcap/jepsen/pulls/comments/128148007","pull_request_review_id":50798821,"id":128148007,"diff_hunk":"@@ -0,0 +1,166 @@\n+(ns tidb.core\n+  (:gen-class)\n+  (:require [clojure.tools.logging :refer :all]\n+  \t        [clojure.string :as str]\n+            [jepsen\n+              [tests :as tests]\n+              [control :as c]\n+              [cli :as cli]\n+              [db :as db]\n+            ]\n+            [jepsen.control.util :as cu]\n+  )\n+)\n+\n+(def tidb-url \"http://download.pingcap.org/tidb-latest-linux-amd64.tar.gz\")\n+(def tidb-dir \"/opt/tidb\")\n+(def tipd \"./bin/pd-server\")\n+(def tikv \"./bin/tikv-server\")\n+(def tidb \"./bin/tidb-server\")\n+(def pdlogfile (str tidb-dir \"/jepsen-pd.log\"))\n+(def pdpidfile (str tidb-dir \"/jepsen-pd.pid\"))\n+(def kvlogfile (str tidb-dir \"/jepsen-kv.log\"))\n+(def kvpidfile (str tidb-dir \"/jepsen-kv.pid\"))\n+(def dblogfile (str tidb-dir \"/jepsen-db.log\"))\n+(def dbpidfile (str tidb-dir \"/jepsen-db.pid\"))\n+\n+(def client-port 2379)\n+(def peer-port   2380)\n+\n+(def tidb-map\n+  {:n1 {:pd \"pd1\" :kv \"tikv1\"}\n+   :n2 {:pd \"pd2\" :kv \"tikv2\"}\n+   :n3 {:pd \"pd3\" :kv \"tikv3\"}\n+   :n4 {:pd \"pd4\" :kv \"tikv4\"}\n+   :n5 {:pd \"pd5\" :kv \"tikv5\"}\n+  }\n+)\n+\n+(defn node-url\n+  \"An HTTP url for connecting to a node on a particular port.\"\n+  [node port]\n+  (str \"http://\" (name node) \":\" port)\n+)\n+\n+(defn client-url\n+  \"The HTTP url clients use to talk to a node.\"\n+  [node]\n+  (node-url node client-port)\n+)\n+\n+(defn peer-url\n+  \"The HTTP url for other peers to talk to a node.\"\n+  [node]\n+  (node-url node peer-port)\n+)\n+\n+(defn initial-cluster\n+  \"Constructs an initial cluster string for a test, like \\\"foo=foo:2380,bar=bar:2380,...\\\"\"\n+  [test]\n+  (->> (:nodes test)\n+       (map (fn [node] (str (get-in tidb-map [node :pd]) \"=\" (peer-url node))))\n+       (str/join \",\")\n+  )\n+)\n+\n+(defn pd-cluster\n+  [test]\n+  (->> (:nodes test)\n+       (map (fn [node] (str (name node) \":\" client-port)))\n+       (str/join \",\")\n+  )\n+)\n+\n+(defn db\n+  \"TiDB\"\n+  [opts]\n+  (reify db/DB\n+    (setup! [_ test node]\n+      (c/su\n+        (info node \"installing TiDB\")\n+        (cu/install-tarball! node tidb-url tidb-dir)\n+\n+        ; ./bin/pd-server --name=pd1 \\\n+        ;                 --data-dir=pd1 \\\n+        ;                 --client-urls=\"http://n1:2379\" \\\n+        ;                 --peer-urls=\"http://n1:2380\" \\\n+                        ; --initial-cluster=\"pd1=http://n1:2380, \\\n+                                           ; pd2=http://n2:2380, \\\n+                                           ; pd3=http://n3:2380\" \\\n+                                           ; pd4=http://n4:2380\" \\\n+                                           ; pd5=http://n5:2380\" \\\n+        ;                 --log-file=pd.log\n+        (info node \"starting pd-server\")\n+        (cu/start-daemon!\n+          {:logfile pdlogfile\n+           :pidfile pdpidfile\n+           :chdir   tidb-dir\n+          }\n+          tipd\n+          :--name            (get-in tidb-map [node :pd])\n+          :--data-dir        (get-in tidb-map [node :pd])\n+          :--client-urls     (client-url node)\n+          :--peer-urls       (peer-url node)\n+          :--initial-cluster (initial-cluster test)\n+          :--log-file        (str \"pd.log\")\n+        )\n+\n+        ; ./bin/tikv-server --pd=\"n1:2379,n2:2379,n3:2379,n4:2379,n5:2379\" \\\n+                          ; --addr=\"n1:20160\" \\\n+                          ; --data-dir=tikv1 \\\n+                          ; --log-file=tikv.log\n+        (info node \"starting tikv-server\")\n+        (cu/start-daemon!\n+          {:logfile kvlogfile\n+           :pidfile kvpidfile\n+           :chdir   tidb-dir\n+          }\n+          tikv\n+          :--pd        (pd-cluster test)\n+          :--addr      (str (name node) \":\" \"20160\")\n+          :--data-dir  (get-in tidb-map [node :kv])\n+          :--log-file  (str \"tikv.log\")\n+        )\n+\n+        ; ./bin/tidb-server --store=tikv \\","path":"tidb/src/tidb/core.clj","position":125,"original_position":125,"commit_id":"48c589ba25d36317efaf7d208e13e686a59e97fd","original_commit_id":"48c589ba25d36317efaf7d208e13e686a59e97fd","user":{"login":"siddontang","id":1080370,"avatar_url":"https://avatars2.githubusercontent.com/u/1080370?v=4","gravatar_id":"","url":"https://api.github.com/users/siddontang","html_url":"https://github.com/siddontang","followers_url":"https://api.github.com/users/siddontang/followers","following_url":"https://api.github.com/users/siddontang/following{/other_user}","gists_url":"https://api.github.com/users/siddontang/gists{/gist_id}","starred_url":"https://api.github.com/users/siddontang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/siddontang/subscriptions","organizations_url":"https://api.github.com/users/siddontang/orgs","repos_url":"https://api.github.com/users/siddontang/repos","events_url":"https://api.github.com/users/siddontang/events{/privacy}","received_events_url":"https://api.github.com/users/siddontang/received_events","type":"User","site_admin":false},"body":"@nolouch @disksing \r\n\r\nWe must speed up this mechanism. ","created_at":"2017-07-19T03:55:00Z","updated_at":"2017-07-19T03:55:00Z","html_url":"https://github.com/pingcap/jepsen/pull/2#discussion_r128148007","pull_request_url":"https://api.github.com/repos/pingcap/jepsen/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/pingcap/jepsen/pulls/comments/128148007"},"html":{"href":"https://github.com/pingcap/jepsen/pull/2#discussion_r128148007"},"pull_request":{"href":"https://api.github.com/repos/pingcap/jepsen/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/pingcap/jepsen/pulls/2","id":131231816,"html_url":"https://github.com/pingcap/jepsen/pull/2","diff_url":"https://github.com/pingcap/jepsen/pull/2.diff","patch_url":"https://github.com/pingcap/jepsen/pull/2.patch","issue_url":"https://api.github.com/repos/pingcap/jepsen/issues/2","number":2,"state":"open","locked":false,"title":"Running TiDB on Jepsen","user":{"login":"UncP","id":16263931,"avatar_url":"https://avatars1.githubusercontent.com/u/16263931?v=4","gravatar_id":"","url":"https://api.github.com/users/UncP","html_url":"https://github.com/UncP","followers_url":"https://api.github.com/users/UncP/followers","following_url":"https://api.github.com/users/UncP/following{/other_user}","gists_url":"https://api.github.com/users/UncP/gists{/gist_id}","starred_url":"https://api.github.com/users/UncP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UncP/subscriptions","organizations_url":"https://api.github.com/users/UncP/orgs","repos_url":"https://api.github.com/users/UncP/repos","events_url":"https://api.github.com/users/UncP/events{/privacy}","received_events_url":"https://api.github.com/users/UncP/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-07-19T03:49:05Z","updated_at":"2017-07-19T03:55:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fc04951be394c21c93fbb7cdc0458ed98bf0b215","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/pingcap/jepsen/pulls/2/commits","review_comments_url":"https://api.github.com/repos/pingcap/jepsen/pulls/2/comments","review_comment_url":"https://api.github.com/repos/pingcap/jepsen/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pingcap/jepsen/issues/2/comments","statuses_url":"https://api.github.com/repos/pingcap/jepsen/statuses/48c589ba25d36317efaf7d208e13e686a59e97fd","head":{"label":"UncP:master","ref":"master","sha":"48c589ba25d36317efaf7d208e13e686a59e97fd","user":{"login":"UncP","id":16263931,"avatar_url":"https://avatars1.githubusercontent.com/u/16263931?v=4","gravatar_id":"","url":"https://api.github.com/users/UncP","html_url":"https://github.com/UncP","followers_url":"https://api.github.com/users/UncP/followers","following_url":"https://api.github.com/users/UncP/following{/other_user}","gists_url":"https://api.github.com/users/UncP/gists{/gist_id}","starred_url":"https://api.github.com/users/UncP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UncP/subscriptions","organizations_url":"https://api.github.com/users/UncP/orgs","repos_url":"https://api.github.com/users/UncP/repos","events_url":"https://api.github.com/users/UncP/events{/privacy}","received_events_url":"https://api.github.com/users/UncP/received_events","type":"User","site_admin":false},"repo":{"id":97591536,"name":"jepsen","full_name":"UncP/jepsen","owner":{"login":"UncP","id":16263931,"avatar_url":"https://avatars1.githubusercontent.com/u/16263931?v=4","gravatar_id":"","url":"https://api.github.com/users/UncP","html_url":"https://github.com/UncP","followers_url":"https://api.github.com/users/UncP/followers","following_url":"https://api.github.com/users/UncP/following{/other_user}","gists_url":"https://api.github.com/users/UncP/gists{/gist_id}","starred_url":"https://api.github.com/users/UncP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UncP/subscriptions","organizations_url":"https://api.github.com/users/UncP/orgs","repos_url":"https://api.github.com/users/UncP/repos","events_url":"https://api.github.com/users/UncP/events{/privacy}","received_events_url":"https://api.github.com/users/UncP/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/UncP/jepsen","description":"A framework for distributed systems verification, with fault injection","fork":true,"url":"https://api.github.com/repos/UncP/jepsen","forks_url":"https://api.github.com/repos/UncP/jepsen/forks","keys_url":"https://api.github.com/repos/UncP/jepsen/keys{/key_id}","collaborators_url":"https://api.github.com/repos/UncP/jepsen/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/UncP/jepsen/teams","hooks_url":"https://api.github.com/repos/UncP/jepsen/hooks","issue_events_url":"https://api.github.com/repos/UncP/jepsen/issues/events{/number}","events_url":"https://api.github.com/repos/UncP/jepsen/events","assignees_url":"https://api.github.com/repos/UncP/jepsen/assignees{/user}","branches_url":"https://api.github.com/repos/UncP/jepsen/branches{/branch}","tags_url":"https://api.github.com/repos/UncP/jepsen/tags","blobs_url":"https://api.github.com/repos/UncP/jepsen/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/UncP/jepsen/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/UncP/jepsen/git/refs{/sha}","trees_url":"https://api.github.com/repos/UncP/jepsen/git/trees{/sha}","statuses_url":"https://api.github.com/repos/UncP/jepsen/statuses/{sha}","languages_url":"https://api.github.com/repos/UncP/jepsen/languages","stargazers_url":"https://api.github.com/repos/UncP/jepsen/stargazers","contributors_url":"https://api.github.com/repos/UncP/jepsen/contributors","subscribers_url":"https://api.github.com/repos/UncP/jepsen/subscribers","subscription_url":"https://api.github.com/repos/UncP/jepsen/subscription","commits_url":"https://api.github.com/repos/UncP/jepsen/commits{/sha}","git_commits_url":"https://api.github.com/repos/UncP/jepsen/git/commits{/sha}","comments_url":"https://api.github.com/repos/UncP/jepsen/comments{/number}","issue_comment_url":"https://api.github.com/repos/UncP/jepsen/issues/comments{/number}","contents_url":"https://api.github.com/repos/UncP/jepsen/contents/{+path}","compare_url":"https://api.github.com/repos/UncP/jepsen/compare/{base}...{head}","merges_url":"https://api.github.com/repos/UncP/jepsen/merges","archive_url":"https://api.github.com/repos/UncP/jepsen/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/UncP/jepsen/downloads","issues_url":"https://api.github.com/repos/UncP/jepsen/issues{/number}","pulls_url":"https://api.github.com/repos/UncP/jepsen/pulls{/number}","milestones_url":"https://api.github.com/repos/UncP/jepsen/milestones{/number}","notifications_url":"https://api.github.com/repos/UncP/jepsen/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/UncP/jepsen/labels{/name}","releases_url":"https://api.github.com/repos/UncP/jepsen/releases{/id}","deployments_url":"https://api.github.com/repos/UncP/jepsen/deployments","created_at":"2017-07-18T11:44:27Z","updated_at":"2017-07-18T11:44:29Z","pushed_at":"2017-07-19T03:47:18Z","git_url":"git://github.com/UncP/jepsen.git","ssh_url":"git@github.com:UncP/jepsen.git","clone_url":"https://github.com/UncP/jepsen.git","svn_url":"https://github.com/UncP/jepsen","homepage":"","size":45844,"stargazers_count":0,"watchers_count":0,"language":"Clojure","has_issues":false,"has_projects":true,"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":"master"}},"base":{"label":"pingcap:master","ref":"master","sha":"45afa569dbaf3469c38d9779a86813e7f7355dcf","user":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars3.githubusercontent.com/u/11855343?v=4","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"repo":{"id":97575718,"name":"jepsen","full_name":"pingcap/jepsen","owner":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars3.githubusercontent.com/u/11855343?v=4","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pingcap/jepsen","description":"A framework for distributed systems verification, with fault injection","fork":true,"url":"https://api.github.com/repos/pingcap/jepsen","forks_url":"https://api.github.com/repos/pingcap/jepsen/forks","keys_url":"https://api.github.com/repos/pingcap/jepsen/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pingcap/jepsen/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pingcap/jepsen/teams","hooks_url":"https://api.github.com/repos/pingcap/jepsen/hooks","issue_events_url":"https://api.github.com/repos/pingcap/jepsen/issues/events{/number}","events_url":"https://api.github.com/repos/pingcap/jepsen/events","assignees_url":"https://api.github.com/repos/pingcap/jepsen/assignees{/user}","branches_url":"https://api.github.com/repos/pingcap/jepsen/branches{/branch}","tags_url":"https://api.github.com/repos/pingcap/jepsen/tags","blobs_url":"https://api.github.com/repos/pingcap/jepsen/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pingcap/jepsen/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pingcap/jepsen/git/refs{/sha}","trees_url":"https://api.github.com/repos/pingcap/jepsen/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pingcap/jepsen/statuses/{sha}","languages_url":"https://api.github.com/repos/pingcap/jepsen/languages","stargazers_url":"https://api.github.com/repos/pingcap/jepsen/stargazers","contributors_url":"https://api.github.com/repos/pingcap/jepsen/contributors","subscribers_url":"https://api.github.com/repos/pingcap/jepsen/subscribers","subscription_url":"https://api.github.com/repos/pingcap/jepsen/subscription","commits_url":"https://api.github.com/repos/pingcap/jepsen/commits{/sha}","git_commits_url":"https://api.github.com/repos/pingcap/jepsen/git/commits{/sha}","comments_url":"https://api.github.com/repos/pingcap/jepsen/comments{/number}","issue_comment_url":"https://api.github.com/repos/pingcap/jepsen/issues/comments{/number}","contents_url":"https://api.github.com/repos/pingcap/jepsen/contents/{+path}","compare_url":"https://api.github.com/repos/pingcap/jepsen/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pingcap/jepsen/merges","archive_url":"https://api.github.com/repos/pingcap/jepsen/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pingcap/jepsen/downloads","issues_url":"https://api.github.com/repos/pingcap/jepsen/issues{/number}","pulls_url":"https://api.github.com/repos/pingcap/jepsen/pulls{/number}","milestones_url":"https://api.github.com/repos/pingcap/jepsen/milestones{/number}","notifications_url":"https://api.github.com/repos/pingcap/jepsen/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pingcap/jepsen/labels{/name}","releases_url":"https://api.github.com/repos/pingcap/jepsen/releases{/id}","deployments_url":"https://api.github.com/repos/pingcap/jepsen/deployments","created_at":"2017-07-18T08:47:30Z","updated_at":"2017-07-18T11:17:40Z","pushed_at":"2017-07-19T03:49:05Z","git_url":"git://github.com/pingcap/jepsen.git","ssh_url":"git@github.com:pingcap/jepsen.git","clone_url":"https://github.com/pingcap/jepsen.git","svn_url":"https://github.com/pingcap/jepsen","homepage":"","size":45836,"stargazers_count":1,"watchers_count":1,"language":"Clojure","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pingcap/jepsen/pulls/2"},"html":{"href":"https://github.com/pingcap/jepsen/pull/2"},"issue":{"href":"https://api.github.com/repos/pingcap/jepsen/issues/2"},"comments":{"href":"https://api.github.com/repos/pingcap/jepsen/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/pingcap/jepsen/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/pingcap/jepsen/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pingcap/jepsen/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/pingcap/jepsen/statuses/48c589ba25d36317efaf7d208e13e686a59e97fd"}}}}
{"actor":{"display_login":"siddontang"}}