You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "Josh Elser (JIRA)" <ji...@apache.org> on 2019/01/09 20:41:00 UTC

[jira] [Updated] (RATIS-471) `LogReader#readNext()` should return null or throw an error when reading off the end of the Log

     [ https://issues.apache.org/jira/browse/RATIS-471?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Josh Elser updated RATIS-471:
-----------------------------
    Fix Version/s: 0.4.0

> `LogReader#readNext()` should return null or throw an error when reading off the end of the Log
> -----------------------------------------------------------------------------------------------
>
>                 Key: RATIS-471
>                 URL: https://issues.apache.org/jira/browse/RATIS-471
>             Project: Ratis
>          Issue Type: Bug
>          Components: LogService
>            Reporter: Josh Elser
>            Priority: Major
>             Fix For: 0.4.0
>
>
> {code:java}
>     @Test
>     public void testReadOffEndOfLog() throws Exception {
>       try (LogServiceClient client = new LogServiceClient(cluster.getMetaIdentity())) {
>         LogStream stream = client.createLog(LogName.of("testReadWrite"));
>         LogWriter writer = stream.createWriter();
>         String message = "Hello world!";
>         ByteBuffer testMessage =  ByteBuffer.wrap(message.getBytes());
>         writer.write(testMessage);
>         LogReader reader = stream.createReader();
>         ByteBuffer res = reader.readNext();
>         assertEquals(message, ByteBufferUtils.toStringUtf8(res));
>         // readNext() should return `null` when there is no remaining record
>         res = reader.readNext();
>         assertNull(res);
>       }
>     }
> {code}
> The above test test should either pass (or throw an exception on the second {{readNext()}} call), but hangs indefinitely. We should be able to catch this.
> FYI [~vrodionov], [~rajeshbabu]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)