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

Core: Support set system level properties with environmental variables #5659

Merged
merged 7 commits into from
May 24, 2023

Conversation

ConeyLiu
Copy link
Contributor

This add supports setting system level properties with environmental variables. For example: we could control the number of threads for the default Iceberg thread pool with java system property: iceberg.worker.num-threads or env: ICEBERG_WORKER_NUM_THREADS. This is indeed useful when we want to change those properties while the java system properties have some default settings and we do not want to change them.

@github-actions github-actions bot added the core label Aug 29, 2022
@ConeyLiu
Copy link
Contributor Author

cc @rdblue @kbendick @szehon-ho, this is a small update, could you take a look when you are free? Thanks a lot.

@ConeyLiu ConeyLiu changed the title Core: Support set system level properties with environmental variable Core: Support set system level properties with environmental variables Aug 29, 2022
/** Whether to use the shared worker pool when planning table scans. */
public static final String SCAN_THREAD_POOL_ENABLED = "iceberg.scan.plan-in-worker-pool";

static boolean getBoolean(String systemProperty, boolean defaultValue) {
public static final String SCAN_THREAD_POOL_ENABLED_ENV = "ICEBERG_SCAN_PLAN_IN_WORKER_POOL";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be explosed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is used by core/src/main/java/org/apache/iceberg/util/ThreadPools.java in a different package. I updated other envs to the default access level.

@zinking
Copy link
Contributor

zinking commented Mar 27, 2023

@szehon-ho @rdblue can we take another look and merge if possible ?

@szehon-ho
Copy link
Collaborator

Hi guys, can you explain the motivation of the change? Not opposed, but reading the description but didn't quite understand it. To me, both seem to be more or less equivalent in ease-of-use (they are passed to the java process when it is spawned..)

@ConeyLiu
Copy link
Contributor Author

ConeyLiu commented Mar 28, 2023

@szehon-ho In many production environments, there are some default parameter settings for spark driver/executor java options (eg: gc parameters). And those parameters are concated into one string. This makes it difficult to overwrite or modify those parameters to set iceberg system-level properties. While with ENV settings, we could set those system-level properties separately.

Copy link
Collaborator

@szehon-ho szehon-ho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, yea spark seems to support env variables to set certain things. Left some comments.

Copy link
Collaborator

@szehon-ho szehon-ho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments. While the code is cleaner now, cc @rdblue if we are ok with new public interface here

@ConeyLiu
Copy link
Contributor Author

ConeyLiu commented May 5, 2023

Thanks @szehon-ho for the reviewing, and sorry got held up.

Copy link
Collaborator

@szehon-ho szehon-ho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, left one nit. Will wait a bit if there's any more comment, and merge if not

if (value != null) {
try {
return parseFunc.apply(value);
} catch (NumberFormatException e) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: how about catch Exception , as we don't know what kind of Function we get?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated and add the log.

@ConeyLiu
Copy link
Contributor Author

gentle ping @szehon-ho

@szehon-ho szehon-ho merged commit 4b8941e into apache:master May 24, 2023
@szehon-ho
Copy link
Collaborator

Merged, thanks @ConeyLiu !

@ConeyLiu
Copy link
Contributor Author

Thanks @szehon-ho @zinking @rdblue

@ConeyLiu ConeyLiu deleted the set_prop_with_env branch May 25, 2023 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants