Class ContainerController
java.lang.Object
org.apache.hadoop.ozone.container.ozoneimpl.ContainerController
Control plane for container management in datanode.
-
Constructor Summary
ConstructorsConstructorDescriptionContainerController(ContainerSet containerSet, Map<org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerType, Handler> handlers) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFinalizedBlock(long containerId, long localId) Returns the Container given a container id.voidcloseContainer(long containerId) Closes a container given its Id.voiddeleteContainer(long containerId, boolean force) Deletes a container given its Id.voidexportContainer(org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerType type, long containerId, OutputStream outputStream, TarContainerPacker packer) getContainer(long containerId) Returns the Container given a container id.longgetContainerCount(HddsVolume volume) Get the number of containers based on the given volume.getContainerLocation(long containerId) org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.ContainerReportsProtoReturns the container report.getContainers(HddsVolume volume) Return an iterator of containers which are associated with the specifiedvolume.importContainer(ContainerData containerData, InputStream rawContainerStream, TarContainerPacker packer) booleanisFinalizedBlockExist(long containerId, long localId) voidmarkContainerForClose(long containerId) Marks the container for closing.booleanmarkContainerUnhealthy(long containerId, ScanResult reason) Marks the container as UNHEALTHY.voidquasiCloseContainer(long containerId, String reason) Quasi closes a container given its id.voidreconcileContainer(DNContainerOperationClient dnClient, long containerID, Set<org.apache.hadoop.hdds.protocol.DatanodeDetails> peers) voidupdateContainerChecksum(long containerId, ContainerMerkleTreeWriter treeWriter) Updates the container checksum information on disk and in memory.
-
Constructor Details
-
ContainerController
public ContainerController(ContainerSet containerSet, Map<org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerType, Handler> handlers)
-
-
Method Details
-
getContainer
Returns the Container given a container id.- Parameters:
containerId- ID of the container- Returns:
- Container
-
getContainerLocation
-
markContainerForClose
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
Marks the container as UNHEALTHY.- Parameters:
containerId- Id of the container to updatereason- 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 updatetreeWriter- 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 IOExceptionReturns the container report.- Returns:
- ContainerReportsProto
- Throws:
IOException- in case of exception
-
quasiCloseContainer
Quasi closes a container given its id.- Parameters:
containerId- Id of the container to quasi closereason- The reason the container was quasi closed, for logging purposes.- Throws:
IOException- in case of exception
-
closeContainer
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
Deletes a container given its Id.- Parameters:
containerId- Id of the container to be deletedforce- 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
-
getContainers
Return an iterator of containers which are associated with the specifiedvolume.- Parameters:
volume- the HDDS volume which should be used to filter containers- Returns:
- Iterator<Container>
-
getContainerCount
Get the number of containers based on the given volume.- Parameters:
volume- hdds volume.- Returns:
- number of containers.
-