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

Tsz Wo Nicholas Sze updated HDFS-13173:
---------------------------------------
    Component/s: snapshots

Hi Shashikant, thanks for working on this.  Let's have a 
DirectoryDiffListFactory in order to avoid adding the skipInteval and 
maxSkipLevels parameters to many methods.
{code}
/** For creating {@link DiffList} for {@link DirectoryDiff}. */
public abstract class DirectoryDiffListFactory {
  public static DiffList<DirectoryDiff> createDiffList(int capacity) {
    return CONSTRUCTOR.apply(capacity);
  }

  public static void init(Configuration conf) {
    final int maxSkipLevels = conf.getInt(
        DFSConfigKeys.DFS_NAMENODE_SNAPSHOT_SKIPLIST_MAX_LEVELS,
        DFSConfigKeys.DFS_NAMENODE_SNAPSHOT_SKIPLIST_MAX_SKIP_LEVELS_DEFAULT);
    if (maxSkipLevels > 0) {
      final int skipInteval = conf.getInt(
          DFSConfigKeys.DFS_NAMENODE_SNAPSHOT_SKIPLIST_SKIP_INTERVAL,
          DFSConfigKeys.DFS_NAMENODE_SNAPSHOT_SKIPLIST_SKIP_INTERVAL_DEFAULT);
      CONSTRUCTOR = c -> new DiffListBySkipList(c, skipInteval, maxSkipLevels);
    }
  }

  private static volatile IntFunction<DiffList<DirectoryDiff>> CONSTRUCTOR
      = c -> new DiffListByArrayList<>(c);

  private DirectoryDiffListFactory() {}
}
{code}

> Replace ArrayList with DirectoryDiffList(SnapshotSkipList) to store 
> DirectoryDiffs
> ----------------------------------------------------------------------------------
>
>                 Key: HDFS-13173
>                 URL: https://issues.apache.org/jira/browse/HDFS-13173
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: snapshots
>            Reporter: Shashikant Banerjee
>            Assignee: Shashikant Banerjee
>            Priority: Major
>         Attachments: HDFS-13173.001.patch
>
>
> This Jira will replace the existing ArrayList with DirectoryDiffList to store 
> directory diffs for snapshots based on the config value of maxSkipLevels. If 
> the config specified is set to greater than 0, SnapshotSkipList will be used 
> to store DirectoryDiffs  else ArrayList will be used. The config value is set 
> to 0 by default.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to