apache/druid · error · IllegalStateException

Unable to reset metadata

Error message

Unable to reset metadata[%s] for supervisor[%s] for dataSource[%s]

What it means

When resetting offsets for specific partitions, the supervisor issues metadata-store updates for each sequence and tracks success in metadataUpdateSuccess. If any update fails (coordinator returned false, e.g. stored metadata is null or of a mismatched type) after retries, an ISE is thrown identifying the supervisor and datasource, indicating offsets were not reset.

Solutions

  1. Verify the supervisor has persisted offsets in the metadata store before resetting; if not, there is nothing to reset
  2. Clean the stored datasource metadata so its type matches the supervisor, then retry the reset
  3. Check metadata storage health/connectivity and coordinator logs for the underlying false return

Example fix

null
Defensive patterns

Strategy: validation

Validate before calling

DataSourceMetadata stored = coordinator.retrieveDataSourceMetadata(supervisorId);
if (stored == null || !checkSourceMetadataMatch(stored)) {
  throw new IllegalStateException("Stored metadata missing or incompatible; offsets cannot be reset");
}

Try / catch

try {
  supervisor.resetOffsets(metadata);
} catch (IllegalStateException e) {
  if (e.getMessage().startsWith("Unable to reset metadata")) {
    // clean stored metadata of the correct type, then retry the reset
  } else throw e;
}

Prevention

When it happens

Trigger: resetOffsetsAndUpdateDataSourceMetadata calls resetDataSourceMetadata on the coordinator which returns false — typically because retrieveDataSourceMetadata returned null (supervisor never persisted offsets) or stored metadata class doesn't match the requested type.

Common situations: Resetting offsets for a fresh supervisor with no prior checkpoints; metadata store holding incompatible metadata after a supervisor-type change; metadata storage (e.g. derby/mysql) issues during update.

Related errors


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

Appendix: source

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

            metadata.getClass()
        );
      }
      @SuppressWarnings("unchecked")
      final SeekableStreamDataSourceMetadata<PartitionIdType, SequenceOffsetType> currentMetadata =
          (SeekableStreamDataSourceMetadata<PartitionIdType, SequenceOffsetType>) metadata;
      final DataSourceMetadata newMetadata = currentMetadata.plus(resetMetadata);
      log.info("Current checkpointed metadata[%s], new metadata[%s] for supervisor[%s] for dataSource[%s]", currentMetadata, newMetadata, supervisorId, dataSource);
      try {
        metadataUpdateSuccess = indexerMetadataStorageCoordinator.resetDataSourceMetadata(supervisorId, newMetadata);
      }
      catch (IOException e) {
        log.error("Reset offsets for supervisor[%s] for dataSource[%s] with metadata[%s] failed [%s]", supervisorId, dataSource, newMetadata, e.getMessage());
        throw new RuntimeException(e);
      }
    }

    if (!metadataUpdateSuccess) {
      throw new ISE("Unable to reset metadata[%s] for supervisor[%s] for dataSource[%s]", supervisorId, dataSource, dataSourceMetadata);
    }

    resetMetadata.getSeekableStreamSequenceNumbers()
                 .getPartitionSequenceNumberMap()
                 .keySet()
                 .forEach(partition -> {
                   final int groupId = getTaskGroupIdForPartition(partition);
                   killTaskGroupForPartitions(
                       ImmutableSet.of(partition),
                       "DataSourceMetadata is updated while reset offsets is called"
                   );
                   activelyReadingTaskGroups.remove(groupId);
                   // killTaskGroupForPartitions() cleans up partitionGroups.
                   // Add the removed groups back.
                   partitionGroups.computeIfAbsent(groupId, k -> new HashSet<>());
                   partitionOffsets.put(partition, getNotSetMarker());
                 });

View on GitHub (pinned to 9b90983fd2)