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

Prefer mongodb.keep_alive_ms over spark.mongodb.keep_alive_ms property #128

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

spingel
Copy link

@spingel spingel commented Nov 27, 2024

The documentation at https://www.mongodb.com/docs/spark-connector/master/faq/ specifies to set mongodb.keep_alive_ms but in the code the system property is prefixed with spark. This changes makes the code consistent with the documentation while maintaining backwards compatibility.

When attempting to set this with
--conf spark.executor.extraJavaOptions="-Dspark.mongodb.keep_alive_ms=70000" an exception occurs since Spark does not allow setting spark flags with that mechanism on executors:

java.lang.Exception: spark.executor.extraJavaOptions is not allowed to set Spark
options (was '-Dspark.mongodb.keep_alive_ms=70000’). Set them directly on a
SparkConf or in a properties file when using ./bin/spark-submit.

Work-around: Rather than setting the system property via extraJavaOptions on executors, the environment variable JAVA_TOOL_OPTIONS can be used:

--conf spark.driver.extraJavaOptions=-Dspark.mongodb.keep_alive_ms=70000 
--conf spark.executorEnv.JAVA_TOOL_OPTIONS=-Dspark.mongodb.keep_alive_ms=70000

The documentation at https://www.mongodb.com/docs/spark-connector/master/faq/
specifies to set mongodb.keep_alive_ms but in the code the system property
is prefixed with spark. This changes makes the code consistent with the
documentation while maintaining backwards compatibility.

When attempting to set this with
--conf spark.executor.extraJavaOptions="-Dspark.mongodb.keep_alive_ms=70000" an
exception occurs since Spark does not allow setting spark flags with that
mechanism on executors:

 java.lang.Exception: spark.executor.extraJavaOptions is not allowed to set Spark
 options (was '-Dspark.mongodb.keep_alive_ms=70000’). Set them directly on a
 SparkConf or in a properties file when using ./bin/spark-submit.

Work-around: Rather than setting the system property via extraJavaOptions on
executors, the environment variable JAVA_TOOL_OPTIONS can be used:

--conf spark.driver.extraJavaOptions=-Dspark.mongodb.keep_alive_ms=70000
--conf spark.executorEnv.JAVA_TOOL_OPTIONS=-Dspark.mongodb.keep_alive_ms=70000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant