Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/main/scala/com/databricks/spark/redshift/Parameters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ package com.databricks.spark.redshift

import com.amazonaws.auth.{AWSCredentialsProvider, BasicSessionCredentials}

import scala.util.Try

/**
* All user-specifiable parameters for spark-redshift, along with their validation rules and
* defaults.
Expand Down Expand Up @@ -285,5 +287,11 @@ private[redshift] object Parameters {
new BasicSessionCredentials(accessKey, secretAccessKey, sessionToken))
}
}

/**
* Timeout (in milliseconds) between writing temp files in S3 and calling
* upon Redshift to COPY.
*/
def writeTimeout: Try[Int] = Try(parameters.get("writetimeout").get.toInt)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,11 @@ private[redshift] class RedshiftWriter(
tempDir = params.createPerQueryTempDir(),
tempFormat = params.tempFormat,
nullString = params.nullString)

if (params.writeTimeout.isSuccess) {
Thread.sleep(params.writeTimeout.get)
}

val conn = jdbcWrapper.getConnector(params.jdbcDriver, params.jdbcUrl, params.credentials)
conn.setAutoCommit(false)
try {
Expand Down