Skip to content

Conversation

@idegtiarenko
Copy link
Contributor

@idegtiarenko idegtiarenko commented Jan 12, 2022

Currently it is possible to uninstall repository plugin before
deleting repository that uses it. In such case the repository is still
listed in the API however every interraction with it produces the
"no such repository" exception. This is very confusing for the users.
This change updates the error message to correctly point the root of the
issue.

Closes: #81758

Currently it is possible to uninstall repository plugin before
deleting repository that uses it. In such case the repository is still
listed in the API however every interraction with it produces the
"no such repository" exception. This is very confusing for the users.
This change updates the error message to correctly point the root of the
 issue.
@idegtiarenko idegtiarenko added :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. v8.1.0 labels Jan 12, 2022
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 @idegtiarenko, I left a few comments/suggestions.

@idegtiarenko idegtiarenko marked this pull request as ready for review January 12, 2022 14:59
@elasticmachine
Copy link
Collaborator

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

Comment on lines 210 to 221
private static void assertThatThrows(ThrowingRunnable code, Class<? extends Exception> exceptionType, Matcher<String> messageMatcher) {
try {
code.run();
} catch (Throwable e) {
assertThat(e, exceptionType, messageMatcher);
}
}

private static void assertThat(Throwable exception, Class<? extends Exception> exceptionType, Matcher<String> messageMatcher) {
assertThat(exception, isA(exceptionType));
assertThat(exception.getMessage(), messageMatcher);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there a good common place to move this to? May be ESTestCase?
I am missing a simple way to assert exceptions in hamcrest similarly to what assertj offers: https://assertj.github.io/doc/#assertj-core-exception-assertions

Copy link
Contributor

Choose a reason for hiding this comment

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

TBH we mostly don't care about the exception type, the message is the important bit. I think it'd fit somewhere in :test:framework:org.elasticsearch.test.hamcrest if you wanted to add a utility method for this tho.

@idegtiarenko
Copy link
Contributor Author

@elasticmachine run elasticsearch-ci/rest-compatibility

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

@idegtiarenko
Copy link
Contributor Author

@elasticmachine run elasticsearch-ci/part-2

@idegtiarenko idegtiarenko merged commit 75579f7 into elastic:master Jan 14, 2022
@idegtiarenko idegtiarenko deleted the repository_plugin_not_installed branch January 14, 2022 08:22
DaveCTurner pushed a commit that referenced this pull request Apr 4, 2022
The `RepositoryService` on each node maintains a repository instance for
every repository defined in the cluster state. The master validates each
repository definition before inserting it into the cluster state, but in
some cases this validation is incomplete. For instance, there may be
node-local configuration of which the master is unaware which prevents
the repository from being instantiated on some other node in the
cluster.

Today if a repository cannot be instantiated then the node will log a
warning and continue as if the repository doesn't exist. This results in
a confusing `RepositoryMissingException` when trying to use the
repository, and various other surprises (e.g. #85550). With this commit
we create a placeholder `InvalidRepository` which reports a more
accurate exception when it is used.

Relates #82457 which did the same sort of thing for unknown plugins.
Closes #85550 since the repository in question is no longer `null`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>bug :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. v8.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Distinguish "repository doesn't exist" from "repository plugin not installed"

4 participants