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 some Repository Settings to be Updated Dynamically #72543

Merged

Conversation

original-brownbear
Copy link
Member

@original-brownbear original-brownbear commented Apr 30, 2021

This commit serves two purposes. For one, we need the ability to dynamically
update a repository setting for the encrypted repository work (hence the ignored settings parameter enabling
nested repo types).

Also, this allows dynamically updating repository rate limits while snapshots are
in progress. This has often been an issue in the past where a long running snapshot
made progress over a long period of time already but is going too slowly with the
current rate limit. This left no good options, either throw away the existing
partly done snapshot's work and recreate the repository with a higher rate limit to speed
things up or wait for a long time with the current rate limit.
With this change the rate limit can simply be increased while a snapshot or restore
is running and will take effect immediately.

cc @albertzaharovits

This commit serves two purposes. For one, we need the ability to dynamically
update a repository setting for the encrypted repository work.

Also, this allows dynamically updating repository rate limits while snapshots are
in progress. This has often been an issue in the past where a long running snapshot
made progress over a long period of time already but is going too slowly with the
current rate limit. This left no good options, either throw away the existing
partly done snapshot's work and recreate the repo with a higher rate limit to speed
things up or wait for a long time with the current rate limit.
With this change the rate limit can simply be increased while a snapshot or restore
is running and will take effect imidiately.
@original-brownbear original-brownbear added >enhancement :Distributed/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs v8.0.0 v7.14.0 labels Apr 30, 2021
@elasticmachine elasticmachine added the Team:Distributed Meta label for distributed team label Apr 30, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

@tlrx tlrx self-requested a review April 30, 2021 13:29
@@ -469,6 +487,15 @@ public void applyClusterState(ClusterChangedEvent event) {
}
}

private boolean canUpdateInPlace(DiscoveryNodes nodes, RepositoryMetadata updatedMetadata, Repository repository) {
if (nodes.getMinNodeVersion().before(UPDATE_IN_PLACE_VERSION)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks fragile because the minimum node version in the cluster can go downwards (if UPDATE_IN_PLACE_VERSION doesn't ultimately end in .0.0). I think it's ok if we're checking this as part of a cluster state update, because a node won't be concurrently rejoining the cluster. Can we assert we're on the master thread at this point to make sure we don't check this wrongly?

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually why do we need the version check? If we update the repository metadata and there's older nodes around then will they break or will they just keep using the old repo metadata for any ongoing shard-level operations?

Copy link
Member Author

Choose a reason for hiding this comment

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

Alrighty, as just discussed. The BwC will be handled via some other mechanism here. Removed the BwC logic from this PR entirely for now as it's not a problem in interaction with versions that aren't already a problem anyway.

@original-brownbear
Copy link
Member Author

@DaveCTurner ping if you have some time for this one :) Would be nice to get this in at some point to unblock some of the encrypted repository work. I think the BwC situation isn't much of a concern here after thinking it through. In the end all it will do is fail shard snapshots on older data nodes, but I don't think there is any potential for repo-corruption even when working with pre-7.6 nodes.

Copy link
Contributor

@DaveCTurner DaveCTurner 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, I left one question and one suggestion.

Copy link
Contributor

@DaveCTurner DaveCTurner left a comment

Choose a reason for hiding this comment

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

LGTM (one outstanding suggestion)

@original-brownbear
Copy link
Member Author

Thanks David!

@original-brownbear original-brownbear merged commit 3dff3a4 into elastic:master May 11, 2021
@original-brownbear original-brownbear deleted the allow-update-repo-settings branch May 11, 2021 17:56
original-brownbear added a commit to original-brownbear/elasticsearch that referenced this pull request Jun 14, 2021
This commit serves two purposes. For one, we need the ability to dynamically
update a repository setting for the encrypted repository work.

Also, this allows dynamically updating repository rate limits while snapshots are
in progress. This has often been an issue in the past where a long running snapshot
made progress over a long period of time already but is going too slowly with the
current rate limit. This left no good options, either throw away the existing
partly done snapshot's work and recreate the repo with a higher rate limit to speed
things up or wait for a long time with the current rate limit.
With this change the rate limit can simply be increased while a snapshot or restore
is running and will take effect imidiately.
original-brownbear added a commit that referenced this pull request Jun 14, 2021
…4052)

This commit serves two purposes. For one, we need the ability to dynamically
update a repository setting for the encrypted repository work.

Also, this allows dynamically updating repository rate limits while snapshots are
in progress. This has often been an issue in the past where a long running snapshot
made progress over a long period of time already but is going too slowly with the
current rate limit. This left no good options, either throw away the existing
partly done snapshot's work and recreate the repo with a higher rate limit to speed
things up or wait for a long time with the current rate limit.
With this change the rate limit can simply be increased while a snapshot or restore
is running and will take effect immediately.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >enhancement Team:Distributed Meta label for distributed team v7.14.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants