Support multiple git repositories locations

Gerrit was supporting only one location for git repositories configured
with gerrit.basePath. Now supports alternate location for the
gerrit.basePath that can be configured with repository.name.basePath.

The motivation for this change is to allow to host projects on different
storage. This could be required for performance reasons, e.g. use a high
performance storage for a heavily used repository.

In the following example, all the repositories go in
/my/gerrit/site/git, except the ones with a name starting with
"organizationA", which go in /other/volume/git. If a new project is
created and its name starts with "organizationA", then it will be
created and used from /other/volume/git.

[gerrit]
  basePath = /my/gerrit/site/git
[repository "organizationA*"]
  basePath = /other/volume/git

An alternative to this change is using soft links in the gerrit.basePath
folder to allow putting some repositories on another storage. This
solution is not viable if gerrit.basePath folder is not on local
storage. For example, if the gerrit site, including the basePath for
repositories, are on NFS, then using a soft link on the NFS to link to a
high performance storage would not result in the expected performance
improvement. That is so because any repositories stored on the high
performance storage would be used through the NFS storage.

Change-Id: I1212d0226bfbb51ee92be4902c3658078d56b841
This commit is contained in:
Hugo Arès
2015-04-22 15:05:14 -04:00
parent 361da99354
commit 218bb3b0a0
9 changed files with 414 additions and 5 deletions

View File

@@ -44,7 +44,7 @@ import com.google.gerrit.server.config.RestCacheAdminModule;
import com.google.gerrit.server.config.SitePath;
import com.google.gerrit.server.git.ChangeCacheImplModule;
import com.google.gerrit.server.git.GarbageCollectionModule;
import com.google.gerrit.server.git.LocalDiskRepositoryManager;
import com.google.gerrit.server.git.GitRepositoryManagerModule;
import com.google.gerrit.server.git.ReceiveCommitsExecutorModule;
import com.google.gerrit.server.git.WorkQueue;
import com.google.gerrit.server.index.IndexModule;
@@ -285,7 +285,6 @@ public class WebAppInitializer extends GuiceServletContextListener
modules.add(new GerritServerConfigModule());
}
modules.add(new SchemaModule());
modules.add(new LocalDiskRepositoryManager.Module());
modules.add(new ConfigNotesMigration.Module());
modules.add(SchemaVersionCheck.module());
modules.add(new AuthConfigModule());
@@ -296,6 +295,7 @@ public class WebAppInitializer extends GuiceServletContextListener
final List<Module> modules = new ArrayList<>();
modules.add(new DropWizardMetricMaker.RestModule());
modules.add(new EventBroker.Module());
modules.add(cfgInjector.getInstance(GitRepositoryManagerModule.class));
modules.add(new ChangeHookRunner.Module());
modules.add(new ReceiveCommitsExecutorModule());
modules.add(new DiffExecutorModule());