{"action":"created","comment":{"url":"https://api.github.com/repos/apache/flink/pulls/comments/209921447","pull_request_review_id":146026722,"id":209921447,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwOTkyMTQ0Nw==","diff_hunk":"@@ -66,29 +66,33 @@ public boolean isFullBuffer() {\n \t}\n \n \t/**\n-\t * Starts serializing and copying the given record to the target buffer\n-\t * (if available).\n+\t * Starts serializing the given record to an intermediate data buffer.\n \t *\n \t * @param record the record to serialize\n-\t * @return how much information was written to the target buffer and\n-\t *         whether this buffer is full\n \t */\n-\tSerializationResult addRecord(T record) throws IOException;\n+\tvoid serializeRecord(T record) throws IOException;","path":"flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/serialization/RecordSerializer.java","position":13,"original_position":13,"commit_id":"109ddb37abafcea28478b90cda10b965e0c399d5","original_commit_id":"109ddb37abafcea28478b90cda10b965e0c399d5","user":{"login":"pnowojski","id":8957547,"node_id":"MDQ6VXNlcjg5NTc1NDc=","avatar_url":"https://avatars3.githubusercontent.com/u/8957547?v=4","gravatar_id":"","url":"https://api.github.com/users/pnowojski","html_url":"https://github.com/pnowojski","followers_url":"https://api.github.com/users/pnowojski/followers","following_url":"https://api.github.com/users/pnowojski/following{/other_user}","gists_url":"https://api.github.com/users/pnowojski/gists{/gist_id}","starred_url":"https://api.github.com/users/pnowojski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pnowojski/subscriptions","organizations_url":"https://api.github.com/users/pnowojski/orgs","repos_url":"https://api.github.com/users/pnowojski/repos","events_url":"https://api.github.com/users/pnowojski/events{/privacy}","received_events_url":"https://api.github.com/users/pnowojski/received_events","type":"User","site_admin":false},"body":"Re 1.\r\n\r\nI was thinking about something along those lines, however I saw the need for `close()`, because currently `SpanningRecordSerializer` reuses for multiple records `byte[]` that hides in `dataBuffer = serializationBuffer.wrapAsByteBuffer();` call. Is there some other way to release/return this array back to `RecordSerializer`? Or maybe that proves that `RecordSerializer` and `SerializedRecord` should be indeed in one class?\r\n\r\nRe 2. \r\n\r\nI'm not sure. This one seems like it would leak `RecordSerializer serializer` private fields to `SerializedRecord`.\r\n\r\nAll in all, I'm not sure if the improvement here is worth the effort and even if we would improve/simplify code here (especially this `close()` bothers me). Also I agree that your changes in `addRecord`, `continueWritingWithNextBufferBuilder` and `copyToBufferBuilder` makes this code actually easier all in all, so I would be fine with merging it as is (modulo my other comments) :)","created_at":"2018-08-14T11:50:51Z","updated_at":"2018-08-14T11:50:51Z","html_url":"https://github.com/apache/flink/pull/6417#discussion_r209921447","pull_request_url":"https://api.github.com/repos/apache/flink/pulls/6417","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apache/flink/pulls/comments/209921447"},"html":{"href":"https://github.com/apache/flink/pull/6417#discussion_r209921447"},"pull_request":{"href":"https://api.github.com/repos/apache/flink/pulls/6417"}},"in_reply_to_id":209290889},"pull_request":{"url":"https://api.github.com/repos/apache/flink/pulls/6417","id":203788661,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAzNzg4NjYx","html_url":"https://github.com/apache/flink/pull/6417","diff_url":"https://github.com/apache/flink/pull/6417.diff","patch_url":"https://github.com/apache/flink/pull/6417.patch","issue_url":"https://api.github.com/repos/apache/flink/issues/6417","number":6417,"state":"open","locked":false,"title":"[FLINK-9913][runtime] Improve output serialization only once in RecordWriter","user":{"login":"zhijiangW","id":12387855,"node_id":"MDQ6VXNlcjEyMzg3ODU1","avatar_url":"https://avatars0.githubusercontent.com/u/12387855?v=4","gravatar_id":"","url":"https://api.github.com/users/zhijiangW","html_url":"https://github.com/zhijiangW","followers_url":"https://api.github.com/users/zhijiangW/followers","following_url":"https://api.github.com/users/zhijiangW/following{/other_user}","gists_url":"https://api.github.com/users/zhijiangW/gists{/gist_id}","starred_url":"https://api.github.com/users/zhijiangW/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhijiangW/subscriptions","organizations_url":"https://api.github.com/users/zhijiangW/orgs","repos_url":"https://api.github.com/users/zhijiangW/repos","events_url":"https://api.github.com/users/zhijiangW/events{/privacy}","received_events_url":"https://api.github.com/users/zhijiangW/received_events","type":"User","site_admin":false},"body":"## What is the purpose of the change\r\n\r\n*This pull request improves the output serialization only once for multi target channels in `RecordWriter`, rather than serialization as many times as the number of selected channels.\r\n\r\n## Brief change log\r\n\r\n  - *Only one `RecordSerializer` is created for all the output channels in `RecordWriter`*\r\n  - *Restructure the processes of `emit`, `broadcastEmit`, `randomEmit` in `RecordWriter`*\r\n  - *Restructure the interface methods in `RecordSerializer`*\r\n\r\n## Verifying this change\r\n\r\nThis change is already covered by existing tests, such as *SpanningRecordSerializationTest*, etc.\r\n\r\nAnd adds new tests in `RecordWriterTest` to verify:\r\n\r\n  - *The serialization results are correct by `RecordWriter#emit` with `BroadcastPartitioner`*\r\n  - *The serialization results are correct by `RecordWriter#broadcastEmit` directly*\r\n\r\n## Does this pull request potentially affect one of the following parts:\r\n\r\n  - Dependencies (does it add or upgrade a dependency): (no)\r\n  - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (no)\r\n  - The serializers: (yes)\r\n  - The runtime per-record code paths (performance sensitive): (yes)\r\n  - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (no)\r\n  - The S3 file system connector: (no)\r\n\r\n## Documentation\r\n\r\n  - Does this pull request introduce a new feature? (no)\r\n  - If yes, how is the feature documented? (not applicable)\r\n","created_at":"2018-07-25T10:16:26Z","updated_at":"2018-08-14T11:50:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7ced7912819c6599e0391e4294c60a4504845d90","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/flink/pulls/6417/commits","review_comments_url":"https://api.github.com/repos/apache/flink/pulls/6417/comments","review_comment_url":"https://api.github.com/repos/apache/flink/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/flink/issues/6417/comments","statuses_url":"https://api.github.com/repos/apache/flink/statuses/109ddb37abafcea28478b90cda10b965e0c399d5","head":{"label":"zhijiangW:FLINK-9913","ref":"FLINK-9913","sha":"109ddb37abafcea28478b90cda10b965e0c399d5","user":{"login":"zhijiangW","id":12387855,"node_id":"MDQ6VXNlcjEyMzg3ODU1","avatar_url":"https://avatars0.githubusercontent.com/u/12387855?v=4","gravatar_id":"","url":"https://api.github.com/users/zhijiangW","html_url":"https://github.com/zhijiangW","followers_url":"https://api.github.com/users/zhijiangW/followers","following_url":"https://api.github.com/users/zhijiangW/following{/other_user}","gists_url":"https://api.github.com/users/zhijiangW/gists{/gist_id}","starred_url":"https://api.github.com/users/zhijiangW/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhijiangW/subscriptions","organizations_url":"https://api.github.com/users/zhijiangW/orgs","repos_url":"https://api.github.com/users/zhijiangW/repos","events_url":"https://api.github.com/users/zhijiangW/events{/privacy}","received_events_url":"https://api.github.com/users/zhijiangW/received_events","type":"User","site_admin":false},"repo":{"id":60976697,"node_id":"MDEwOlJlcG9zaXRvcnk2MDk3NjY5Nw==","name":"flink","full_name":"zhijiangW/flink","owner":{"login":"zhijiangW","id":12387855,"node_id":"MDQ6VXNlcjEyMzg3ODU1","avatar_url":"https://avatars0.githubusercontent.com/u/12387855?v=4","gravatar_id":"","url":"https://api.github.com/users/zhijiangW","html_url":"https://github.com/zhijiangW","followers_url":"https://api.github.com/users/zhijiangW/followers","following_url":"https://api.github.com/users/zhijiangW/following{/other_user}","gists_url":"https://api.github.com/users/zhijiangW/gists{/gist_id}","starred_url":"https://api.github.com/users/zhijiangW/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhijiangW/subscriptions","organizations_url":"https://api.github.com/users/zhijiangW/orgs","repos_url":"https://api.github.com/users/zhijiangW/repos","events_url":"https://api.github.com/users/zhijiangW/events{/privacy}","received_events_url":"https://api.github.com/users/zhijiangW/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zhijiangW/flink","description":"Mirror of Apache Flink","fork":true,"url":"https://api.github.com/repos/zhijiangW/flink","forks_url":"https://api.github.com/repos/zhijiangW/flink/forks","keys_url":"https://api.github.com/repos/zhijiangW/flink/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zhijiangW/flink/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zhijiangW/flink/teams","hooks_url":"https://api.github.com/repos/zhijiangW/flink/hooks","issue_events_url":"https://api.github.com/repos/zhijiangW/flink/issues/events{/number}","events_url":"https://api.github.com/repos/zhijiangW/flink/events","assignees_url":"https://api.github.com/repos/zhijiangW/flink/assignees{/user}","branches_url":"https://api.github.com/repos/zhijiangW/flink/branches{/branch}","tags_url":"https://api.github.com/repos/zhijiangW/flink/tags","blobs_url":"https://api.github.com/repos/zhijiangW/flink/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zhijiangW/flink/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zhijiangW/flink/git/refs{/sha}","trees_url":"https://api.github.com/repos/zhijiangW/flink/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zhijiangW/flink/statuses/{sha}","languages_url":"https://api.github.com/repos/zhijiangW/flink/languages","stargazers_url":"https://api.github.com/repos/zhijiangW/flink/stargazers","contributors_url":"https://api.github.com/repos/zhijiangW/flink/contributors","subscribers_url":"https://api.github.com/repos/zhijiangW/flink/subscribers","subscription_url":"https://api.github.com/repos/zhijiangW/flink/subscription","commits_url":"https://api.github.com/repos/zhijiangW/flink/commits{/sha}","git_commits_url":"https://api.github.com/repos/zhijiangW/flink/git/commits{/sha}","comments_url":"https://api.github.com/repos/zhijiangW/flink/comments{/number}","issue_comment_url":"https://api.github.com/repos/zhijiangW/flink/issues/comments{/number}","contents_url":"https://api.github.com/repos/zhijiangW/flink/contents/{+path}","compare_url":"https://api.github.com/repos/zhijiangW/flink/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zhijiangW/flink/merges","archive_url":"https://api.github.com/repos/zhijiangW/flink/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zhijiangW/flink/downloads","issues_url":"https://api.github.com/repos/zhijiangW/flink/issues{/number}","pulls_url":"https://api.github.com/repos/zhijiangW/flink/pulls{/number}","milestones_url":"https://api.github.com/repos/zhijiangW/flink/milestones{/number}","notifications_url":"https://api.github.com/repos/zhijiangW/flink/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zhijiangW/flink/labels{/name}","releases_url":"https://api.github.com/repos/zhijiangW/flink/releases{/id}","deployments_url":"https://api.github.com/repos/zhijiangW/flink/deployments","created_at":"2016-06-12T16:16:49Z","updated_at":"2016-06-12T16:17:14Z","pushed_at":"2018-07-25T10:03:37Z","git_url":"git://github.com/zhijiangW/flink.git","ssh_url":"git@github.com:zhijiangW/flink.git","clone_url":"https://github.com/zhijiangW/flink.git","svn_url":"https://github.com/zhijiangW/flink","homepage":null,"size":155558,"stargazers_count":0,"watchers_count":0,"language":"Java","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":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"87bdf7eae1ef884d308d420e2acea3bccae791ed","user":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","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":20587599,"node_id":"MDEwOlJlcG9zaXRvcnkyMDU4NzU5OQ==","name":"flink","full_name":"apache/flink","owner":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","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/flink","description":"Apache Flink","fork":false,"url":"https://api.github.com/repos/apache/flink","forks_url":"https://api.github.com/repos/apache/flink/forks","keys_url":"https://api.github.com/repos/apache/flink/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/flink/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/flink/teams","hooks_url":"https://api.github.com/repos/apache/flink/hooks","issue_events_url":"https://api.github.com/repos/apache/flink/issues/events{/number}","events_url":"https://api.github.com/repos/apache/flink/events","assignees_url":"https://api.github.com/repos/apache/flink/assignees{/user}","branches_url":"https://api.github.com/repos/apache/flink/branches{/branch}","tags_url":"https://api.github.com/repos/apache/flink/tags","blobs_url":"https://api.github.com/repos/apache/flink/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/flink/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/flink/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/flink/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/flink/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/flink/languages","stargazers_url":"https://api.github.com/repos/apache/flink/stargazers","contributors_url":"https://api.github.com/repos/apache/flink/contributors","subscribers_url":"https://api.github.com/repos/apache/flink/subscribers","subscription_url":"https://api.github.com/repos/apache/flink/subscription","commits_url":"https://api.github.com/repos/apache/flink/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/flink/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/flink/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/flink/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/flink/contents/{+path}","compare_url":"https://api.github.com/repos/apache/flink/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/flink/merges","archive_url":"https://api.github.com/repos/apache/flink/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/flink/downloads","issues_url":"https://api.github.com/repos/apache/flink/issues{/number}","pulls_url":"https://api.github.com/repos/apache/flink/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/flink/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/flink/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/flink/labels{/name}","releases_url":"https://api.github.com/repos/apache/flink/releases{/id}","deployments_url":"https://api.github.com/repos/apache/flink/deployments","created_at":"2014-06-07T07:00:10Z","updated_at":"2018-08-14T11:08:17Z","pushed_at":"2018-08-14T11:06:55Z","git_url":"git://github.com/apache/flink.git","ssh_url":"git@github.com:apache/flink.git","clone_url":"https://github.com/apache/flink.git","svn_url":"https://github.com/apache/flink","homepage":"","size":162953,"stargazers_count":4164,"watchers_count":4164,"language":"Java","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2771,"mirror_url":null,"archived":false,"open_issues_count":373,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":2771,"open_issues":373,"watchers":4164,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/flink/pulls/6417"},"html":{"href":"https://github.com/apache/flink/pull/6417"},"issue":{"href":"https://api.github.com/repos/apache/flink/issues/6417"},"comments":{"href":"https://api.github.com/repos/apache/flink/issues/6417/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/flink/pulls/6417/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/flink/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/flink/pulls/6417/commits"},"statuses":{"href":"https://api.github.com/repos/apache/flink/statuses/109ddb37abafcea28478b90cda10b965e0c399d5"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"pnowojski"}}