{"action":"created","issue":{"url":"https://api.github.com/repos/apache/kafka/issues/1249","repository_url":"https://api.github.com/repos/apache/kafka","labels_url":"https://api.github.com/repos/apache/kafka/issues/1249/labels{/name}","comments_url":"https://api.github.com/repos/apache/kafka/issues/1249/comments","events_url":"https://api.github.com/repos/apache/kafka/issues/1249/events","html_url":"https://github.com/apache/kafka/pull/1249","id":150035743,"number":1249,"title":"KAFKA-3594; After calling MemoryRecords.close() method, hasRoomFor() method should return false","user":{"login":"omkreddy","id":8134545,"avatar_url":"https://avatars.githubusercontent.com/u/8134545?v=3","gravatar_id":"","url":"https://api.github.com/users/omkreddy","html_url":"https://github.com/omkreddy","followers_url":"https://api.github.com/users/omkreddy/followers","following_url":"https://api.github.com/users/omkreddy/following{/other_user}","gists_url":"https://api.github.com/users/omkreddy/gists{/gist_id}","starred_url":"https://api.github.com/users/omkreddy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omkreddy/subscriptions","organizations_url":"https://api.github.com/users/omkreddy/orgs","repos_url":"https://api.github.com/users/omkreddy/repos","events_url":"https://api.github.com/users/omkreddy/events{/privacy}","received_events_url":"https://api.github.com/users/omkreddy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-04-21T10:47:17Z","updated_at":"2016-04-21T22:12:03Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/kafka/pulls/1249","html_url":"https://github.com/apache/kafka/pull/1249","diff_url":"https://github.com/apache/kafka/pull/1249.diff","patch_url":"https://github.com/apache/kafka/pull/1249.patch"},"body":"This exception is occurring when producer is trying to append a record to a Re-enqueued record batch in the accumulator. We should not allow to add a record to Re-enqueued record batch. This is due a bug in MemoryRecords.java/hasRoomFor() method. After calling MemoryRecords.close() method, hasRoomFor() method should return false. "},"comment":{"url":"https://api.github.com/repos/apache/kafka/issues/comments/213134482","html_url":"https://github.com/apache/kafka/pull/1249#issuecomment-213134482","issue_url":"https://api.github.com/repos/apache/kafka/issues/1249","id":213134482,"user":{"login":"guozhangwang","id":10729597,"avatar_url":"https://avatars.githubusercontent.com/u/10729597?v=3","gravatar_id":"","url":"https://api.github.com/users/guozhangwang","html_url":"https://github.com/guozhangwang","followers_url":"https://api.github.com/users/guozhangwang/followers","following_url":"https://api.github.com/users/guozhangwang/following{/other_user}","gists_url":"https://api.github.com/users/guozhangwang/gists{/gist_id}","starred_url":"https://api.github.com/users/guozhangwang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guozhangwang/subscriptions","organizations_url":"https://api.github.com/users/guozhangwang/orgs","repos_url":"https://api.github.com/users/guozhangwang/repos","events_url":"https://api.github.com/users/guozhangwang/events{/privacy}","received_events_url":"https://api.github.com/users/guozhangwang/received_events","type":"User","site_admin":false},"created_at":"2016-04-21T22:12:03Z","updated_at":"2016-04-21T22:12:03Z","body":"Thanks for the catch @omkreddy. I was intended the code as ```return this.writable && (this.compressor.numRecordsWritten() == 0 ?\r\n            this.initialCapacity >= Records.LOG_OVERHEAD + Record.recordSize(key, value) :\r\n            this.writeLimit >= this.compressor.estimatedBytesWritten() + Records.LOG_OVERHEAD + Record.recordSize(key, value));```  when I wrote it but obviously I got the Java Operator Precedence wrong.\r\n\r\nLGTM and merged to trunk."}}