Class TransportAbstractBulkAction

Direct Known Subclasses:
TransportBulkAction, TransportSimulateBulkAction

public abstract class TransportAbstractBulkAction extends HandledTransportAction<BulkRequest,BulkResponse>
This is an abstract base class for bulk actions. It traverses all indices that the request gets routed to, executes all applicable pipelines, and then delegates to the concrete implementation of #doInternalExecute to actually index the data.
  • Field Details

    • threadPool

      protected final ThreadPool threadPool
    • clusterService

      protected final ClusterService clusterService
    • indexingPressure

      protected final IndexingPressure indexingPressure
    • systemIndices

      protected final SystemIndices systemIndices
    • relativeTimeNanosProvider

      protected final LongSupplier relativeTimeNanosProvider
    • writeExecutor

      protected final Executor writeExecutor
    • systemWriteExecutor

      protected final Executor systemWriteExecutor
  • Constructor Details

  • Method Details

    • doExecute

      protected void doExecute(Task task, BulkRequest bulkRequest, ActionListener<BulkResponse> listener)
      Specified by:
      doExecute in class TransportAction<BulkRequest,BulkResponse>
    • resolveFailureStore

      protected abstract Boolean resolveFailureStore(String indexName, Metadata metadata, long epochMillis)
      Determines if an index name is associated with either an existing data stream or a template for one that has the failure store enabled.
      Parameters:
      indexName - The index name to check.
      metadata - Cluster state metadata.
      epochMillis - A timestamp to use when resolving date math in the index name.
      Returns:
      true if this is not a simulation, and the given index name corresponds to a data stream with a failure store, or if it matches a template that has a data stream failure store enabled, or if it matches a data stream template with no failure store option specified and the name matches the cluster setting to enable the failure store. Returns false if the index name corresponds to a data stream, but it doesn't have the failure store enabled by one of those conditions. Returns null when it doesn't correspond to a data stream.
    • getIndexWriteRequest

      public static IndexRequest getIndexWriteRequest(DocWriteRequest<?> docWriteRequest)
      Retrieves the IndexRequest from the provided DocWriteRequest for index or upsert actions. Upserts are modeled as IndexRequest inside the UpdateRequest. Ignores DeleteRequest's
      Parameters:
      docWriteRequest - The request to find the IndexRequest
      Returns:
      the found IndexRequest or null if one can not be found.
    • getIngestService

      protected IngestService getIngestService(BulkRequest request)
    • relativeTimeNanos

      protected long relativeTimeNanos()
    • buildTookInMillis

      protected long buildTookInMillis(long startTimeNanos)
    • doInternalExecute

      protected abstract void doInternalExecute(Task task, BulkRequest bulkRequest, Executor executor, ActionListener<BulkResponse> listener, long relativeStartTimeNanos) throws IOException
      This method creates any missing resources and actually applies the BulkRequest to the relevant indices
      Parameters:
      task - The task in which this work is being done
      bulkRequest - The BulkRequest of changes to make to indices
      executor - The executor for the thread pool in which the work is to be done
      listener - The listener to be notified of results
      relativeStartTimeNanos - The relative start time of this bulk load, to be used in computing the time taken for the BulkResponse
      Throws:
      IOException