{"record":{"id":"c77ffbf8f38ed727","repo":"apache/druid","slug":"unable-to-reset-metadata","errorCode":null,"errorMessage":"Unable to reset metadata","messagePattern":"Unable to reset metadata","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java","lineNumber":2242,"sourceCode":"        }\n        if (metadataUpdateSuccess) {\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\"\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        } else {\n          throw new ISE(\"Unable to reset metadata\");\n        }\n      } else {\n        log.warn(\n            \"Reset metadata stream [%s] and supervisor's stream name [%s] do not match\",\n            resetMetadata.getSeekableStreamSequenceNumbers().getStream(),\n            ioConfig.getStream()\n        );\n      }\n    }\n  }\n\n  /**\n   * Reset offsets with the data source metadata. If checkpoints exist, the resulting stored offsets will be a union of\n   * existing checkpointed offsets and provided offsets; any checkpointed offsets not specified in the metadata will be\n   * preserved as-is. If checkpoints don't exist, the provided reset datasource metadata will be inserted into\n   * the metadata storage. Once the offsets are reset, any active tasks serving the partition offsets will be restarted.\n   * @param dataSourceMetadata Required reset data source metadata. Assumed that the metadata is validated.\n   */","sourceCodeStart":2224,"sourceCodeEnd":2260,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java#L2224-L2260","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure the supervisor has persisted metadata before attempting a metadata-only reset","Reset with full partition/offset metadata that matches the stored type instead","Inspect stored supervisor metadata in the metadata store and clean stale rows if of the wrong type"],"exampleFix":"null","handlingStrategy":"validation","validationCode":"DataSourceMetadata stored = coordinator.retrieveDataSourceMetadata(supervisorId);\nif (stored == null) {\n  log.warn(\"No stored metadata to reset for %s; skipping metadata-only reset\", supervisorId);\n  return;\n}","typeGuard":null,"tryCatchPattern":"try {\n  supervisor.resetMetadata(metadata);\n} catch (IllegalStateException e) {\n  if (\"Unable to reset metadata\".equals(e.getMessage())) {\n    log.warn(\"Metadata store had nothing compatible to reset; falling back to full partition reset\");\n  } else throw e;\n}","preventionTips":["Only issue metadata resets after the supervisor has persisted offsets","Prefer full partition/offset resets with matching metadata types","Check coordinator logs for false returns and their cause"],"tags":["reset","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"}