Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Change AD indices to be hidden indices instead of system indices. #394

Conversation

kaituo
Copy link
Member

@kaituo kaituo commented Mar 6, 2021

Issue #, if available:

Description of changes:

Previously, we registered AD indices as system indices as AD indices' names start with a dot. ES deprecates the creation of dot-prefixed index names except for hidden and system indices (elastic/elasticsearch#49959). Starting 7.10, ES adds a dedicated thread pool for system index write operations. System index writes/reads have higher priority than user index writes/reads. For example, system index writes can be forced regardless of whether the current index pressure is high or not (https://github.com/elastic/elasticsearch/blob/242083a36e02496aae9214dc41b89372022e7076/server/src/main/java/org/elasticsearch/index/IndexingPressure.java#L62-L73).

AD indices are not more important than other user indices. We don't want AD index reads/writes to impact user indices' reads/writes. This PR removes AD indices out of the system index list and marks them hidden indices instead.

This change does not impact created AD indices. They are no longer system indices. Using indices metadata section in localhost:9200/_cluster/state?pretty output can confirm that (look for "system" key under each index ). Newly created AD indices will be hidden instead of system indices. This change won't impact search/index API. To list hidden indices, one can use localhost:9200/_cat/indices?v&expand_wildcards=all

Testing done:

  1. Ran backward-compatibility tests. After updating AD, old detectors run fine, and we can create/run new detectors. All public APIs still work.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Previously, we registered AD indices as system indices as AD indices' names start with a dot. ES deprecates the creation of dot-prefixed index names except for hidden and system indices (elastic/elasticsearch#49959). Starting 7.10, ES adds a dedicated thread pool for system index write operations. System index writes/reads have higher priority than user index writes/reads. For example, system index writes can be forced regardless of whether the current index pressure is high or not (https://github.com/elastic/elasticsearch/blob/242083a36e02496aae9214dc41b89372022e7076/server/src/main/java/org/elasticsearch/index/IndexingPressure.java#L62-L73). 

AD indices are not more important than other user indices. We don't want AD index reads/writes to impact user indices' reads/writes. This PR removes AD indices out of the system index list and marks them hidden indices instead.

This change does not impact created AD indices. They are still system indices. Newly created AD indices will be hidden instead of system indices. This change won't impact search/index API. To list hidden indices, one can use localhost:9200/_cat/indices?v&expand_wildcards=all

Testing done:
1. Ran backward-compatibility tests. After updating AD, old detectors run fine, and we can create/run new detectors. All public APIs still work.
@codecov
Copy link

codecov bot commented Mar 6, 2021

Codecov Report

Merging #394 (e753b58) into 7.10.2-no-workbench (1d88cb4) will increase coverage by 1.65%.
The diff coverage is 100.00%.

Impacted file tree graph

@@                    Coverage Diff                    @@
##             7.10.2-no-workbench     #394      +/-   ##
=========================================================
+ Coverage                  73.66%   75.32%   +1.65%     
- Complexity                  2022     2100      +78     
=========================================================
  Files                        201      206       +5     
  Lines                       9664     9774     +110     
  Branches                     860      865       +5     
=========================================================
+ Hits                        7119     7362     +243     
+ Misses                      2112     1989     -123     
+ Partials                     433      423      -10     
Flag Coverage Δ Complexity Δ
cli 79.27% <ø> (ø) 0.00 <ø> (ø)
plugin 75.00% <100.00%> (+1.79%) 0.00 <0.00> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
...stroforelasticsearch/ad/AnomalyDetectorPlugin.java 94.73% <ø> (-0.10%) 10.00 <0.00> (-1.00)
...sticsearch/ad/indices/AnomalyDetectionIndices.java 50.48% <100.00%> (+0.81%) 40.00 <0.00> (ø)
...ad/common/exception/AnomalyDetectionException.java 91.66% <0.00%> (-8.34%) 5.00% <0.00%> (ø%)
...distroforelasticsearch/ad/EntityProfileRunner.java 78.16% <0.00%> (-1.12%) 31.00% <0.00%> (ø%)
...arch/ad/transport/handler/AnomalyIndexHandler.java 84.61% <0.00%> (-1.10%) 16.00% <0.00%> (ø%)
.../handler/IndexAnomalyDetectorJobActionHandler.java 10.58% <0.00%> (-0.26%) 3.00% <0.00%> (ø%)
...rch/ad/transport/AnomalyResultTransportAction.java 80.78% <0.00%> (-0.02%) 77.00% <0.00%> (+6.00%) ⬇️
...n/opendistroforelasticsearch/ad/MemoryTracker.java 77.02% <0.00%> (ø) 21.00% <0.00%> (ø%)
...opendistroforelasticsearch/ad/util/IndexUtils.java 87.87% <0.00%> (ø) 10.00% <0.00%> (ø%)
... and 35 more

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants