You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "Hanisha Koneru (Jira)" <ji...@apache.org> on 2020/05/14 17:55:00 UTC

[jira] [Created] (RATIS-937) Loading of open segments always throws corrupted segment warning

Hanisha Koneru created RATIS-937:
------------------------------------

             Summary: Loading of open segments always throws corrupted segment warning
                 Key: RATIS-937
                 URL: https://issues.apache.org/jira/browse/RATIS-937
             Project: Ratis
          Issue Type: Bug
            Reporter: Hanisha Koneru
            Assignee: Hanisha Koneru


When an open log segment is loaded, it always logs a warning that the segment is corrupted.
{code:java}
Segment file is corrupted: expected to have -43 entries but only 8 entries read successfully
{code}

LogSegment#loadSegment() has the following check for corruption:
{code:java}
final int expectedEntryCount = Math.toIntExact(end - start + 1);
final boolean corrupted = entryCount != expectedEntryCount;
if (corrupted) {
  LOG.warn("Segment file is corrupted: expected to have {} entries but only {} entries read successfully",
      expectedEntryCount, entryCount);
}
{code}
But the _end_ is always INVALID_LOG_INDEX (-1) for an open segment.
Before this check, entries are appended to the segment. So theĀ _end_ variable should be updated with the correct endIndex of the segment before checking for corruption.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)