Class DeleteBlocksCommandHandler
java.lang.Object
org.apache.hadoop.ozone.container.common.statemachine.commandhandler.DeleteBlocksCommandHandler
- All Implemented Interfaces:
CommandHandler
Handle block deletion commands.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThis class represents the result of executing a delete block transaction.static final classA delete command info.final classProcess delete commands.final classProcess one delete transaction.static interfaceThe SchemaHandler interface provides a contract for handling KeyValueContainerData and DeletedBlocksTransaction based on different schema versions. -
Constructor Summary
ConstructorsConstructorDescriptionDeleteBlocksCommandHandler(OzoneContainer container, org.apache.hadoop.hdds.conf.ConfigurationSource conf, DatanodeConfiguration dnConf, String threadNamePrefix) -
Method Summary
Modifier and TypeMethodDescriptionList<org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.ContainerBlocksDeletionACKProto.DeleteBlockTransactionResult> executeCmdWithRetry(List<org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.DeletedBlocksTransaction> transactions) longReturns the average time this function takes to run.org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.SCMCommandProto.TypeReturns the command type that this command handler handles.intReturns number of times this handler has been invoked.intThe count returned here, is the count of queued SCM delete block commands.intReturns the number of threads currently executing tasks in the thread pool for this handler.If the subclass does not override this method, the default implementation will return -1, indicating that the number of active threads is not applicable or not defined.intReturns the maximum number of threads allowed in the thread pool for this handler.longReturns the total time this function takes to run.voidhandle(SCMCommand<?> command, OzoneContainer container, StateContext context, SCMConnectionManager connectionManager) Handles a given SCM command.voidhandleTasksResults(List<Future<DeleteBlocksCommandHandler.DeleteBlockTransactionExecutionResult>> futures, Consumer<DeleteBlocksCommandHandler.DeleteBlockTransactionExecutionResult> handler) static booleanisDuplicateTransaction(long containerId, KeyValueContainerData containerData, org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.DeletedBlocksTransaction delTX, BlockDeletingServiceMetrics metrics) voidsetPoolSize(int size) voidstop()Override for any command with an internal threadpool, and stop the executor when this method is invoked.submitTasks(List<org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.DeletedBlocksTransaction> deletedBlocksTransactions) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.ozone.container.common.statemachine.commandhandler.CommandHandler
updateCommandStatus
-
Constructor Details
-
DeleteBlocksCommandHandler
public DeleteBlocksCommandHandler(OzoneContainer container, org.apache.hadoop.hdds.conf.ConfigurationSource conf, DatanodeConfiguration dnConf, String threadNamePrefix)
-
-
Method Details
-
handle
public void handle(SCMCommand<?> command, OzoneContainer container, StateContext context, SCMConnectionManager connectionManager) Description copied from interface:CommandHandlerHandles a given SCM command.- Specified by:
handlein interfaceCommandHandler- Parameters:
command- - SCM Commandcontainer- - Ozone Container.context- - Current Context.connectionManager- - The SCMs that we are talking to.
-
getQueuedCount
public int getQueuedCount()The count returned here, is the count of queued SCM delete block commands. We get at most one such command per heartbeat, but the command can contain many blocks to delete.- Specified by:
getQueuedCountin interfaceCommandHandler- Returns:
- The number of SCM delete block commands pending in the queue.
-
getThreadPoolMaxPoolSize
public int getThreadPoolMaxPoolSize()Description copied from interface:CommandHandlerReturns the maximum number of threads allowed in the thread pool for this handler. If the subclass does not override this method, the default implementation will return -1, indicating that the maximum pool size is not applicable or not defined.- Specified by:
getThreadPoolMaxPoolSizein interfaceCommandHandler- Returns:
- The maximum number of threads allowed in the thread pool, or -1 if not applicable or not defined.
-
getThreadPoolActivePoolSize
public int getThreadPoolActivePoolSize()Description copied from interface:CommandHandlerReturns the number of threads currently executing tasks in the thread pool for this handler.If the subclass does not override this method, the default implementation will return -1, indicating that the number of active threads is not applicable or not defined.- Specified by:
getThreadPoolActivePoolSizein interfaceCommandHandler- Returns:
- The number of threads currently executing tasks in the thread pool, or -1 if not applicable or not defined.
-
executeCmdWithRetry
-
submitTasks
public List<Future<DeleteBlocksCommandHandler.DeleteBlockTransactionExecutionResult>> submitTasks(List<org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.DeletedBlocksTransaction> deletedBlocksTransactions) -
handleTasksResults
public void handleTasksResults(List<Future<DeleteBlocksCommandHandler.DeleteBlockTransactionExecutionResult>> futures, Consumer<DeleteBlocksCommandHandler.DeleteBlockTransactionExecutionResult> handler) -
isDuplicateTransaction
public static boolean isDuplicateTransaction(long containerId, KeyValueContainerData containerData, org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.DeletedBlocksTransaction delTX, BlockDeletingServiceMetrics metrics) -
getCommandType
public org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.SCMCommandProto.Type getCommandType()Description copied from interface:CommandHandlerReturns the command type that this command handler handles.- Specified by:
getCommandTypein interfaceCommandHandler- Returns:
- Type
-
getInvocationCount
public int getInvocationCount()Description copied from interface:CommandHandlerReturns number of times this handler has been invoked.- Specified by:
getInvocationCountin interfaceCommandHandler- Returns:
- int
-
getAverageRunTime
public long getAverageRunTime()Description copied from interface:CommandHandlerReturns the average time this function takes to run.- Specified by:
getAverageRunTimein interfaceCommandHandler- Returns:
- long
-
getTotalRunTime
public long getTotalRunTime()Description copied from interface:CommandHandlerReturns the total time this function takes to run.- Specified by:
getTotalRunTimein interfaceCommandHandler- Returns:
- long
-
stop
public void stop()Description copied from interface:CommandHandlerOverride for any command with an internal threadpool, and stop the executor when this method is invoked.- Specified by:
stopin interfaceCommandHandler
-
getSchemaHandlers
-
getBlockDeleteMetrics
-
getExecutor
-
setPoolSize
public void setPoolSize(int size)
-