Flink: reading `$files` with vended credentials fails on TaskManagers because split JSON drops the credentials
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 22/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- gcp, java
- Ambito
- authentication, cloud, data-engineering
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Java
- Stelle
- 9.4k
- Fork
- 3.7k
- Merge medio
- 2g 16h
- PR unite (30g)
- 160
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/iceberg
-
Spark: Test INSERT targets with computed IDENTIFIER expressionsForse già presa @shivadarshan-devadiga l’ha presa 7 giorni fa. Apertaimprovement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
[Core] TestAvroPartitionStatsHandler fails on Windows due to unclosed partition statistics scanForse già presa @Ankitkj1999 l’ha presa 9 giorni fa. Aperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Flink: JdbcLockFactory concurrent lock-table creation can fail with "table already exists" and restart the jobForse già presa @adiranjan25 l’ha presa 16 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
apache/iceberg#18797 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Core: TableMetadata.Builder allows adding encryption keys to v1/v2 tablesForse già presa @yusufyildiz34 l’ha presa 29 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/iceberg#18632 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Kafka: Filter empty strings and whitespace in IcebergSinkConfig stringToListForse già presa @mohamed-elbrik l’ha presa 34 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di apache/iceberg
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
speakeasy-api/speakeasy#2159 ·
I maintainer di solito rispondono entro 1 giorno
-
area: cli
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
vitruv-tools/NeoJoin#415 ·
I maintainer di solito rispondono entro 1 giorno
-
Quick Installation step 2 installs from the plugin manager, but the plugin isn't published yetAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
jenkinsci/user-guide-ai-chatbot-plugin#132 ·
I maintainer di solito rispondono entro 6 giorni
-
account assessment course feature lecture
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug] 连接达梦时报错,agent 进程启动即退Apertabug db/dameng user-priority/P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno