apache/druid · error · IllegalStateException

Unable to reset metadata

Error message

Unable to reset metadata

What it means

When resetting 'all' metadata (resetMetadata with no specific partitions / metadata-only reset), the supervisor attempts to update the stored metadata via indexerMetadataStorageCoordinator; if that update returns false (the stored metadata could not be reset, e.g. because stored state is null or incompatible), an ISE 'Unable to reset metadata' is thrown.

Solutions

  1. Ensure the supervisor has persisted metadata before attempting a metadata-only reset
  2. Reset with full partition/offset metadata that matches the stored type instead
  3. Inspect stored supervisor metadata in the metadata store and clean stale rows if of the wrong type

Example fix

null
Defensive patterns

Strategy: validation

Validate before calling

DataSourceMetadata stored = coordinator.retrieveDataSourceMetadata(supervisorId);
if (stored == null) {
  log.warn("No stored metadata to reset for %s; skipping metadata-only reset", supervisorId);
  return;
}

Try / catch

try {
  supervisor.resetMetadata(metadata);
} catch (IllegalStateException e) {
  if ("Unable to reset metadata".equals(e.getMessage())) {
    log.warn("Metadata store had nothing compatible to reset; falling back to full partition reset");
  } else throw e;
}

Prevention

When it happens

Trigger: Calling reset with DataSourceMetadataResetless/metadata-only style requests when retrieveDataSourceMetadata returns null or the coordinator's resetDataSourceMetadata returns false because there is no stored metadata to reset or it doesn't match.

Common situations: Resetting metadata for a supervisor that has never persisted offsets yet; mismatch between stored metadata type and supervisor type making the coordinator's update a no-op returning false.

Related errors


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

Appendix: source

Thrown at indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java:2242

        }
        if (metadataUpdateSuccess) {
          resetMetadata.getSeekableStreamSequenceNumbers()
                       .getPartitionSequenceNumberMap()
                       .keySet()
                       .forEach(partition -> {
                         final int groupId = getTaskGroupIdForPartition(partition);
                         killTaskGroupForPartitions(
                             ImmutableSet.of(partition),
                             "DataSourceMetadata is updated while reset"
                         );
                         activelyReadingTaskGroups.remove(groupId);
                         // killTaskGroupForPartitions() cleans up partitionGroups.
                         // Add the removed groups back.
                         partitionGroups.computeIfAbsent(groupId, k -> new HashSet<>());
                         partitionOffsets.put(partition, getNotSetMarker());
                       });
        } else {
          throw new ISE("Unable to reset metadata");
        }
      } else {
        log.warn(
            "Reset metadata stream [%s] and supervisor's stream name [%s] do not match",
            resetMetadata.getSeekableStreamSequenceNumbers().getStream(),
            ioConfig.getStream()
        );
      }
    }
  }

  /**
   * Reset offsets with the data source metadata. If checkpoints exist, the resulting stored offsets will be a union of
   * existing checkpointed offsets and provided offsets; any checkpointed offsets not specified in the metadata will be
   * preserved as-is. If checkpoints don't exist, the provided reset datasource metadata will be inserted into
   * the metadata storage. Once the offsets are reset, any active tasks serving the partition offsets will be restarted.
   * @param dataSourceMetadata Required reset data source metadata. Assumed that the metadata is validated.
   */

View on GitHub (pinned to 9b90983fd2)