{"record":{"id":"60c2c4fb41f73982","repo":"apache/druid","slug":"this-supervisor-type-does-not-support-partition-ex","errorCode":null,"errorMessage":"This supervisor type does not support partition expiration.","messagePattern":"This supervisor type does not support partition expiration\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java","lineNumber":3573,"sourceCode":"\n  /**\n   * When partitions are removed due to expiration it may be necessary to recompute the partitionID -> groupID\n   * mappings to ensure balanced distribution of partitions.\n   * <p>\n   * This function should return a copy of partitionGroups, using the provided availablePartitions as the list of\n   * active partitions, reassigning partitions to different groups if necessary.\n   * <p>\n   * If a partition is not in availablePartitions, it should be filtered out of the new partition groups returned\n   * by this method.\n   *\n   * @param availablePartitions\n   * @return a remapped copy of partitionGroups, containing only the partitions in availablePartitions\n   */\n  protected Map<Integer, Set<PartitionIdType>> recomputePartitionGroupsForExpiration(\n      Set<PartitionIdType> availablePartitions\n  )\n  {\n    throw new UnsupportedOperationException(\"This supervisor type does not support partition expiration.\");\n  }\n\n  /**\n   * Some seekable stream systems such as Kinesis allow partitions to expire. When this occurs, the supervisor should\n   * mark the expired partitions in the saved metadata. This method returns a copy of the current metadata\n   * with any expired partitions marked with an implementation-specific offset value that represents the expired state.\n   *\n   * @param currentMetadata     The current DataSourceMetadata from metadata storage\n   * @param expiredPartitionIds The set of expired partition IDs.\n   * @return currentMetadata but with any expired partitions removed.\n   */\n  protected SeekableStreamDataSourceMetadata<PartitionIdType, SequenceOffsetType> createDataSourceMetadataWithExpiredPartitions(\n      SeekableStreamDataSourceMetadata<PartitionIdType, SequenceOffsetType> currentMetadata,\n      Set<PartitionIdType> expiredPartitionIds\n  )\n  {\n    throw new UnsupportedOperationException(\"This supervisor type does not support partition expiration.\");\n  }","sourceCodeStart":3555,"sourceCodeEnd":3591,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java#L3555-L3591","documentation":"recomputePartitionGroupsForExpiration is an optional extension point used only by systems whose partitions can expire (Kinesis). The base SeekableStreamSupervisor implementation (and supervisors like Kafka whose partitions never expire) throws UnsupportedOperationException, meaning partition expiration is not supported for this supervisor type.","triggerScenarios":"Any code path invoking partition-expiration handling (expired-partition detection during partition discovery) on a supervisor that did not override recomputePartitionGroupsForExpiration, e.g. a Kafka supervisor.","commonSituations":"Custom seekable-stream supervisor implementations calling the shared expiration machinery; users expecting Kafka partitions to 'expire' like Kinesis shards; internal misuse of the protected hook.","solutions":["Do not enable or rely on partition expiration with Kafka (or other non-expiring) supervisors; partitions there are never considered expired.","If you implement a custom supervisor over an expiring stream, override recomputePartitionGroupsForExpiration and createDataSourceMetadataWithExpiredPartitions.","Confirm you are running the intended supervisor type; a misconfigured spec (Kinesis type under a Kafka-style config) can route to the wrong implementation."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"// Only Kinesis-style supervisors support expiration\nboolean supportsExpiration = supervisor instanceof KinesisSupervisor;","typeGuard":"if (!(supervisor instanceof ExpirationCapable)) return; // skip expiration path","tryCatchPattern":"try { recomputeForExpiration(); } catch (UnsupportedOperationException e) { log.info(\"Partition expiration not supported; skipping\"); }","preventionTips":["Don't rely on partition expiration with Kafka supervisors","Override the hook in custom supervisors for expiring streams"],"tags":["druid","supervisor","unsupported-operation","kinesis"],"backgroundTag":"unsupported-operation","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}