Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-48289][DOCKER][TEST] Clean up Oracle JDBC tests by skipping redundant SYSTEM password reset #46598

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@

package org.apache.spark.sql.jdbc

import java.io.{File, PrintWriter}

import com.github.dockerjava.api.model._

import org.apache.spark.internal.Logging
import org.apache.spark.util.Utils

class OracleDatabaseOnDocker extends DatabaseOnDocker with Logging {
lazy override val imageName =
Expand All @@ -38,30 +33,4 @@ class OracleDatabaseOnDocker extends DatabaseOnDocker with Logging {
override def getJdbcUrl(ip: String, port: Int): String = {
s"jdbc:oracle:thin:system/$oracle_password@//$ip:$port/freepdb1"
}

override def beforeContainerStart(
hostConfigBuilder: HostConfig,
containerConfigBuilder: ContainerConfig): Unit = {
try {
val dir = Utils.createTempDir()
val writer = new PrintWriter(new File(dir, "install.sql"))
// SPARK-46592: gvenzl/oracle-free occasionally fails to start with the following error:
// 'ORA-04021: timeout occurred while waiting to lock object', when initializing the
// SYSTEM user. This is due to the fact that the default DDL_LOCK_TIMEOUT is 0, which
// means that the lock will no wait. We set the timeout to 30 seconds to try again.
// TODO: This workaround should be removed once the issue is fixed in the image.
// https://github.com/gvenzl/oci-oracle-free/issues/35
writer.write("ALTER SESSION SET DDL_LOCK_TIMEOUT = 30;\n")
writer.write(s"""ALTER USER SYSTEM IDENTIFIED BY "$oracle_password";""")
writer.close()
val newBind = new Bind(
dir.getAbsolutePath,
new Volume("/docker-entrypoint-initdb.d"),
AccessMode.DEFAULT)
hostConfigBuilder.withBinds(hostConfigBuilder.getBinds :+ newBind: _*)
} catch {
case e: Exception =>
logWarning("Failed to create install.sql file", e)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ import org.apache.spark.tags.DockerTest
* A sequence of commands to build the Oracle Database Free container image:
* $ git clone https://github.com/oracle/docker-images.git
* $ cd docker-images/OracleDatabase/SingleInstance/dockerfiles
* $ ./buildContainerImage.sh -v 23.2.0 -f
* $ export ORACLE_DOCKER_IMAGE_NAME=oracle/database:23.2.0-free
* $ ./buildContainerImage.sh -v 23.4.0 -f
* $ export ORACLE_DOCKER_IMAGE_NAME=oracle/database:23.4.0-free
*
* This procedure has been validated with Oracle Database Free version 23.2.0,
* This procedure has been validated with Oracle Database Free version 23.4.0,
* and with Oracle Express Edition versions 18.4.0 and 21.3.0
yaooqinn marked this conversation as resolved.
Show resolved Hide resolved
*/
@DockerTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ import org.apache.spark.tags.DockerTest
*
* A sequence of commands to build the Oracle Database Free container image:
* $ git clone https://github.com/oracle/docker-images.git
* $ cd docker-images/OracleDatabase/SingleInstance/dockerfiles
* $ ./buildContainerImage.sh -v 23.2.0 -f
* $ export ORACLE_DOCKER_IMAGE_NAME=oracle/database:23.2.0-free
* $ cd docker-images/OracleDatabase/SingleInstance/dockerfiles0
* $ ./buildContainerImage.sh -v 23.4.0 -f
* $ export ORACLE_DOCKER_IMAGE_NAME=oracle/database:23.4.0-free
*
* This procedure has been validated with Oracle Database Free version 23.2.0,
* This procedure has been validated with Oracle Database Free version 23.4.0,
* and with Oracle Express Edition versions 18.4.0 and 21.3.0
yaooqinn marked this conversation as resolved.
Show resolved Hide resolved
*/
@DockerTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ import org.apache.spark.tags.DockerTest
* A sequence of commands to build the Oracle Database Free container image:
* $ git clone https://github.com/oracle/docker-images.git
* $ cd docker-images/OracleDatabase/SingleInstance/dockerfiles
* $ ./buildContainerImage.sh -v 23.2.0 -f
* $ export ORACLE_DOCKER_IMAGE_NAME=oracle/database:23.2.0-free
* $ ./buildContainerImage.sh -v 23.4.0 -f
* $ export ORACLE_DOCKER_IMAGE_NAME=oracle/database:23.4.0-free
*
* This procedure has been validated with Oracle Database Free version 23.2.0,
* This procedure has been validated with Oracle Database Free version 23.4.0,
* and with Oracle Express Edition versions 18.4.0 and 21.3.0
yaooqinn marked this conversation as resolved.
Show resolved Hide resolved
*/
@DockerTest
Expand Down