{"action":"created","comment":{"url":"https://api.github.com/repos/pingcap/tidb-bench/pulls/comments/43491719","id":43491719,"diff_hunk":"@@ -84,37 +86,64 @@ func mustExec(sqlStmt string) {\n \t}\n }\n \n+func query(sqlStmt string) (*sql.Rows, error) {\n+\tdb := connPool.Get().(*sql.DB)\n+\tdefer connPool.Put(db)\n+\tlog.Debug(\"query sql:\", sqlStmt)\n+\trows, err := db.Query(sqlStmt)\n+\treturn rows, err\n+}\n+func checkQuery(sqlStmt string, expectRows int) {\n+\trows, err := query(sqlStmt)\n+\tif err != nil {\n+\t\tlog.Error(sqlStmt)\n+\t}\n+\tactGot := 0\n+\tfor rows.Next() {\n+\t\tactGot++\n+\t\tif actGot > expectRows {\n+\t\t\tlog.Fatal(fmt.Sprintf(\"sql return count does not match. actual got %d great than expect %d\\n\", actGot, expectRows))\n+\t\t\tbreak\n+\t\t}\n+\t}\n+\tif actGot < expectRows {\n+\t\tlog.Fatal(fmt.Sprintf(\"sql return count does not match. actual got %d less than expect %d\\n\", actGot, expectRows))\n+\t}\n+}\n+\n func timing(desc string, fn func()) {\n \tfmt.Printf(\"%s ... [START]\\n\", desc)\n \tc := time.Now()\n \tfn()\n-\tfmt.Printf(\"%s ... elapse : %v [DONE]\\n\", desc, time.Since(c))\n+\tfmt.Printf(\"%s ... elapse : %fs [DONE]\\n\", desc, time.Since(c).Seconds())\n }\n \n+func doInsertTestData(workerId int, wg *sync.WaitGroup, idChan chan int) {\n+\tdefer wg.Done()\n+\tfor {\n+\t\tid, ok := <-idChan\n+\t\t// All data are sent\n+\t\tif !ok {\n+\t\t\treturn\n+\t\t}\n+\t\tvar bulks []string\n+\t\tfor i := 0; i < *nCols; i++ {\n+\t\t\t// Fill dummy data, and generate SQL\n+\t\t\tbuf := bytes.Repeat([]byte{'A'}, *bulkSize)\n+\t\t\tbulks = append(bulks, fmt.Sprintf(\"\\\"%s\\\"\", string(buf)))\n+\t\t}\n+\t\tsql := fmt.Sprintf(\"INSERT INTO %s VALUES(%d, %s);\", tableName, id, strings.Join(bulks, \",\"))\n+\t\tmustExec(sql)\n+\t}\n+}\n func insertTestData(rows int, workers int) error {\n+\tcreateTable(ForceDrop)","path":"main.go","position":72,"original_position":72,"commit_id":"a9215589d4790474e03015d419ec603f8e076334","original_commit_id":"a9215589d4790474e03015d419ec603f8e076334","user":{"login":"c4pt0r","id":773853,"avatar_url":"https://avatars.githubusercontent.com/u/773853?v=3","gravatar_id":"","url":"https://api.github.com/users/c4pt0r","html_url":"https://github.com/c4pt0r","followers_url":"https://api.github.com/users/c4pt0r/followers","following_url":"https://api.github.com/users/c4pt0r/following{/other_user}","gists_url":"https://api.github.com/users/c4pt0r/gists{/gist_id}","starred_url":"https://api.github.com/users/c4pt0r/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/c4pt0r/subscriptions","organizations_url":"https://api.github.com/users/c4pt0r/orgs","repos_url":"https://api.github.com/users/c4pt0r/repos","events_url":"https://api.github.com/users/c4pt0r/events{/privacy}","received_events_url":"https://api.github.com/users/c4pt0r/received_events","type":"User","site_admin":false},"body":"Use lowercase.\r\n You should never use uppercase except it's an exported function/variable.","created_at":"2015-10-30T11:13:57Z","updated_at":"2015-10-30T11:13:57Z","html_url":"https://github.com/pingcap/tidb-bench/pull/1#discussion_r43491719","pull_request_url":"https://api.github.com/repos/pingcap/tidb-bench/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/pingcap/tidb-bench/pulls/comments/43491719"},"html":{"href":"https://github.com/pingcap/tidb-bench/pull/1#discussion_r43491719"},"pull_request":{"href":"https://api.github.com/repos/pingcap/tidb-bench/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/pingcap/tidb-bench/pulls/1","id":49119847,"html_url":"https://github.com/pingcap/tidb-bench/pull/1","diff_url":"https://github.com/pingcap/tidb-bench/pull/1.diff","patch_url":"https://github.com/pingcap/tidb-bench/pull/1.patch","issue_url":"https://api.github.com/repos/pingcap/tidb-bench/issues/1","number":1,"state":"open","locked":false,"title":"bench: add insert with prepare and select point/range test","user":{"login":"c4pt0r","id":773853,"avatar_url":"https://avatars.githubusercontent.com/u/773853?v=3","gravatar_id":"","url":"https://api.github.com/users/c4pt0r","html_url":"https://github.com/c4pt0r","followers_url":"https://api.github.com/users/c4pt0r/followers","following_url":"https://api.github.com/users/c4pt0r/following{/other_user}","gists_url":"https://api.github.com/users/c4pt0r/gists{/gist_id}","starred_url":"https://api.github.com/users/c4pt0r/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/c4pt0r/subscriptions","organizations_url":"https://api.github.com/users/c4pt0r/orgs","repos_url":"https://api.github.com/users/c4pt0r/repos","events_url":"https://api.github.com/users/c4pt0r/events{/privacy}","received_events_url":"https://api.github.com/users/c4pt0r/received_events","type":"User","site_admin":false},"body":"1. select range test may cost tons of time now, make N smaller (e.g.: 100)\r\n2. modify cost time unit to second fixedly instead of %v","created_at":"2015-10-29T10:14:49Z","updated_at":"2015-10-30T11:13:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"acb434103e982586b3da3100d8fed4e8603839d1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pingcap/tidb-bench/pulls/1/commits","review_comments_url":"https://api.github.com/repos/pingcap/tidb-bench/pulls/1/comments","review_comment_url":"https://api.github.com/repos/pingcap/tidb-bench/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pingcap/tidb-bench/issues/1/comments","statuses_url":"https://api.github.com/repos/pingcap/tidb-bench/statuses/a9215589d4790474e03015d419ec603f8e076334","head":{"label":"pingcap:morefreeze/insert_and_select","ref":"morefreeze/insert_and_select","sha":"a9215589d4790474e03015d419ec603f8e076334","user":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars.githubusercontent.com/u/11855343?v=3","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":44891880,"name":"tidb-bench","full_name":"pingcap/tidb-bench","owner":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars.githubusercontent.com/u/11855343?v=3","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/tidb-bench","description":"A Simple Benchmark For TiDB","fork":false,"url":"https://api.github.com/repos/pingcap/tidb-bench","forks_url":"https://api.github.com/repos/pingcap/tidb-bench/forks","keys_url":"https://api.github.com/repos/pingcap/tidb-bench/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pingcap/tidb-bench/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pingcap/tidb-bench/teams","hooks_url":"https://api.github.com/repos/pingcap/tidb-bench/hooks","issue_events_url":"https://api.github.com/repos/pingcap/tidb-bench/issues/events{/number}","events_url":"https://api.github.com/repos/pingcap/tidb-bench/events","assignees_url":"https://api.github.com/repos/pingcap/tidb-bench/assignees{/user}","branches_url":"https://api.github.com/repos/pingcap/tidb-bench/branches{/branch}","tags_url":"https://api.github.com/repos/pingcap/tidb-bench/tags","blobs_url":"https://api.github.com/repos/pingcap/tidb-bench/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pingcap/tidb-bench/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pingcap/tidb-bench/git/refs{/sha}","trees_url":"https://api.github.com/repos/pingcap/tidb-bench/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pingcap/tidb-bench/statuses/{sha}","languages_url":"https://api.github.com/repos/pingcap/tidb-bench/languages","stargazers_url":"https://api.github.com/repos/pingcap/tidb-bench/stargazers","contributors_url":"https://api.github.com/repos/pingcap/tidb-bench/contributors","subscribers_url":"https://api.github.com/repos/pingcap/tidb-bench/subscribers","subscription_url":"https://api.github.com/repos/pingcap/tidb-bench/subscription","commits_url":"https://api.github.com/repos/pingcap/tidb-bench/commits{/sha}","git_commits_url":"https://api.github.com/repos/pingcap/tidb-bench/git/commits{/sha}","comments_url":"https://api.github.com/repos/pingcap/tidb-bench/comments{/number}","issue_comment_url":"https://api.github.com/repos/pingcap/tidb-bench/issues/comments{/number}","contents_url":"https://api.github.com/repos/pingcap/tidb-bench/contents/{+path}","compare_url":"https://api.github.com/repos/pingcap/tidb-bench/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pingcap/tidb-bench/merges","archive_url":"https://api.github.com/repos/pingcap/tidb-bench/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pingcap/tidb-bench/downloads","issues_url":"https://api.github.com/repos/pingcap/tidb-bench/issues{/number}","pulls_url":"https://api.github.com/repos/pingcap/tidb-bench/pulls{/number}","milestones_url":"https://api.github.com/repos/pingcap/tidb-bench/milestones{/number}","notifications_url":"https://api.github.com/repos/pingcap/tidb-bench/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pingcap/tidb-bench/labels{/name}","releases_url":"https://api.github.com/repos/pingcap/tidb-bench/releases{/id}","created_at":"2015-10-25T01:26:33Z","updated_at":"2015-10-25T01:42:10Z","pushed_at":"2015-10-30T09:46:15Z","git_url":"git://github.com/pingcap/tidb-bench.git","ssh_url":"git@github.com:pingcap/tidb-bench.git","clone_url":"https://github.com/pingcap/tidb-bench.git","svn_url":"https://github.com/pingcap/tidb-bench","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"pingcap:master","ref":"master","sha":"6206c35242c365f559fbc5fc22d9ccd84c8547bc","user":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars.githubusercontent.com/u/11855343?v=3","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":44891880,"name":"tidb-bench","full_name":"pingcap/tidb-bench","owner":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars.githubusercontent.com/u/11855343?v=3","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/tidb-bench","description":"A Simple Benchmark For TiDB","fork":false,"url":"https://api.github.com/repos/pingcap/tidb-bench","forks_url":"https://api.github.com/repos/pingcap/tidb-bench/forks","keys_url":"https://api.github.com/repos/pingcap/tidb-bench/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pingcap/tidb-bench/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pingcap/tidb-bench/teams","hooks_url":"https://api.github.com/repos/pingcap/tidb-bench/hooks","issue_events_url":"https://api.github.com/repos/pingcap/tidb-bench/issues/events{/number}","events_url":"https://api.github.com/repos/pingcap/tidb-bench/events","assignees_url":"https://api.github.com/repos/pingcap/tidb-bench/assignees{/user}","branches_url":"https://api.github.com/repos/pingcap/tidb-bench/branches{/branch}","tags_url":"https://api.github.com/repos/pingcap/tidb-bench/tags","blobs_url":"https://api.github.com/repos/pingcap/tidb-bench/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pingcap/tidb-bench/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pingcap/tidb-bench/git/refs{/sha}","trees_url":"https://api.github.com/repos/pingcap/tidb-bench/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pingcap/tidb-bench/statuses/{sha}","languages_url":"https://api.github.com/repos/pingcap/tidb-bench/languages","stargazers_url":"https://api.github.com/repos/pingcap/tidb-bench/stargazers","contributors_url":"https://api.github.com/repos/pingcap/tidb-bench/contributors","subscribers_url":"https://api.github.com/repos/pingcap/tidb-bench/subscribers","subscription_url":"https://api.github.com/repos/pingcap/tidb-bench/subscription","commits_url":"https://api.github.com/repos/pingcap/tidb-bench/commits{/sha}","git_commits_url":"https://api.github.com/repos/pingcap/tidb-bench/git/commits{/sha}","comments_url":"https://api.github.com/repos/pingcap/tidb-bench/comments{/number}","issue_comment_url":"https://api.github.com/repos/pingcap/tidb-bench/issues/comments{/number}","contents_url":"https://api.github.com/repos/pingcap/tidb-bench/contents/{+path}","compare_url":"https://api.github.com/repos/pingcap/tidb-bench/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pingcap/tidb-bench/merges","archive_url":"https://api.github.com/repos/pingcap/tidb-bench/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pingcap/tidb-bench/downloads","issues_url":"https://api.github.com/repos/pingcap/tidb-bench/issues{/number}","pulls_url":"https://api.github.com/repos/pingcap/tidb-bench/pulls{/number}","milestones_url":"https://api.github.com/repos/pingcap/tidb-bench/milestones{/number}","notifications_url":"https://api.github.com/repos/pingcap/tidb-bench/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pingcap/tidb-bench/labels{/name}","releases_url":"https://api.github.com/repos/pingcap/tidb-bench/releases{/id}","created_at":"2015-10-25T01:26:33Z","updated_at":"2015-10-25T01:42:10Z","pushed_at":"2015-10-30T09:46:15Z","git_url":"git://github.com/pingcap/tidb-bench.git","ssh_url":"git@github.com:pingcap/tidb-bench.git","clone_url":"https://github.com/pingcap/tidb-bench.git","svn_url":"https://github.com/pingcap/tidb-bench","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pingcap/tidb-bench/pulls/1"},"html":{"href":"https://github.com/pingcap/tidb-bench/pull/1"},"issue":{"href":"https://api.github.com/repos/pingcap/tidb-bench/issues/1"},"comments":{"href":"https://api.github.com/repos/pingcap/tidb-bench/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/pingcap/tidb-bench/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/pingcap/tidb-bench/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pingcap/tidb-bench/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/pingcap/tidb-bench/statuses/a9215589d4790474e03015d419ec603f8e076334"}}}}