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

Allow removal of configuration properties #4061

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

cdegroc
Copy link
Contributor

@cdegroc cdegroc commented Oct 17, 2023

In this PR, we add a remove method to remove configuration keys:

  • ConfiguredGraphFactory/ConfigurationManagementGraph for ConfiguredGraphFactory configuration.
  • JanusGraphConfiguration/UserModifiableConfiguration/ManagementSystem for "global" configuration.

Fixes #555


Thank you for contributing to JanusGraph!

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

For all changes:

  • Is there an issue associated with this PR? Is it referenced in the commit message?
  • Does your PR body contain #xyz where xyz is the issue number you are trying to resolve?
  • Has your PR been rebased against the latest commit within the target branch (typically master)?
  • Is your initial contribution a single, squashed commit?

For code changes:

  • Have you written and/or updated unit tests to verify your changes?
  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE.txt file, including the main LICENSE.txt file in the root of this repository?
  • If applicable, have you updated the NOTICE.txt file, including the main NOTICE.txt file found in the root of this repository?

For documentation related changes:

  • Have you ensured that format looks appropriate for the output in which it is rendered?

@janusgraph-bot janusgraph-bot added the cla: external Externally-managed CLA label Oct 17, 2023
@cdegroc cdegroc force-pushed the removable-configuration branch from 6a0ac20 to 5ad8099 Compare October 17, 2023 09:48
@cdegroc cdegroc marked this pull request as ready for review October 17, 2023 12:05
Comment on lines -250 to +261
map.put("storage.hostname", "localhost,localhost");
map.put(STORAGE_HOSTS.toStringWithoutRoot(), "localhost,localhost");
ConfiguredGraphFactory.updateConfiguration(graphName, new MapConfiguration(map));
assertNull(gm.getGraph(graphName));
assertNotNull(ConfiguredGraphFactory.open(graphName));

// bogus backend will prevent the graph from being opened
final Map<String, Object> map2 = graphConfig.getMap();
map2.put("storage.backend", "bogusBackend");
map2.put(STORAGE_BACKEND.toStringWithoutRoot(), "bogusBackend");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

📝 drive-by change to reuse constants

Comment on lines -317 to +331
public static Map<String, Object> getConfiguration(final String configName) {
public static Map<String, Object> getConfiguration(final String graphName) {
final ConfigurationManagementGraph configManagementGraph = getConfigGraphManagementInstance();
return configManagementGraph.getConfiguration(configName);
return configManagementGraph.getConfiguration(graphName);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

📝 drive-by change: documentation mentioned graphName but variable was called configName.

Copy link
Member

@porunov porunov left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you @cdegroc !
I only have a nitpick about one of the methods you added, but that's not critical.

@porunov porunov added this to the Release v1.0.0 milestone Oct 17, 2023
@cdegroc cdegroc force-pushed the removable-configuration branch from 5ad8099 to 95aefc1 Compare October 18, 2023 09:32
@cdegroc
Copy link
Contributor Author

cdegroc commented Oct 18, 2023

I've deployed this code and tried to update an existing graph configuration. I could remove one or more configuration keys. Both ConfigurationGraphFactory.removeConfiguration() and ManagementSystem.remove() worked.

@porunov porunov merged commit ab1409b into JanusGraph:master Oct 20, 2023
170 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: external Externally-managed CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JanusGraphManagement does not allow to remove any property once set
3 participants