-
Notifications
You must be signed in to change notification settings - Fork 347
Description
Note: This is likely superseded by #199, but I'll file in case this fix needs to be carried over, or #199 doesn't land in the next release.
When using RedshiftWriter.saveToRedshift() the credentials are fetched early in the function, if the unloadData call takes a significant amount of time (
spark-redshift/src/main/scala/com/databricks/spark/redshift/RedshiftWriter.scala
Line 374 in cba5eee
| val manifestUrl = unloadData(sqlContext, data, tempDir) |
doRedshiftLoad has run.
Ideally, the result returned from loadFromUri would return an instance of the InstanceProfileCredentialsProvider and getCredentials() would be called each time it was needed. This would handle the fact that the credentials can expire and would re-fetch when necessary. Obviously this change will break all other usages of fetching credentials right now, so perhaps an internal "credential wrapper" should be created to either return a wrapped BasicAWSCredentials when getCredentials() is called, or call through to the InstanceProfileCredentialsProvider.getCredentials() if that case is hit.