Fix online reindexing for plugins-dependent rules
Online reindex recalculates the status of all the changes by invoking the Prolog rules associated. That is good in general but breaks systematically when the rules depend on plugins for their accurate evaluation. Noteworthy example is the use of singleusergroup plugin in conjunction with user-specific ACLs for labels. Another even more severe example is the use of custom Prolog predicates in rules.pl provided by the owners' plugin. By swapping the order of registration of the Plugins module and the Lucene Index module, the lifecycle listener will then load first the plugins and only afterward activate the online reindexer. Bug: Issue 6472 Change-Id: I87da6ac632d08aa915a57a01435cfa415b7de2f9
This commit is contained in:
@@ -322,8 +322,21 @@ public class WebAppInitializer extends GuiceServletContextListener implements Fi
|
||||
modules.add(cfgInjector.getInstance(MailReceiver.Module.class));
|
||||
modules.add(new SmtpEmailSender.Module());
|
||||
modules.add(new SignedTokenEmailTokenVerifier.Module());
|
||||
|
||||
// Plugin module needs to be inserted *before* the index module.
|
||||
// There is the concept of LifecycleModule, in Gerrit's own extension
|
||||
// to Guice, which has these:
|
||||
// listener().to(SomeClassImplementingLifecycleListener.class);
|
||||
// and the start() methods of each such listener are executed in the
|
||||
// order they are declared.
|
||||
// Makes sure that PluginLoader.start() is executed before the
|
||||
// LuceneIndexModule.start() so that plugins get loaded and the respective
|
||||
// Guice modules installed so that the on-line reindexing will happen
|
||||
// with the proper classes (e.g. group backends, custom Prolog
|
||||
// predicates) and the associated rules ready to be evaluated.
|
||||
modules.add(new PluginModule());
|
||||
modules.add(new PluginRestApiModule());
|
||||
|
||||
modules.add(new RestCacheAdminModule());
|
||||
modules.add(new GpgModule(config));
|
||||
modules.add(new StartupChecks.Module());
|
||||
|
Reference in New Issue
Block a user