You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "Tsz Wo Nicholas Sze (JIRA)" <ji...@apache.org> on 2017/04/13 10:15:41 UTC

[jira] [Commented] (RATIS-70) Separate term/index/offset and log entry content in LogSegment

    [ https://issues.apache.org/jira/browse/RATIS-70?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15967374#comment-15967374 ] 

Tsz Wo Nicholas Sze commented on RATIS-70:
------------------------------------------

Thanks Jing for the patch.  This is a good idea to only keep track of TermIndex.

Some comments:
- It look like that LogSegment.configEntries is not needed since the entry is in entryCache.  We may implement isConfigEntry as below.
{code}
  boolean isConfigEntry(TermIndex ti) {
    final LogEntryProto entry = entryCache.get(ti);
    return entry != null && ProtoUtils.isConfigurationLogEntry(entry);
  }
{code}

- LogRecord should remain static.

- Use Math.toIntExact(..) when casting long to int so that it will check for overflow.

- Move RaftLog.EMPTY_TERMINDEX_ARRAY to TermIndex.  Also, {{new TermIndex\[0]}} can be replaced by {}, i.e.
{code}
public interface TermIndex extends Comparable<TermIndex> {
  TermIndex[] EMPTY_ARRAY = {};
  ...
}
{code}


> Separate term/index/offset and log entry content in LogSegment
> --------------------------------------------------------------
>
>                 Key: RATIS-70
>                 URL: https://issues.apache.org/jira/browse/RATIS-70
>             Project: Ratis
>          Issue Type: Sub-task
>            Reporter: Jing Zhao
>            Assignee: Jing Zhao
>         Attachments: RATIS-70.000.patch, RATIS-70.001.patch
>
>
> The current RaftLogCache consists of LogSegment, and logSegment consists of log entries. Instead of directly storing all the log entries, we should separate the term/index/offset information and the entry content information. The former part is more like the index information and can be always kept in the memory. The entry content part can later be evicted from the memory based on eviction policies.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)