apache/druid · error

Failed to delete pending segments for datasource

Error message

Failed to delete pending segments for datasource[%s] and interval[%s].

What it means

The Overlord REST endpoint for killing pending segments (DELETE /druid/indexer/v1/pendingSegments) failed with a non-DruidException error while deleting pending segments for the given datasource and interval. The server logs the exception and returns HTTP 500.

Solutions

  1. Check the Overlord log for the full stack trace above this warning
  2. Verify metadata storage connectivity and health (connection pools, DB availability)
  3. Retry the kill call; ensure the coordinator can acquire segment locks for the interval
  4. Confirm the datasource exists and pending segments are stored in the configured metadata store
Defensive patterns

Strategy: retry

Validate before calling

// Pre-check datasource exists before calling kill pending segments
// GET /druid/indexer/v1/datasources/{ds} returns 200

Try / catch

try { killPendingSegments(ds, interval); } catch (WebApplicationException e) { if (e.getResponse().getStatus() == 500) { /* retry with backoff after checking metadata store health */ } }

Prevention

When it happens

Trigger: POST/DELETE to the pendingSegments kill endpoint when the underlying metadata storage delete (via IndexerMetadataStorageCoordinator.deletePendingSegments) throws a generic Exception.

Common situations: Metadata store (e.g. MySQL/PostgreSQL) connectivity problems; lock contention or timeout acquiring datasource/interval locks; datasource metadata not initialized; transient DB errors.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/e891ab781c4bead9. Report an issue: GitHub.

Appendix: source

Thrown at indexing-service/src/main/java/org/apache/druid/indexing/overlord/http/OverlordResource.java:680

        authorizerMapper
    );

    if (!authResult.allowAccessWithNoRestriction()) {
      throw new ForbiddenException(authResult.getErrorMessage());
    }

    if (overlord.isLeader()) {
      try {
        final int numDeleted = indexerMetadataStorageAdapter.deletePendingSegments(dataSource, deleteInterval);
        return Response.ok().entity(ImmutableMap.of("numDeleted", numDeleted)).build();
      }
      catch (DruidException e) {
        return Response.status(e.getStatusCode())
                       .entity(ImmutableMap.<String, Object>of("error", e.getMessage()))
                       .build();
      }
      catch (Exception e) {
        log.warn(
            e,
            "Failed to delete pending segments for datasource[%s] and interval[%s].",
            dataSource,
            deleteInterval
        );
        return Response.status(Status.INTERNAL_SERVER_ERROR)
                       .entity(ImmutableMap.<String, Object>of("error", e.getMessage()))
                       .build();
      }
    } else {
      return Response.status(Status.SERVICE_UNAVAILABLE)
                     .entity(ImmutableMap.of("error", "overlord is not the leader or not initialized yet"))
                     .build();
    }
  }

  @GET
  @Path("/workers")

View on GitHub (pinned to 9b90983fd2)