java.lang.Object
org.apache.hadoop.ozone.container.common.statemachine.commandhandler.DeleteBlocksCommandHandler
All Implemented Interfaces:
CommandHandler

public class DeleteBlocksCommandHandler extends Object implements CommandHandler
Handle block deletion commands.
  • Constructor Details

  • Method Details

    • handle

      public void handle(SCMCommand<?> command, OzoneContainer container, StateContext context, SCMConnectionManager connectionManager)
      Description copied from interface: CommandHandler
      Handles a given SCM command.
      Specified by:
      handle in interface CommandHandler
      Parameters:
      command - - SCM Command
      container - - 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:
      getQueuedCount in interface CommandHandler
      Returns:
      The number of SCM delete block commands pending in the queue.
    • getThreadPoolMaxPoolSize

      public int getThreadPoolMaxPoolSize()
      Description copied from interface: CommandHandler
      Returns 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:
      getThreadPoolMaxPoolSize in interface CommandHandler
      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: CommandHandler
      Returns 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:
      getThreadPoolActivePoolSize in interface CommandHandler
      Returns:
      The number of threads currently executing tasks in the thread pool, or -1 if not applicable or not defined.
    • executeCmdWithRetry

      public List<org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.ContainerBlocksDeletionACKProto.DeleteBlockTransactionResult> executeCmdWithRetry(List<org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.DeletedBlocksTransaction> transactions)
    • submitTasks

      public List<Future<DeleteBlocksCommandHandler.DeleteBlockTransactionExecutionResult>> submitTasks(List<org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.DeletedBlocksTransaction> deletedBlocksTransactions)
    • handleTasksResults

    • 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: CommandHandler
      Returns the command type that this command handler handles.
      Specified by:
      getCommandType in interface CommandHandler
      Returns:
      Type
    • getInvocationCount

      public int getInvocationCount()
      Description copied from interface: CommandHandler
      Returns number of times this handler has been invoked.
      Specified by:
      getInvocationCount in interface CommandHandler
      Returns:
      int
    • getAverageRunTime

      public long getAverageRunTime()
      Description copied from interface: CommandHandler
      Returns the average time this function takes to run.
      Specified by:
      getAverageRunTime in interface CommandHandler
      Returns:
      long
    • getTotalRunTime

      public long getTotalRunTime()
      Description copied from interface: CommandHandler
      Returns the total time this function takes to run.
      Specified by:
      getTotalRunTime in interface CommandHandler
      Returns:
      long
    • stop

      public void stop()
      Description copied from interface: CommandHandler
      Override for any command with an internal threadpool, and stop the executor when this method is invoked.
      Specified by:
      stop in interface CommandHandler
    • getSchemaHandlers

    • getBlockDeleteMetrics

      public BlockDeletingServiceMetrics getBlockDeleteMetrics()
    • getExecutor

      public ThreadPoolExecutor getExecutor()
    • setPoolSize

      public void setPoolSize(int size)