{"action":"created","comment":{"url":"https://api.github.com/repos/google/trillian/pulls/comments/175536166","pull_request_review_id":105081278,"id":175536166,"diff_hunk":"@@ -500,6 +513,52 @@ func (t *logTreeTX) QueueLeaves(ctx context.Context, leaves []*trillian.LogLeaf,\n \treturn existingLeaves, nil\n }\n \n+func (t *logTreeTX) AddSequencedLeaves(ctx context.Context, leaves []*trillian.LogLeaf) ([]*trillian.QueuedLogLeaf, error) {\n+\tres := make([]*trillian.QueuedLogLeaf, len(leaves))\n+\tok := status.New(codes.OK, \"OK\").Proto()\n+\n+\t// Note: Leaves are sorted by LeafIndex, so no deterministic reordering is\n+\t// necessary to avoid deadlocks.\n+\tfor i, leaf := range leaves {\n+\t\t// This should fail on insert, but catch it early.\n+\t\tif got, want := len(leaf.LeafIdentityHash), t.hashSizeBytes; got != want {\n+\t\t\treturn nil, status.Errorf(codes.FailedPrecondition, \"leaves[%d] has incorrect hash size %d, want %d\", i, got, want)\n+\t\t}\n+\n+\t\tres[i] = &trillian.QueuedLogLeaf{Status: ok}\n+\n+\t\t// TODO(pavelkalinnikov): Measure latencies.\n+\t\t_, err := t.tx.ExecContext(ctx, insertLeafDataSQL,\n+\t\t\tt.treeID, leaf.LeafIdentityHash, leaf.LeafValue, leaf.ExtraData, 0)\n+\t\t// Note: QueueTimestamp == 0 because the entry bypasses the queue.\n+\t\t// TODO(pavelkalinnikov): Fix integration latency metrics.\n+\n+\t\t// TODO(pavelkalinnikov): Support opting out from duplicates detection.\n+\t\tif isDuplicateErr(err) {\n+\t\t\tres[i].Status = status.New(codes.FailedPrecondition, \"conflicting LeafIdentityHash\").Proto()\n+\t\t\tcontinue\n+\t\t} else if err != nil {\n+\t\t\tglog.Warningf(\"Error inserting leaves[%d] into LeafData: %s\", i, err)\n+\t\t\treturn nil, err\n+\t\t}\n+\n+\t\t_, err = t.tx.ExecContext(ctx, insertSequencedLeafSQL,\n+\t\t\tt.treeID, leaf.LeafIdentityHash, leaf.MerkleLeafHash, leaf.LeafIndex, 0)\n+\t\t// TODO(pavelkalinnikov): Update IntegrateTimestamp on integrating the leaf.\n+\n+\t\tif isDuplicateErr(err) {","path":"storage/mysql/log_storage.go","position":101,"original_position":101,"commit_id":"68a5b5eb819c028ff5c1a81929fd89b695dd1072","original_commit_id":"68a5b5eb819c028ff5c1a81929fd89b695dd1072","user":{"login":"pavelkalinnikov","id":3757441,"avatar_url":"https://avatars0.githubusercontent.com/u/3757441?v=4","gravatar_id":"","url":"https://api.github.com/users/pavelkalinnikov","html_url":"https://github.com/pavelkalinnikov","followers_url":"https://api.github.com/users/pavelkalinnikov/followers","following_url":"https://api.github.com/users/pavelkalinnikov/following{/other_user}","gists_url":"https://api.github.com/users/pavelkalinnikov/gists{/gist_id}","starred_url":"https://api.github.com/users/pavelkalinnikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pavelkalinnikov/subscriptions","organizations_url":"https://api.github.com/users/pavelkalinnikov/orgs","repos_url":"https://api.github.com/users/pavelkalinnikov/repos","events_url":"https://api.github.com/users/pavelkalinnikov/events{/privacy}","received_events_url":"https://api.github.com/users/pavelkalinnikov/received_events","type":"User","site_admin":false},"body":"Yes, this works. Will update the PR shortly.","created_at":"2018-03-19T18:15:45Z","updated_at":"2018-03-19T18:18:03Z","html_url":"https://github.com/google/trillian/pull/1036#discussion_r175536166","pull_request_url":"https://api.github.com/repos/google/trillian/pulls/1036","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/google/trillian/pulls/comments/175536166"},"html":{"href":"https://github.com/google/trillian/pull/1036#discussion_r175536166"},"pull_request":{"href":"https://api.github.com/repos/google/trillian/pulls/1036"}},"in_reply_to_id":175148791},"pull_request":{"url":"https://api.github.com/repos/google/trillian/pulls/1036","id":172285627,"html_url":"https://github.com/google/trillian/pull/1036","diff_url":"https://github.com/google/trillian/pull/1036.diff","patch_url":"https://github.com/google/trillian/pull/1036.patch","issue_url":"https://api.github.com/repos/google/trillian/issues/1036","number":1036,"state":"open","locked":false,"title":"Implement AddSequencedLeaves in MySQL storage","user":{"login":"pavelkalinnikov","id":3757441,"avatar_url":"https://avatars0.githubusercontent.com/u/3757441?v=4","gravatar_id":"","url":"https://api.github.com/users/pavelkalinnikov","html_url":"https://github.com/pavelkalinnikov","followers_url":"https://api.github.com/users/pavelkalinnikov/followers","following_url":"https://api.github.com/users/pavelkalinnikov/following{/other_user}","gists_url":"https://api.github.com/users/pavelkalinnikov/gists{/gist_id}","starred_url":"https://api.github.com/users/pavelkalinnikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pavelkalinnikov/subscriptions","organizations_url":"https://api.github.com/users/pavelkalinnikov/orgs","repos_url":"https://api.github.com/users/pavelkalinnikov/repos","events_url":"https://api.github.com/users/pavelkalinnikov/events{/privacy}","received_events_url":"https://api.github.com/users/pavelkalinnikov/received_events","type":"User","site_admin":false},"body":"This is a stub which does not yet fully implement the API contract, in particular it doesn't return duplicates if any.","created_at":"2018-03-01T16:26:05Z","updated_at":"2018-03-19T18:18:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"988dae08b70443cf091c8550c96f30a4fd54c7e3","assignee":null,"assignees":[],"requested_reviewers":[{"login":"daviddrysdale","id":457208,"avatar_url":"https://avatars3.githubusercontent.com/u/457208?v=4","gravatar_id":"","url":"https://api.github.com/users/daviddrysdale","html_url":"https://github.com/daviddrysdale","followers_url":"https://api.github.com/users/daviddrysdale/followers","following_url":"https://api.github.com/users/daviddrysdale/following{/other_user}","gists_url":"https://api.github.com/users/daviddrysdale/gists{/gist_id}","starred_url":"https://api.github.com/users/daviddrysdale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daviddrysdale/subscriptions","organizations_url":"https://api.github.com/users/daviddrysdale/orgs","repos_url":"https://api.github.com/users/daviddrysdale/repos","events_url":"https://api.github.com/users/daviddrysdale/events{/privacy}","received_events_url":"https://api.github.com/users/daviddrysdale/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":389540533,"url":"https://api.github.com/repos/google/trillian/labels/cla:%20yes","name":"cla: yes","color":"0e8a16","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/google/trillian/pulls/1036/commits","review_comments_url":"https://api.github.com/repos/google/trillian/pulls/1036/comments","review_comment_url":"https://api.github.com/repos/google/trillian/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/trillian/issues/1036/comments","statuses_url":"https://api.github.com/repos/google/trillian/statuses/68a5b5eb819c028ff5c1a81929fd89b695dd1072","head":{"label":"pavelkalinnikov:mysql_add_sequenced_leaves","ref":"mysql_add_sequenced_leaves","sha":"68a5b5eb819c028ff5c1a81929fd89b695dd1072","user":{"login":"pavelkalinnikov","id":3757441,"avatar_url":"https://avatars0.githubusercontent.com/u/3757441?v=4","gravatar_id":"","url":"https://api.github.com/users/pavelkalinnikov","html_url":"https://github.com/pavelkalinnikov","followers_url":"https://api.github.com/users/pavelkalinnikov/followers","following_url":"https://api.github.com/users/pavelkalinnikov/following{/other_user}","gists_url":"https://api.github.com/users/pavelkalinnikov/gists{/gist_id}","starred_url":"https://api.github.com/users/pavelkalinnikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pavelkalinnikov/subscriptions","organizations_url":"https://api.github.com/users/pavelkalinnikov/orgs","repos_url":"https://api.github.com/users/pavelkalinnikov/repos","events_url":"https://api.github.com/users/pavelkalinnikov/events{/privacy}","received_events_url":"https://api.github.com/users/pavelkalinnikov/received_events","type":"User","site_admin":false},"repo":{"id":110741687,"name":"trillian","full_name":"pavelkalinnikov/trillian","owner":{"login":"pavelkalinnikov","id":3757441,"avatar_url":"https://avatars0.githubusercontent.com/u/3757441?v=4","gravatar_id":"","url":"https://api.github.com/users/pavelkalinnikov","html_url":"https://github.com/pavelkalinnikov","followers_url":"https://api.github.com/users/pavelkalinnikov/followers","following_url":"https://api.github.com/users/pavelkalinnikov/following{/other_user}","gists_url":"https://api.github.com/users/pavelkalinnikov/gists{/gist_id}","starred_url":"https://api.github.com/users/pavelkalinnikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pavelkalinnikov/subscriptions","organizations_url":"https://api.github.com/users/pavelkalinnikov/orgs","repos_url":"https://api.github.com/users/pavelkalinnikov/repos","events_url":"https://api.github.com/users/pavelkalinnikov/events{/privacy}","received_events_url":"https://api.github.com/users/pavelkalinnikov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pavelkalinnikov/trillian","description":"Trillian implements a Merkle tree whose contents are served from a data storage layer, to allow scalability to extremely large trees.","fork":true,"url":"https://api.github.com/repos/pavelkalinnikov/trillian","forks_url":"https://api.github.com/repos/pavelkalinnikov/trillian/forks","keys_url":"https://api.github.com/repos/pavelkalinnikov/trillian/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pavelkalinnikov/trillian/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pavelkalinnikov/trillian/teams","hooks_url":"https://api.github.com/repos/pavelkalinnikov/trillian/hooks","issue_events_url":"https://api.github.com/repos/pavelkalinnikov/trillian/issues/events{/number}","events_url":"https://api.github.com/repos/pavelkalinnikov/trillian/events","assignees_url":"https://api.github.com/repos/pavelkalinnikov/trillian/assignees{/user}","branches_url":"https://api.github.com/repos/pavelkalinnikov/trillian/branches{/branch}","tags_url":"https://api.github.com/repos/pavelkalinnikov/trillian/tags","blobs_url":"https://api.github.com/repos/pavelkalinnikov/trillian/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pavelkalinnikov/trillian/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pavelkalinnikov/trillian/git/refs{/sha}","trees_url":"https://api.github.com/repos/pavelkalinnikov/trillian/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pavelkalinnikov/trillian/statuses/{sha}","languages_url":"https://api.github.com/repos/pavelkalinnikov/trillian/languages","stargazers_url":"https://api.github.com/repos/pavelkalinnikov/trillian/stargazers","contributors_url":"https://api.github.com/repos/pavelkalinnikov/trillian/contributors","subscribers_url":"https://api.github.com/repos/pavelkalinnikov/trillian/subscribers","subscription_url":"https://api.github.com/repos/pavelkalinnikov/trillian/subscription","commits_url":"https://api.github.com/repos/pavelkalinnikov/trillian/commits{/sha}","git_commits_url":"https://api.github.com/repos/pavelkalinnikov/trillian/git/commits{/sha}","comments_url":"https://api.github.com/repos/pavelkalinnikov/trillian/comments{/number}","issue_comment_url":"https://api.github.com/repos/pavelkalinnikov/trillian/issues/comments{/number}","contents_url":"https://api.github.com/repos/pavelkalinnikov/trillian/contents/{+path}","compare_url":"https://api.github.com/repos/pavelkalinnikov/trillian/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pavelkalinnikov/trillian/merges","archive_url":"https://api.github.com/repos/pavelkalinnikov/trillian/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pavelkalinnikov/trillian/downloads","issues_url":"https://api.github.com/repos/pavelkalinnikov/trillian/issues{/number}","pulls_url":"https://api.github.com/repos/pavelkalinnikov/trillian/pulls{/number}","milestones_url":"https://api.github.com/repos/pavelkalinnikov/trillian/milestones{/number}","notifications_url":"https://api.github.com/repos/pavelkalinnikov/trillian/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pavelkalinnikov/trillian/labels{/name}","releases_url":"https://api.github.com/repos/pavelkalinnikov/trillian/releases{/id}","deployments_url":"https://api.github.com/repos/pavelkalinnikov/trillian/deployments","created_at":"2017-11-14T20:35:12Z","updated_at":"2018-03-19T14:35:39Z","pushed_at":"2018-03-19T17:59:22Z","git_url":"git://github.com/pavelkalinnikov/trillian.git","ssh_url":"git@github.com:pavelkalinnikov/trillian.git","clone_url":"https://github.com/pavelkalinnikov/trillian.git","svn_url":"https://github.com/pavelkalinnikov/trillian","homepage":"","size":9513,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":false,"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":"google:master","ref":"master","sha":"6643c651bdaeba34e463a07d777b05768de5f89c","user":{"login":"google","id":1342004,"avatar_url":"https://avatars1.githubusercontent.com/u/1342004?v=4","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":58654489,"name":"trillian","full_name":"google/trillian","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars1.githubusercontent.com/u/1342004?v=4","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/trillian","description":"Trillian implements a Merkle tree whose contents are served from a data storage layer, to allow scalability to extremely large trees.","fork":false,"url":"https://api.github.com/repos/google/trillian","forks_url":"https://api.github.com/repos/google/trillian/forks","keys_url":"https://api.github.com/repos/google/trillian/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/trillian/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/trillian/teams","hooks_url":"https://api.github.com/repos/google/trillian/hooks","issue_events_url":"https://api.github.com/repos/google/trillian/issues/events{/number}","events_url":"https://api.github.com/repos/google/trillian/events","assignees_url":"https://api.github.com/repos/google/trillian/assignees{/user}","branches_url":"https://api.github.com/repos/google/trillian/branches{/branch}","tags_url":"https://api.github.com/repos/google/trillian/tags","blobs_url":"https://api.github.com/repos/google/trillian/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/trillian/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/trillian/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/trillian/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/trillian/statuses/{sha}","languages_url":"https://api.github.com/repos/google/trillian/languages","stargazers_url":"https://api.github.com/repos/google/trillian/stargazers","contributors_url":"https://api.github.com/repos/google/trillian/contributors","subscribers_url":"https://api.github.com/repos/google/trillian/subscribers","subscription_url":"https://api.github.com/repos/google/trillian/subscription","commits_url":"https://api.github.com/repos/google/trillian/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/trillian/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/trillian/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/trillian/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/trillian/contents/{+path}","compare_url":"https://api.github.com/repos/google/trillian/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/trillian/merges","archive_url":"https://api.github.com/repos/google/trillian/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/trillian/downloads","issues_url":"https://api.github.com/repos/google/trillian/issues{/number}","pulls_url":"https://api.github.com/repos/google/trillian/pulls{/number}","milestones_url":"https://api.github.com/repos/google/trillian/milestones{/number}","notifications_url":"https://api.github.com/repos/google/trillian/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/trillian/labels{/name}","releases_url":"https://api.github.com/repos/google/trillian/releases{/id}","deployments_url":"https://api.github.com/repos/google/trillian/deployments","created_at":"2016-05-12T15:37:35Z","updated_at":"2018-03-19T16:31:45Z","pushed_at":"2018-03-19T17:59:23Z","git_url":"git://github.com/google/trillian.git","ssh_url":"git@github.com:google/trillian.git","clone_url":"https://github.com/google/trillian.git","svn_url":"https://github.com/google/trillian","homepage":"","size":9471,"stargazers_count":854,"watchers_count":854,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":118,"mirror_url":null,"archived":false,"open_issues_count":37,"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":118,"open_issues":37,"watchers":854,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google/trillian/pulls/1036"},"html":{"href":"https://github.com/google/trillian/pull/1036"},"issue":{"href":"https://api.github.com/repos/google/trillian/issues/1036"},"comments":{"href":"https://api.github.com/repos/google/trillian/issues/1036/comments"},"review_comments":{"href":"https://api.github.com/repos/google/trillian/pulls/1036/comments"},"review_comment":{"href":"https://api.github.com/repos/google/trillian/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/trillian/pulls/1036/commits"},"statuses":{"href":"https://api.github.com/repos/google/trillian/statuses/68a5b5eb819c028ff5c1a81929fd89b695dd1072"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"pavelkalinnikov"}}