Skip to content

Commit 6424848

Browse files
Disable FileSystem cache for S3, Azure, and GCS in SSP when using temp credentials (delta-io#6053)
#### Which Delta project/connector is this regarding? - [x] Spark - [ ] Standalone - [ ] Flink - [ ] Kernel - [ ] Other (fill in here) ## Description Set `disable.cache` in the Hadoop configuration built for server-side planned table reads when injecting temporary credentials from the IRC response. This ensures each scan uses a fresh FileSystem instance and avoids AccessDenied when temp credentials expire and a cached FileSystem is reused. ## How was this patch tested? Existing server-side planning tests; no new tests (configuration-only change). ## Does this PR introduce _any_ user-facing changes? No. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 57d9bd1 commit 6424848

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

spark/src/main/scala/org/apache/spark/sql/delta/serverSidePlanning/ServerSidePlannedTable.scala

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,20 +402,29 @@ class ServerSidePlannedFilePartitionReaderFactory(
402402
private val hadoopConf = {
403403
val conf = spark.sessionState.newHadoopConf()
404404

405-
// Inject temporary credentials from IRC server response
405+
// Inject temporary credentials from IRC server response.
406+
// Disable FileSystem cache for S3, Azure, and GCS so each scan uses fresh credentials
407+
// (avoids AccessDenied when temp creds expire and a cached FS is reused).
408+
// Aligns with CredPropsUtil in the Unity Catalog connector.
406409
credentials.foreach { creds =>
407410
creds match {
408411
case S3Credentials(accessKeyId, secretAccessKey, sessionToken) =>
412+
conf.set("fs.s3a.path.style.access", "true")
413+
conf.set("fs.s3.impl.disable.cache", "true")
414+
conf.set("fs.s3a.impl.disable.cache", "true")
409415
conf.set("fs.s3a.access.key", accessKeyId)
410416
conf.set("fs.s3a.secret.key", secretAccessKey)
411417
conf.set("fs.s3a.session.token", sessionToken)
412418

413419
case AzureCredentials(accountName, sasToken, containerName) =>
420+
conf.set("fs.abfs.impl.disable.cache", "true")
421+
conf.set("fs.abfss.impl.disable.cache", "true")
414422
// Format: fs.azure.sas.<container>.<account>.dfs.core.windows.net
415423
val sasKey = s"fs.azure.sas.$containerName.$accountName.dfs.core.windows.net"
416424
conf.set(sasKey, sasToken)
417425

418426
case GcsCredentials(oauth2Token) =>
427+
conf.set("fs.gs.impl.disable.cache", "true")
419428
conf.set("fs.gs.auth.access.token", oauth2Token)
420429
}
421430
}

0 commit comments

Comments
 (0)