Class ContainerController

java.lang.Object
org.apache.hadoop.ozone.container.ozoneimpl.ContainerController

public class ContainerController extends Object
Control plane for container management in datanode.
  • Constructor Details

    • ContainerController

      public ContainerController(ContainerSet containerSet, Map<org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerType,Handler> handlers)
  • Method Details

    • getContainer

      public Container getContainer(long containerId)
      Returns the Container given a container id.
      Parameters:
      containerId - ID of the container
      Returns:
      Container
    • getContainerLocation

      public String getContainerLocation(long containerId)
    • markContainerForClose

      public void markContainerForClose(long containerId) throws IOException
      Marks the container for closing. Moves the container to CLOSING state.
      Parameters:
      containerId - Id of the container to update
      Throws:
      IOException - in case of exception
    • markContainerUnhealthy

      public boolean markContainerUnhealthy(long containerId, ScanResult reason) throws IOException
      Marks the container as UNHEALTHY.
      Parameters:
      containerId - Id of the container to update
      reason - The reason the container was marked unhealthy
      Throws:
      IOException - in case of exception
    • updateContainerChecksum

      public void updateContainerChecksum(long containerId, ContainerMerkleTreeWriter treeWriter) throws IOException
      Updates the container checksum information on disk and in memory.
      Parameters:
      containerId - The ID of the container to update
      treeWriter - The container merkle tree with the updated information about the container
      Throws:
      IOException - For errors sending an ICR or updating the container checksum on disk. If the disk update fails, the checksum in memory will not be updated.
    • getContainerReport

      public org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.ContainerReportsProto getContainerReport() throws IOException
      Returns the container report.
      Returns:
      ContainerReportsProto
      Throws:
      IOException - in case of exception
    • quasiCloseContainer

      public void quasiCloseContainer(long containerId, String reason) throws IOException
      Quasi closes a container given its id.
      Parameters:
      containerId - Id of the container to quasi close
      reason - The reason the container was quasi closed, for logging purposes.
      Throws:
      IOException - in case of exception
    • closeContainer

      public void closeContainer(long containerId) throws IOException
      Closes a container given its Id.
      Parameters:
      containerId - Id of the container to close
      Throws:
      IOException - in case of exception
    • addFinalizedBlock

      public void addFinalizedBlock(long containerId, long localId)
      Returns the Container given a container id.
      Parameters:
      containerId - ID of the container
    • isFinalizedBlockExist

      public boolean isFinalizedBlockExist(long containerId, long localId)
    • importContainer

      public Container importContainer(ContainerData containerData, InputStream rawContainerStream, TarContainerPacker packer) throws IOException
      Throws:
      IOException
    • exportContainer

      public void exportContainer(org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerType type, long containerId, OutputStream outputStream, TarContainerPacker packer) throws IOException
      Throws:
      IOException
    • deleteContainer

      public void deleteContainer(long containerId, boolean force) throws IOException
      Deletes a container given its Id.
      Parameters:
      containerId - Id of the container to be deleted
      force - if this is set to true, we delete container without checking state of the container.
      Throws:
      IOException
    • reconcileContainer

      public void reconcileContainer(DNContainerOperationClient dnClient, long containerID, Set<org.apache.hadoop.hdds.protocol.DatanodeDetails> peers) throws IOException
      Throws:
      IOException
    • getContainers

      public Iterable<Container<?>> getContainers()
    • getContainers

      public Iterator<Container<?>> getContainers(HddsVolume volume)
      Return an iterator of containers which are associated with the specified volume.
      Parameters:
      volume - the HDDS volume which should be used to filter containers
      Returns:
      Iterator<Container>
    • getContainerCount

      public long getContainerCount(HddsVolume volume)
      Get the number of containers based on the given volume.
      Parameters:
      volume - hdds volume.
      Returns:
      number of containers.