[ https://issues.apache.org/jira/browse/RATIS-274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16652660#comment-16652660 ]
Ted Yu commented on RATIS-274: ------------------------------ {code} + public ByteBuffer readNext() throws IOException { + int num = 1; + RaftClientReply reply = + raftClient.sendReadOnly(Message.valueOf(LogServiceProtoUtil + .toReadLogRequestProto(parent.getName(), currentRecordId, num) {code} It seems num is not modified within the method. It can be hardcoded directly. {code} + proto.getLogRecord(0); {code} The above line can be removed. {code} + if (proto.hasException()) { + LogServiceException e = proto.getException(); + throw new IOException(e.getErrorMsg()); {code} It would be better to wrap IOE around the exception, e, so that we have more clue as for the cause. It seems the body of the two {{readNext}} methods can be unified - they look mostly the same. {code} + currentRecordId+= numRecords; + List<ByteBuffer> ret = new ArrayList<ByteBuffer>(); + int n = proto.getLogRecordCount(); {code} Should we check n == numRecords ? {code} + public Collection<RecordListener> getRecordListeners() { + return listeners; {code} I think returning unmodifiable collection would be better. {code} + List<RecordListener> listeners; {code} If order of listeners is not important, Set can be used. > Read/Write-path of log stream state machine > ------------------------------------------- > > Key: RATIS-274 > URL: https://issues.apache.org/jira/browse/RATIS-274 > Project: Ratis > Issue Type: Sub-task > Components: LogService > Reporter: Josh Elser > Assignee: Vladimir Rodionov > Priority: Major > Attachments: RATIS-274-v1.patch, RATIS-274-v2.patch > > > Implement the ability to read/write data to a log stream. -- This message was sent by Atlassian JIRA (v7.6.3#76005)