Class NameNodeConnector

java.lang.Object
org.apache.hadoop.hdfs.server.balancer.NameNodeConnector
All Implemented Interfaces:
Closeable, AutoCloseable

@Private public class NameNodeConnector extends Object implements Closeable
The class provides utilities for accessing a NameNode.
  • Field Details

    • DEFAULT_MAX_IDLE_ITERATIONS

      public static final int DEFAULT_MAX_IDLE_ITERATIONS
      See Also:
  • Constructor Details

    • NameNodeConnector

      public NameNodeConnector(String name, URI nameNodeUri, org.apache.hadoop.fs.Path idPath, List<org.apache.hadoop.fs.Path> targetPaths, org.apache.hadoop.conf.Configuration conf, int maxNotChangedIterations) throws IOException
      Throws:
      IOException
    • NameNodeConnector

      public NameNodeConnector(String name, URI nameNodeUri, String nsId, org.apache.hadoop.fs.Path idPath, List<org.apache.hadoop.fs.Path> targetPaths, org.apache.hadoop.conf.Configuration conf, int maxNotChangedIterations) throws IOException
      Throws:
      IOException
  • Method Details

    • newNameNodeConnectors

      public static List<NameNodeConnector> newNameNodeConnectors(Collection<URI> namenodes, String name, org.apache.hadoop.fs.Path idPath, org.apache.hadoop.conf.Configuration conf, int maxIdleIterations) throws IOException
      Create NameNodeConnector for the given namenodes.
      Throws:
      IOException
    • newNameNodeConnectors

      public static List<NameNodeConnector> newNameNodeConnectors(Map<URI,List<org.apache.hadoop.fs.Path>> namenodes, String name, org.apache.hadoop.fs.Path idPath, org.apache.hadoop.conf.Configuration conf, int maxIdleIterations) throws IOException
      Throws:
      IOException
    • newNameNodeConnectors

      public static List<NameNodeConnector> newNameNodeConnectors(Collection<URI> namenodes, Collection<String> nsIds, String name, org.apache.hadoop.fs.Path idPath, org.apache.hadoop.conf.Configuration conf, int maxIdleIterations) throws IOException
      Throws:
      IOException
    • setWrite2IdFile

      @VisibleForTesting public static void setWrite2IdFile(boolean write2IdFile)
    • checkOtherInstanceRunning

      @VisibleForTesting public static void checkOtherInstanceRunning(boolean toCheck)
    • getDistributedFileSystem

      public org.apache.hadoop.hdfs.DistributedFileSystem getDistributedFileSystem()
    • getBlockpoolID

      public String getBlockpoolID()
      Returns:
      the block pool ID
    • getBytesMoved

      public AtomicLong getBytesMoved()
    • getBlocksMoved

      public AtomicLong getBlocksMoved()
    • getBlocksFailed

      public AtomicLong getBlocksFailed()
    • addBytesMoved

      public void addBytesMoved(long numBytes)
    • getNameNodeUri

      public URI getNameNodeUri()
    • getBlocks

      public BlocksWithLocations getBlocks(org.apache.hadoop.hdfs.protocol.DatanodeInfo datanode, long size, long minBlockSize, long timeInterval, org.apache.hadoop.fs.StorageType storageType) throws IOException
      Returns:
      blocks with locations.
      Throws:
      IOException
    • isUpgrading

      public boolean isUpgrading() throws IOException
      Returns:
      true if an upgrade is in progress, false if not.
      Throws:
      IOException
    • getLiveDatanodeStorageReport

      public org.apache.hadoop.hdfs.server.protocol.DatanodeStorageReport[] getLiveDatanodeStorageReport() throws IOException
      Returns:
      live datanode storage reports.
      Throws:
      IOException
    • getKeyManager

      public KeyManager getKeyManager()
      Returns:
      the key manager
    • getTargetPaths

      public List<org.apache.hadoop.fs.Path> getTargetPaths()
      Returns:
      the list of paths to scan/migrate
    • shouldContinue

      public boolean shouldContinue(long dispatchBlockMoveBytes)
      Should the instance continue running?
    • getFallbackToSimpleAuth

      public AtomicBoolean getFallbackToSimpleAuth()
      Returns fallbackToSimpleAuth. This will be true or false during calls to indicate if a secure client falls back to simple auth.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • getNNProtocolConnection

      public NamenodeProtocol getNNProtocolConnection()
    • toString

      public String toString()
      Overrides:
      toString in class Object