Skip to content

Add infrastructure to transactionally apply and reset dynamic settings#15278

Merged
s1monw merged 40 commits intoelastic:masterfrom
s1monw:settings_prototype
Dec 18, 2015
Merged

Add infrastructure to transactionally apply and reset dynamic settings#15278
s1monw merged 40 commits intoelastic:masterfrom
s1monw:settings_prototype

Conversation

@s1monw
Copy link
Copy Markdown
Contributor

@s1monw s1monw commented Dec 7, 2015

This commit adds the infrastructure to make settings that are updateable
resetable and changes the application of updates to be transactional. This means
setting updates are either applied or not. If the application failes all values are rejected.

This initial commit converts all dynamic cluster settings to make use of the new infrastructure.
All cluster level dynamic settings are not resettable to their defaults or to the node level settings.
The infrastructure also allows to list default values and descriptions which is not fully implemented yet.

Values can be reset using a list of key or simple regular expressions. This has only been implemented on the java
layer yet. For instance to reset all recovery settings to their defaults a user can just specify indices.recovery.*.

This commit also adds strict settings validation, if a setting is unknown or if a setting can not be applied the entire
settings update request will fail.

@s1monw
Copy link
Copy Markdown
Contributor Author

s1monw commented Dec 7, 2015

this issue basically closes #7704 and is a first cut at #6732

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

leftover?

This commit adds the infrastructure to make settings that are updateable
resetable and changes the application of updates to be transactional. This means
setting updates are either applied or not. If the application failes all values are rejected.

This initial commit converts all dynamic cluster settings to make use of the new infrastructure.
All cluster level dynamic settings are not resettable to their defaults or to the node level settings.
The infrastructure also allows to list default values and descriptions which is not fully implemented yet.

Values can be reset using a list of key or simple regular expressions. This has only been implemented on the java
layer yet. For instance to reset all recovery settings to their defaults a user can just specify `indices.recovery.*`.

This commit also adds strict settings validation, if a setting is unknown or if a setting can not be applied the entire
settings update request will fail.
@s1monw s1monw force-pushed the settings_prototype branch from 720fcb6 to 5d7f4ef Compare December 8, 2015 14:27
@nik9000
Copy link
Copy Markdown
Member

nik9000 commented Dec 8, 2015

Briefly looked at it last night but I'll actually review it now.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since I haven't looked at setting the cluster readonly before I kind of assumed this would be handled in a listener in some ClusterStateService-style object rather than in settings. Maybe a comment why its here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see. This was extracted from ClusterSettingsService. It makes sense now. Cool.

@s1monw
Copy link
Copy Markdown
Contributor Author

s1monw commented Dec 15, 2015

@bleskes pushed a new commit and merge with master

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

imo the min value for these should be 1 - there are enough ways to block recovery that are more straight forward

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

agreed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'd like to keep this as is for now - I think this needs a sep issue

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

sure. as long as we don't forget :)

@bleskes
Copy link
Copy Markdown
Contributor

bleskes commented Dec 16, 2015

LGTM except for the array setting support. I'm fine with doing this as a followup as it seems we only have one dynamic cluster level setting that relies on that and that one can live just fine with the comma based. Note though that the array notation is used in more places which are non-dynamic (discovery.zen.ping.unicast.hosts, for example). I think we should do those as well (as a followup)?

@s1monw
Copy link
Copy Markdown
Contributor Author

s1monw commented Dec 16, 2015

@bleskes I added yet another special case for setting which pisses me off but I have no choice. this has been fucked up in the past and is hard to fix for the future. Anyway I think it's ready and I will push very soon

@bleskes
Copy link
Copy Markdown
Contributor

bleskes commented Dec 16, 2015

@s1monw thanks for the extra effort. Sadly, I don't think this is enough as we still don't deal correctly with how we parse json arrays into key.0 , key.1 etc. The request I gave above still fails and we move none dynamic settings into this infra we will have similar options. As I said before - I think we should push this in as iterate on this. We do need to support discovery.zen.ping.unicast.hosts: [ ... ] and network.bind_host: [ ... ] etc.

@s1monw
Copy link
Copy Markdown
Contributor Author

s1monw commented Dec 16, 2015

@bleskes ok I added several tests that this works :)

@bleskes
Copy link
Copy Markdown
Contributor

bleskes commented Dec 16, 2015

@s1monw thanks. I dug deeper as it still didn't work. Here's the problem, I think:

Index: core/src/main/java/org/elasticsearch/common/settings/AbstractScopedSettings.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/src/main/java/org/elasticsearch/common/settings/AbstractScopedSettings.java    (date 1450271602000)
+++ core/src/main/java/org/elasticsearch/common/settings/AbstractScopedSettings.java    (revision )
@@ -43,7 +43,7 @@
             if (entry.getScope() != scope) {
                 throw new IllegalArgumentException("Setting must be a cluster setting but was: " + entry.getScope());
             }
-            if (entry.isGroupSetting()) {
+            if (entry.hasComplexMatcher()) {
                 complexMatchers.put(entry.getKey(), entry);
             } else {
                 keySettings.put(entry.getKey(), entry);

It seems we need one more test?

@s1monw
Copy link
Copy Markdown
Contributor Author

s1monw commented Dec 16, 2015

more tests tests and tests I push this now it's not going to be better.

s1monw added a commit that referenced this pull request Dec 18, 2015
Add infrastructure to transactionally apply and reset dynamic settings
@s1monw s1monw merged commit 55f77db into elastic:master Dec 18, 2015
@s1monw s1monw deleted the settings_prototype branch December 18, 2015 09:57
@derjohn
Copy link
Copy Markdown

derjohn commented Jan 12, 2016

\o/\o/\o/ THX !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants