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

Forbid changing thread pool types #14367

Merged
merged 1 commit into from Nov 3, 2015
Merged

Forbid changing thread pool types #14367

merged 1 commit into from Nov 3, 2015

Conversation

jasontedor
Copy link
Member

This commit forbids the changing of thread pool types for any thread
pool. The motivation here is that these are expert settings with
little practical advantage.

Closes #14294, relates #2509, relates #2858, relates #5152

@@ -86,6 +72,84 @@
public static final String FETCH_SHARD_STORE = "fetch_shard_store";
}

public enum ThreadPoolType {
Copy link
Member

Choose a reason for hiding this comment

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

Can you add javadocs for this, I think a single line for each type that gives a nice description for anyone checking out the code (support peeps) that might not be familiar with java threadpool types would be super helpful

Copy link
Member

Choose a reason for hiding this comment

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

Nevermind, we already have docs for it in the actual docs, so we can leave it out here.

@dakrone
Copy link
Member

dakrone commented Oct 30, 2015

Left some comments but I like this! The only thing I wonder, however, is how a new 2.1.0 node joining a 2.0.0 node that already has custom threadpool settings will behave, once it sees the new settings it will try to apply them but fail, so you'll end up with different nodes with different configurations. This seems kind of dangerous, what do you think about deprecate in 2.x and remove in 3.0 only?

@nik9000
Copy link
Member

nik9000 commented Oct 30, 2015

This seems kind of dangerous, what do you think about deprecate in 2.x and remove in 3.0 only?

I'd be ok if the 2.1 nodes just failed to start entirely if the cluster has this configuration and huffily printed out a message to the logs "detected dangerous threadpool configuration. Please change blah blah blah." So long as the parameter can be changed without bouncing the whole cluster this is something people can work around I think.

Folks set these configuration variables like this are setting them in they pre-prod environments too hopefully. So it shouldn't be a surprise during upgrade for most folks.

@dakrone
Copy link
Member

dakrone commented Oct 30, 2015

I'd be ok if the 2.1 nodes just failed to start entirely if the cluster has this configuration and huffily printed out a message to the logs

+1 only if it's easy to implement the failing to start. Since these settings are previously dynamic, someone can change their config and then start the 2.1.0 node up again.

@jasontedor
Copy link
Member Author

@dakrone I pushed a refactoring cleanup in 32b06108eda10d48e3b767f719e3e3d25485353b and validated dynamic settings attempts in fb30fc2775a700757c1169fc083b9ce650d10633. Would you mind taking a look?

@jasontedor
Copy link
Member Author

This seems kind of dangerous, what do you think about deprecate in 2.x and remove in 3.0 only?

@dakrone As @jpountz remarked in the original pull request (when the idea was only to forbid changing thread pool types to type "cached"), this is a very expert setting so there will probably be very little if any real-world breakage. I'm fine adding something clear to the migrate_2_1.asciidoc and possibly implementing @nik9000's suggestion, or just leaving this for 3.0. Any final thoughts @dakrone @jpountz @nik9000?

@nik9000
Copy link
Member

nik9000 commented Nov 2, 2015

Any final thoughts @dakrone @jpountz @nik9000?

I'd certainly prefer it complain loudly in the logs if it gets a now invalid setting but I'm fine if ES doesn't fail to start. Or if it does. Either way.

I like the idea of putting this in the 2.x line somewhere (2.1, 2.2, whatever) because it makes things less likely to crash.

@jasontedor
Copy link
Member Author

+1 only if it's easy to implement the failing to start.

It's easy, but it'd be a hack. Right now we are very lenient about failure to apply settings. We'd basically have to special case this setting and I'm not a fan of that.

Since these settings are previously dynamic, someone can change their config and then start the 2.1.0 node up again.

The problem here is that today we still do not have way to delete persistent cluster settings. That gets us into situations like #3670 which is still waiting on #6732 to be addressed. In this case, someone could have these settings applied on a 2.0.x cluster, they will no longer apply on a 2.1.y cluster, will see warning messages in the logs, but not have a clean way to remove the setting.

@nik9000 @jpountz @dakrone I'm starting to lean towards 3.0 only.

@dakrone
Copy link
Member

dakrone commented Nov 2, 2015

It's easy, but it'd be a hack. Right now we are very lenient about failure to apply settings. We'd basically have to special case this setting and I'm not a fan of that.

Not worth it for a hack. Let's not do that then.

I'm starting to lean towards 3.0 only.

+1 for 3.0 only, this isn't so important we need to jump through tons of hoops to get it in for 2.1. I think we can remove the docs for setting it in 2.1 though, just to reduce the chance of the type being set.

@jasontedor
Copy link
Member Author

@dakrone Removed the the byte serialization of ThreadPoolType in d4e015d6945392090b2833276381fde7c2ae1cf2 and returned to the string serialization.

@dakrone
Copy link
Member

dakrone commented Nov 2, 2015

LGTM, thanks @jasontedor !

@jasontedor
Copy link
Member Author

+1 for 3.0 only

Removed the v2.1.0 and v2.2.0 labels. That said, we still have the issue that if someone has this set on a 2.x cluster and they migrate to 3.y, they are going to have the problem of having this setting stuck in the cluster state until a solution to #3670 comes along.

@jpountz
Copy link
Contributor

jpountz commented Nov 2, 2015

So maybe in this PR we should keep accepting the type parameter if the value is equal to the right threadpool type and leave a comment saying that this hack can be removed when #3670 is in? Otherwise I'm afraid that this might get forgotten and that we will get failed upgrades when releasing 3.0.

@jasontedor
Copy link
Member Author

So maybe in this PR we should keep accepting the type parameter if the value is equal to the right threadpool type and leave a comment saying that this hack can be removed when #3670 is in? Otherwise I'm afraid that this might get forgotten and that we will get failed upgrades when releasing 3.0.

@jpountz Agree. Done in 843a394ea40e7a41081c245e0be9fa42661dec2e.

String type = groupSettings.get(key).get("type");
// TODO: the type equality check can be removed after #3760/#6732 are addressed
if (type != null && !THREAD_POOL_TYPES.get(key).getType().equals(type)) {
throw new IllegalArgumentException("setting " + THREADPOOL_GROUP + key + ".type to " + type + " is not permitted");
Copy link
Contributor

Choose a reason for hiding this comment

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

can the error message mention the only allowed value, so that users with existing settings can update?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, done in 87f3a6f118865547a677833210646481561eff7b.

@jpountz
Copy link
Contributor

jpountz commented Nov 2, 2015

LGTM. It should be backportable to 2.x under the current form, right? (not especially pushing for this, just wondering as what seemed to be the major concern against backporting to 2.x does not seem to apply anymore?)

@jasontedor
Copy link
Member Author

It should be backportable to 2.x under the current form, right?

Yes.

(not especially pushing for this, just wondering as what seemed to be the major concern against backporting to 2.x does not seem to apply anymore?)

Correct.

This commit forbids the changing of thread pool types for any thread
pool. The motivation here is that these are expert settings with
little practical advantage.

Closes #14294, relates #2509, relates #2858, relates #5152
jasontedor added a commit that referenced this pull request Nov 3, 2015
…-types

Forbid changing thread pool types
@jasontedor jasontedor merged commit 9cc2eb0 into elastic:master Nov 3, 2015
@jasontedor jasontedor deleted the forbid-changing-thread-pool-types branch November 3, 2015 02:17
@jpountz
Copy link
Contributor

jpountz commented Nov 3, 2015

@jasontedor I'm not seeing the commit on the 2.1/2.x branches, do I miss anything?

@jasontedor
Copy link
Member Author

@jpountz It was a messy integration into those branches (from among other things, Guava still being used, lambdas not able to be used); I have it ready locally and will be getting it into origin soon.

@jasontedor
Copy link
Member Author

@jpountz This is integrated into 2.1 and 2.x, and I've backported your test bug fix from a7bf06e as well.

@jasontedor jasontedor removed the review label Nov 3, 2015
@jpountz
Copy link
Contributor

jpountz commented Nov 3, 2015

Thank you!

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.

None yet

5 participants