{"record":{"id":"13cf7fc3bb23194a","repo":"apache/druid","slug":"unable-to-reset-metadata-s-for-supervisor-s-fo","errorCode":null,"errorMessage":"Unable to reset metadata[%s] for supervisor[%s] for dataSource[%s]","messagePattern":"Unable to reset metadata\\[(.+?)\\] for supervisor\\[(.+?)\\] for dataSource\\[(.+?)\\]","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java","lineNumber":2296,"sourceCode":"            metadata.getClass()\n        );\n      }\n      @SuppressWarnings(\"unchecked\")\n      final SeekableStreamDataSourceMetadata<PartitionIdType, SequenceOffsetType> currentMetadata =\n          (SeekableStreamDataSourceMetadata<PartitionIdType, SequenceOffsetType>) metadata;\n      final DataSourceMetadata newMetadata = currentMetadata.plus(resetMetadata);\n      log.info(\"Current checkpointed metadata[%s], new metadata[%s] for supervisor[%s] for dataSource[%s]\", currentMetadata, newMetadata, supervisorId, dataSource);\n      try {\n        metadataUpdateSuccess = indexerMetadataStorageCoordinator.resetDataSourceMetadata(supervisorId, newMetadata);\n      }\n      catch (IOException e) {\n        log.error(\"Reset offsets for supervisor[%s] for dataSource[%s] with metadata[%s] failed [%s]\", supervisorId, dataSource, newMetadata, e.getMessage());\n        throw new RuntimeException(e);\n      }\n    }\n\n    if (!metadataUpdateSuccess) {\n      throw new ISE(\"Unable to reset metadata[%s] for supervisor[%s] for dataSource[%s]\", supervisorId, dataSource, dataSourceMetadata);\n    }\n\n    resetMetadata.getSeekableStreamSequenceNumbers()\n                 .getPartitionSequenceNumberMap()\n                 .keySet()\n                 .forEach(partition -> {\n                   final int groupId = getTaskGroupIdForPartition(partition);\n                   killTaskGroupForPartitions(\n                       ImmutableSet.of(partition),\n                       \"DataSourceMetadata is updated while reset offsets is called\"\n                   );\n                   activelyReadingTaskGroups.remove(groupId);\n                   // killTaskGroupForPartitions() cleans up partitionGroups.\n                   // Add the removed groups back.\n                   partitionGroups.computeIfAbsent(groupId, k -> new HashSet<>());\n                   partitionOffsets.put(partition, getNotSetMarker());\n                 });\n","sourceCodeStart":2278,"sourceCodeEnd":2314,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java#L2278-L2314","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the supervisor has persisted offsets in the metadata store before resetting; if not, there is nothing to reset","Clean the stored datasource metadata so its type matches the supervisor, then retry the reset","Check metadata storage health/connectivity and coordinator logs for the underlying false return"],"exampleFix":"null","handlingStrategy":"validation","validationCode":"DataSourceMetadata stored = coordinator.retrieveDataSourceMetadata(supervisorId);\nif (stored == null || !checkSourceMetadataMatch(stored)) {\n  throw new IllegalStateException(\"Stored metadata missing or incompatible; offsets cannot be reset\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  supervisor.resetOffsets(metadata);\n} catch (IllegalStateException e) {\n  if (e.getMessage().startsWith(\"Unable to reset metadata\")) {\n    // clean stored metadata of the correct type, then retry the reset\n  } else throw e;\n}","preventionTips":["Verify stored supervisor metadata exists and matches the source type before resetting offsets","Resolve metadata-store connectivity issues before issuing resets","Clean stale metadata rows when migrating a datasource between stream types"],"tags":["reset","offsets","metadata-store"],"backgroundTag":"database-write-failed","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}