[Perf] Removed lazy creation of create_index action predicate
Instead of creating an automaton predicate on each request (very expensive) we now have a static create_index matcher (predicate) that is reused. Original commit: elastic/x-pack-elasticsearch@f70dae13ac
This commit is contained in:
parent
ac6b82ef7c
commit
b768ea9551
|
@ -150,7 +150,7 @@ public class InternalAuthorizationService extends AbstractComponent implements A
|
|||
}
|
||||
|
||||
//if we are creating an index we need to authorize potential aliases created at the same time
|
||||
if (Privilege.Index.CREATE_INDEX.predicate().apply(action)) {
|
||||
if (Privilege.Index.CREATE_INDEX_MATCHER.apply(action)) {
|
||||
assert request instanceof CreateIndexRequest;
|
||||
Set<Alias> aliases = CreateIndexRequestHelper.aliases((CreateIndexRequest) request);
|
||||
if (!aliases.isEmpty()) {
|
||||
|
|
|
@ -157,7 +157,8 @@ public abstract class Privilege<P extends Privilege<P>> {
|
|||
NONE, ALL, MANAGE, CREATE_INDEX, MANAGE_ALIASES, MONITOR, DATA_ACCESS, CRUD, READ, SEARCH, GET, SUGGEST, INDEX, DELETE, WRITE
|
||||
};
|
||||
|
||||
public static final Predicate<String> ACTION_MATCHER = Privilege.Index.ALL.predicate();
|
||||
public static final Predicate<String> ACTION_MATCHER = ALL.predicate();
|
||||
public static final Predicate<String> CREATE_INDEX_MATCHER = CREATE_INDEX.predicate();
|
||||
|
||||
static Index[] values() {
|
||||
return values;
|
||||
|
|
Loading…
Reference in New Issue