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

Streamline use of IndexClosedException introduced with #6475 #6990

Merged

Conversation

javanna
Copy link
Member

@javanna javanna commented Jul 23, 2014

Single index operations to use the newly added IndexClosedException introduced with #6475. This way we can also fail faster when we are trying to execute operations on closed indices and their use is not allowed (depending on indices options). Indices blocks are still checked but we can throw error earlier on while resolving indices (MetaData#concreteIndices).

Effectively this change also affects what we return when using one of the following apis: analyze, bulk, index, update, delete, explain, get, multi_get, mlt, term vector, multi_term vector. We now return:

{"error":"IndexClosedException[[test] closed]","status":403}

instead of

{"error":"ClusterBlockException[blocked by: [FORBIDDEN/4/index closed];]","status":403}

Closes #6988

@javanna javanna added the review label Jul 23, 2014
public static IndicesOptions strictSingleIndexNoExpand() {
return VALUES[FORBID_ALIASES_TO_MULTIPLE_INDICES];
public static IndicesOptions strictSingleIndexNoExpandForbidClosed() {
return VALUES[48];
Copy link
Contributor

Choose a reason for hiding this comment

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

why no constant for this?

Copy link
Member Author

Choose a reason for hiding this comment

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

cause this would be the only place where the constant would be used, while the other one was used in other places. Can add it though!

Copy link
Member

Choose a reason for hiding this comment

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

Make sense to add it just for documentation purposes.

@martijnvg
Copy link
Member

Besides @s1monw comment, LGTM

@javanna
Copy link
Member Author

javanna commented Jul 23, 2014

Agreed, thanks for the review @mvg and @s1monw , pushed a new commit that adds the missing constants. I think it's ready.

…tion on closed indices

Single index operations to use the newly added IndexClosedException introduced with elastic#6475. This way we can also fail faster when we are trying to execute operations on closed indices and their use is not allowed (depending on indices options). Indices blocks are still checked but we can already throw error while resolving indices (MetaData#concreteIndices).

Effectively this change also affects what we return when using one of the following apis: analyze, bulk, index, update, delete, explain, get, multi_get, mlt, term vector, multi_term vector. We now return `{"error":"IndexClosedException[[test] closed]","status":403}` instead of `{"error":"ClusterBlockException[blocked by: [FORBIDDEN/4/index closed];]","status":403}`.

Closes elastic#6988
@javanna javanna merged commit 3e30fa2 into elastic:master Jul 24, 2014
@javanna javanna removed the review label Jul 24, 2014
@javanna javanna self-assigned this Jul 24, 2014
@clintongormley clintongormley changed the title Internal: streamline use of IndexClosedException introduced with #6475 Streamline use of IndexClosedException introduced with #6475 Jun 6, 2015
@lcawl lcawl added :Core/Infra/Core Core issues without another label and removed :Exceptions labels Feb 13, 2018
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.

Internal: streamline use of IndexClosedException
5 participants