8000 `-D` command-line arguments for node properties are overridden by `node.properties` · Issue #11 · airlift/launcher · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

-D command-line arguments for node properties are overridden by node.properties #11

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

Open
vimt opened this issue May 13, 2025 · 0 comments

C 77CE omments

@vimt
Copy link
vimt commented May 13, 2025

Describe the bug
In the current Go implementation of the launcher, system properties provided via the -D command-line argument (e.g., -Dnode.id=foo) are overridden by values defined in the node.properties file if the same key exists in both. This is a regression from the previous Python-based launcher, where command-line arguments had higher precedence and could override settings from the node.properties file.

Steps to reproduce

  1. Create or modify etc/node.properties to include a property, for example:
    node.id=id_from_file
  2. Run the launcher with a -D argument for the same property but a different value:
    ./launcher -Dnode.id=id_from_cli run
  3. Observe the effective node.id used by the application.

Expected behavior
The node.id used by the application should be id_from_cli, as the command-line argument should override the value from the node.properties file.

Actual behavior
The node.id used by the application is id_from_file, because the values from node.properties are applied after the command-line -D arguments are parsed, effectively overwriting them.

Code reference
The issue likely stems from the order of operations in src/main/go/args/args.go. The system properties from -D flags are parsed first, and then properties from node.properties are copied into the system properties, potentially overwriting the command-line specified values.

Specifically, this block of code:

// src/main/go/args/args.go lines 223-230
	options.SystemProperties, err = properties.Parse(flags.systemPropertiesOpt)
	if err != nil {
		return commands.UNKNOWN, nil, fmt.Errorf("provided system properties are invalid: %w", err)
	}

	// Copy node.config properties into system properties
	for key, value := range options.NodeConfig {
		options.SystemProperties[key] = value
	}

This logic means that options.NodeConfig (from node.properties) will overwrite any identically named keys already present in options.SystemProperties (from -D flags).

To fix this, the -D arguments should be applied after the node.properties are loaded, or the copying logic should check if a key already exists from a -D argument and not overwrite it.

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

No branches or pull requests

1 participant
0