[
https://issues.apache.org/jira/browse/FLINK-39687?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18086219#comment-18086219
]
Jubin Soni edited comment on FLINK-39687 at 6/4/26 11:27 PM:
-------------------------------------------------------------
Created [PR #28318|https://github.com/apache/flink/pull/28318] implementing
tombstone-based retention for removed splits. Framework-level changes add
configurable retention to SplitAssignmentTracker - removed splits are kept in
checkpoint state and resurrected if they reappear within the retention window.
This prevents progress loss during metadata service instability.
was (Author: JIRAUSER313426):
Created [PR #28318|https://github.com/apache/flink/pull/28318] implementing
tombstone-based retention for removed splits. Framework-level changes add
configurable retention to `SplitAssignmentTracker` - removed splits are kept in
checkpoint state and resurrected if they reappear within the retention window.
This prevents progress loss during metadata service instability. Follow-up PR
needed for Kafka connector integration.
> URI used as URL in SessionContext causes ArrayStoreException
> ------------------------------------------------------------
>
> Key: FLINK-39687
> URL: https://issues.apache.org/jira/browse/FLINK-39687
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / Gateway
> Reporter: tonyabasy
> Priority: Major
>
> h2. Location
> {{flink-table/flink-sql-gateway/src/main/java/org/apache/flink/table/gateway/service/context/SessionContext.java}}
> line 306
> h2. Faulty Code
> {code:java}
> defaultContext.getDependencies().toArray(new URL[0]) {code}
> h2. Root Cause
> {{DefaultContext.getDependencies()}} returns {{List<URI>}}
> ({{{}java.net.URI{}}}), but the code calls {{{}.toArray(new URL[0]){}}}.
> {{java.net.URI}} and {{java.net.URL}} are *completely unrelated classes* (no
> inheritance relationship), so a {{URL[]}} array cannot hold {{URI}} objects.
> Java's {{List.toArray(T[])}} generic method does not check element type
> compatibility at compile time, so this compiles successfully. However, it
> will *always throw {{ArrayStoreException}} at runtime* when the {{toArray}}
> implementation attempts to store a {{URI}} into a {{{}URL[]{}}}.
> h2. When It Triggers
> This bug triggers when {{defaultContext.getDependencies()}} returns a
> non-empty list. It currently goes unnoticed because:
> * {{DefaultContext.load()}} creates a DefaultContext with an empty
> dependency list (the {{dependencies}} parameter is always empty in current
> callers)
> * {{ScriptRunner}} passes {{Collections.emptyList()}} directly (empty array,
> {{toArray}} never needs to store elements, so no exception)
> Once anyone creates a DefaultContext with non-empty dependencies, the
> exception will fire.
> h2. Fix
> Convert each {{URI}} to {{URL}} individually:
> {code:java}
> defaultContext.getDependencies().stream()
> .map(uri -> uri.toURL())
> .toArray(URL[]::new) {code}
> h2. Introduced In
> FLINK 2.2.0 (commit: 5a336892424)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)