Flink: reading `$files` with vended credentials fails on TaskManagers because split JSON drops the credentials
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 22/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- gcp, java
- Lĩnh vực
- authentication, cloud, data-engineering
Hướng nghiên cứu
Start with core/src/main/java/org/apache/iceberg/io/FileIOParser.java, where the FileIO is serialized to JSON and rebuilt without its credentials, then look at GCSFileIO.credentials() in the gcp module. The payload's unit test, which round-trips a ManifestReadTask through ScanTaskParser.fromJson and checks the credentials, is the reproduction to run. Done means the credentials survive the JSON round trip for metadata-table tasks, and that test passes.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Apache Iceberg version
1.12.0 (latest release)
Query engine
Flink
Please describe the bug 🐞
What happens. We use a REST catalog that vends storage credentials (BigLake on GCS), and the job's own service
account has no direct bucket access. In that setup, a Flink batch query on a metadata table fails, for example
SELECT * FROM t$files. The JobManager plans the scan fine. Every TaskManager then fails reading the manifests with
403 storage.objects.get, and the error names the job's own service account. A normal data scan of the same table
works.
Why. The FLIP-27 source sends each split to the TaskManagers as JSON. For metadata-table tasks, that JSON
includes the FileIO, written by FileIOParser. FileIOParser writes only io.properties()
(L47)
and rebuilds the FileIO without credentials
(L79).
GCSFileIO keeps vended credentials in a separate field, not in properties()
(L85).
So on the TaskManager the rebuilt FileIO has no credentials and falls back to the environment's identity.
Data scans aren't affected, because their reader's FileIO travels by Java serialization, which keeps the credentials.
$entries and $all_manifests use the same parser, so they are probably affected too. S3FileIO stores
credentials the same way
(L114),
but we've only tested GCS. Related: #10735 added this JSON path, and #10926 fixed a similar gap in the same parser.
Repro (unit test, no cloud needed). The test builds a $files task whose GCSFileIO holds one credential, then
round-trips it through ScanTaskParser. The credentials come back empty on 1.11.0 and 1.12.0. The same task
round-tripped through Java serialization keeps them.
Test
package org.apache.iceberg;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.File; import java.lang.reflect.Field;
import java.util.List;
import java.util.Map; import org.apache.iceberg.expressions.Expressions;
import org.apache.iceberg.gcp.gcs.GCSFileIO;
import org.apache.iceberg.io.StorageCredential; import org.apache.iceberg.types.Types;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir;
public class TestFilesTaskCredentials {
@Test public void splitJsonKeepsVendedCredentials(@TempDir File dir) throws Exception {
PartitionSpec spec = PartitionSpec.unpartitioned(); ManifestWriter<DataFile> writer =
ManifestFiles.write(2, spec, Files.localOutput(new File(dir, "m.avro")), 1L);
writer.add(DataFiles.builder(spec).withPath("gs://bucket/t/data/a.parquet") .withFormat(FileFormat.PARQUET).withFileSizeInBytes(10).withRecordCount(1).build());
writer.close();
StorageCredential cred = StorageCredential.create("gs://bucket/",
Map.of("gcs.oauth2.token", "vended-token", "gcs.oauth2.token-expires-at", "4102444800000")); GCSFileIO io = new GCSFileIO();
io.initialize(Map.of("gcs.project-id", "p"));
io.setCredentials(List.of(cred));
Schema data = new Schema(Types.NestedField.required(1, "x", Types.LongType.get()));
Schema projection = new Schema(DataFile.getType(Types.StructType.of()).fields());
FileScanTask task = new BaseFilesTable.ManifestReadTask(
data, io, Map.of(0, spec), writer.toManifestFile(), projection, Expressions.alwaysTrue());
FileScanTask after = ScanTaskParser.fromJson(ScanTaskParser.toJson(task), true);
Field f = BaseFilesTable.ManifestReadTask.class.getDeclaredField("io");
f.setAccessible(true);
assertEquals(List.of(cred), ((GCSFileIO) f.get(after)).credentials()); // fails: []
}
}
Possible fix. When the FileIO implements SupportsStorageCredentials, have FileIOParser write credentials() to
the JSON and pass them back to the 4-argument CatalogUtil.loadFileIO when reading.
Workaround. SET 'table.exec.iceberg.use-flip27-source' = 'false'; The legacy source Java-serializes its splits, so
the credentials survive. That fixed it for us on the same cluster and table. The legacy source is deprecated, though.
Willingness to contribute
- I can contribute a fix for this bug independently
- I would be willing to contribute a fix for this bug with guidance from the Iceberg community
- I cannot contribute a fix for this bug at this time
- Ngôn ngữ chính
- Java
- Star
- 9.4k
- Fork
- 3.7k
- Merge trung bình
- 2 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 169
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/iceberg
-
Spark: Test INSERT targets with computed IDENTIFIER expressionsCó thể đã có người làm @shivadarshan-devadiga đã nhận 8 ngày trước. Đang mởimprovement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Core] TestAvroPartitionStatsHandler fails on Windows due to unclosed partition statistics scanCó thể đã có người làm @Ankitkj1999 đã nhận 10 ngày trước. Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Flink: JdbcLockFactory concurrent lock-table creation can fail with "table already exists" and restart the jobCó thể đã có người làm @adiranjan25 đã nhận 17 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
apache/iceberg#18797 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Core: TableMetadata.Builder allows adding encryption keys to v1/v2 tablesCó thể đã có người làm @yusufyildiz34 đã nhận 29 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/iceberg#18632 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Kafka: Filter empty strings and whitespace in IcebergSinkConfig stringToListCó thể đã có người làm @mohamed-elbrik đã nhận 34 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của apache/iceberg
Issue tương tự
-
hermes-queue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
chrisalunlloyd2-sudo/mindpalace#430 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
unitycatalog/unitycatalog#2363 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: editor P3 type: feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
halisonworks/mod-codeling#290 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
CVE-2026-63402 i18nextĐang mởarea/dependencies area/dependencies/js backport/26.6 backport/26.8 kind/cve severity/medium source/scan-dependencies status/triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 2 ngày