apache/druid · warning

Not adding or running callbacks for existing segment

Error message

Not adding or running callbacks for existing segment[%s] on server[%s]

What it means

When a sync reports a segment that the server's inventory already contains, HttpServerInventoryView skips adding it and skips segmentAdded callbacks. For delta syncs this is unexpected enough to warn about; for full syncs duplicates are expected after a reset, so no warning is emitted.

Solutions

  1. Ignore when it appears only after fullSync/reset — it is expected and benign.
  2. If warnings recur on delta sync, restart the affected data server to re-baseline its segment inventory.
  3. Check the data server's segment announcement logic for duplicate announcements of the same segment id.
  4. Verify no middle-manager/task is publishing the same segment id concurrently (duplicate ingestion).
Defensive patterns

Strategy: validation

Validate before calling

if (!serverInventory.containsKey(segment.getId())) { view.addSegment(...); }

Prevention

When it happens

Trigger: addSegment is called from fullSync or deltaSync with a segment whose id already exists on the druidServer and whose fingerprint/profile is unchanged; in delta sync this indicates the data server re-sent an already-known segment in its delta inventory.

Common situations: Data server sent a delta that overlaps with existing inventory after a dropped/partially-applied earlier delta; a 'reset' triggered a fullSync that re-delivers known segments (normal, silent); race between two sync responses for the same server.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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

Appendix: source

Thrown at server/src/main/java/org/apache/druid/client/HttpServerInventoryView.java:665

          runSegmentCallbacks(
              new Function<>()
              {
                @Override
                public CallbackAction apply(SegmentCallback input)
                {
                  return input.segmentAdded(druidServer.getMetadata(), theSegment);
                }
              }
          );
        } else if (!Objects.equals(druidServer.getPartialLoadProfile(segment.getId()), profile)) {
          // Already present, but the per-server partial-load profile changed (e.g. the historical re-announced after
          // an additive reload swapped the wrapper / fingerprint). Update the inventory state in place; the segment
          // is still on this server, only the profile metadata changed, so don't fire segmentAdded/segmentRemoved
          // callbacks
          druidServer.updateDataSegmentProfile(segment, profile);
        } else if (!fullSync) {
          // duplicates can happen when doing a full sync from a 'reset', so only warn for dupes on delta changes
          log.warn(
              "Not adding or running callbacks for existing segment[%s] on server[%s]",
              segment.getId(),
              druidServer.getName()
          );
        }
      }
    }

    /**
     * Builds a {@link PartialLoadProfile} from a load announcement when the historical populated the partial-load
     * wire fields ({@code fingerprint} + {@code loadedBytes}). Returns {@code null} for plain full-load
     * announcements, or defensively when a fingerprint/loadedBytes pair arrives without a partial-load wrapper on
     * the segment's load spec (a wire-form contract violation from the historical).
     */
    @Nullable
    private static PartialLoadProfile partialLoadProfileFor(SegmentChangeRequestLoad loadRequest)
    {
      final String fingerprint = loadRequest.getFingerprint();

View on GitHub (pinned to 9b90983fd2)