gchq / Gaffer

A large-scale entity and relation database supporting aggregation of properties
Apache License 2.0
1.77k stars 350 forks source link

Add config options to disable named operations and named views #3169

Closed GCHQDeveloper314 closed 5 months ago

GCHQDeveloper314 commented 6 months ago

Describe the new feature you'd like To make configuration more obvious, it should be possible to explicitly disable named operations and named views, instead of having to do this by omitting cache configuration for them.

Why do you want this feature? In #3147 it was noticed that the job tracker can be enabled and disabled (by default disabled), but the same is not true for named operations and named views (by default enabled). Although they are enabled by default, they cannot be used if no cache class has been configured.

This has led to situations where the cache has been disabled so that named operations are disabled. With the changes in #3147 it is possible to use distinct kinds of cache for named operations, named views, federated stores and jobs. This makes it possible to use just one of these services by configuring the cache for only this service.

Describe alternatives you've considered Omitting cache configuration for named operations and named views to disable them, which is less clear.

Additional context This also allows for removing some less readable logic blocks using CacheServiceLoader.isEnabled from Store.java.

GCHQDeveloper314 commented 6 months ago

In addition to the above, there's a minor bug where logs are filled with Null Pointer Exceptions if the Job Tracker is enabled without valid cache configuration. This happens because the jobTracker object in Store.java is always initialised if the Job Tracker has been enabled, regardless of if the cache was initialised, this leads to later assumptions about the cache state being made based on the existence of this object.

The above should be fixed as part of this issue because this method will need to be refactored when the new config options are added.