Skip to content

Don't block stats for read-only indices#5876

Closed
imotov wants to merge 1 commit intoelastic:masterfrom
imotov:issue-5855-dont-block-stats-on-read-only-index
Closed

Don't block stats for read-only indices#5876
imotov wants to merge 1 commit intoelastic:masterfrom
imotov:issue-5855-dont-block-stats-on-read-only-index

Conversation

@imotov
Copy link
Copy Markdown
Contributor

@imotov imotov commented Apr 18, 2014

Closes #5855

@kimchy
Copy link
Copy Markdown
Member

kimchy commented May 6, 2014

I am not sure if this is a bug, since it blocks on METADATA operation, which all stats/status/... check on, I don't think we need to change it.

Looked at the issue, they should set index.blocks.read to true, and then it would allow for METADATA operations as well.

@imotov
Copy link
Copy Markdown
Contributor Author

imotov commented May 6, 2014

A possible workaround for this issue is to use "index.blocks.write": true instead of read_only. We will need to revisit this by adding more granular METADATA_READ and METADATA_WRITE blocks and implement this change across other methods such as segments, status, recovery...

@imotov imotov closed this May 6, 2014
@imotov imotov removed v1.1.2 labels May 7, 2014
@jpountz jpountz removed the review label May 12, 2014
tlrx added a commit to tlrx/elasticsearch that referenced this pull request Jan 8, 2015
While looking at elastic#3703, it looks like the usage of 'read_only' is a bit confusing.

The documentation stipulates:
> index.blocks.read_only
> Set to true to have the index read only, false to allow writes and metadata changes.

Actually, it blocks all write operations (creating, indexing or deleting a document) but also all read/write operations on index metadata. This can lead to confusion because subsequent 'indices exists' requests will return an undocumented 403 Forbidden response code where one could expect a 200 OK (as reported in elastic#3703). Same for 'type exists' and 'alias exists' requests.

Similar issues have been reported:
- _status elastic#2833 (deprecated in 1.2.0)
- _stats elastic#5876
- /_cat/indices elastic#5855

But several API calls returns a 403 when at least one index of the cluster has 'index.blocks.read_only' set to true:

DELETE /_all

POST /library/book/1
{
  "title": "Elasticsearch: the definitive guide"
}

POST /movies/dvd/1
{
  "title": "Elasticsearch: the movie"
}

PUT /library/_settings
{
  "index": {
    "blocks.read_only": true
  }
}

The following calls will return 403 / "ClusterBlockException[blocked by: [FORBIDDEN/5/index read-only (api)];]":

HEAD /library
HEAD /library/book
HEAD /_all/dvd

GET /library/_settings
GET /library/_mappings
GET /library/_warmers
GET /library/_aliases

GET /_settings
GET /_aliases
GET /_mappings
GET /_cat/indices

I agree to @imotov's comment (see elastic#5876 (comment)) and I think we should split the METADATA blocks in METADATA_READ & METADATA_WRITE blocks. This way the 'read_only' setting will block all write operations and metadata updates but the metadata will still be available.

This is a first step in this way, closes elastic#3703
@imotov imotov deleted the issue-5855-dont-block-stats-on-read-only-index branch May 1, 2020 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ClusterBlockException on /_cat/indices/ on readonly indices

4 participants