Rename master word to primary
Naming convention of master/slave have been replaced across the Gerrit
eco-system to less offensive and more appropriate primary/replica.
Adapt the high-availability code to this convention my renaming all
comment, documentation and variable instances using the word "primary"
rather than "master".
Change-Id: Ia3f83915f8ab064096cf09a44122b27678711c35
diff --git a/README.md b/README.md
index ef81595..fcf0566 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,9 @@
# Gerrit high-availability plugin
-This plugin allows deploying a cluster of multiple Gerrit masters
+This plugin allows deploying a cluster of multiple Gerrit primaries
on the same data-center sharing the same Git repositories.
-Requirements for the Gerrit masters are:
+Requirements for the Gerrit primaries are:
- Externally mounted filesystem shared among the cluster
- Load-balancer (HAProxy or similar)
@@ -17,17 +17,17 @@
Refer to the [build instructions in the plugin documentation](src/main/resources/Documentation/build.md).
-## Sample configuration for two Gerrit masters in high-availability
+## Sample configuration for two Gerrit primaries in high-availability
-Assuming that the Gerrit masters in the clusters are `gerrit-01.mycompany.com` and
+Assuming that the Gerrit primaries in the clusters are `gerrit-01.mycompany.com` and
`gerrit-02.mycompany.com`, listening on the HTTP port 8080, with a shared volume
mounted under `/shared`, see below the minimal configuration steps.
-1. Install one Gerrit master on the first node (e.g. `gerrit-01.mycompany.com`)
+1. Install one Gerrit primary on the first node (e.g. `gerrit-01.mycompany.com`)
with the repositories location under the shared volume (e.g. `/shared/git`).
Init the site in order to create the initial repositories.
-2. Copy all the files of the first Gerrit master onto the second node (e.g. `gerrit-02.mycompany.com`)
+2. Copy all the files of the first Gerrit primary onto the second node (e.g. `gerrit-02.mycompany.com`)
so that it points to the same repositories location.
3. Install the high-availability plugin into the `$GERRIT_SITE/plugins` directory of both
@@ -74,9 +74,9 @@
### Active-passive configuration
-It is the simplest and safest configuration, where only one Gerrit master at a
+It is the simplest and safest configuration, where only one Gerrit primary at a
time serves the incoming requests.
-In case of failure of the primary master, the traffic is forwarded to the backup.
+In case of failure of the primary, the traffic is forwarded to the backup.
Assuming a load-balancing implemented using [HAProxy](http://www.haproxy.org/)
associated with the domain name `gerrit.mycompany.com`, exposing Gerrit cluster nodes
@@ -125,7 +125,7 @@
### Active-active configuration
-This is an evolution of the previous active-passive configuration, where only one Gerrit master at a
+This is an evolution of the previous active-passive configuration, where only one Gerrit primary at a
time serves the HTTP write operations (PUT,POST,DELETE) while the remaining HTTP traffic is sent
to both.
In case of failure of one of the nodes, all the traffic is forwarded to the other node.
@@ -164,8 +164,8 @@
## Gerrit canonical URL and further adjustments
-Both Gerrit masters are now part of the same cluster, accessible through the HAProxy load-balancer.
-Set the `gerrit.canoncalWebUrl` on both Gerrit masters to the domain name of HAProxy so that any
+Both Gerrit primaries are now part of the same cluster, accessible through the HAProxy load-balancer.
+Set the `gerrit.canoncalWebUrl` on both Gerrit primaries to the domain name of HAProxy so that any
location or URL generated by Gerrit would direct the traffic to the balancer and not to the instance
that served the incoming call.
diff --git a/src/main/java/com/ericsson/gerrit/plugins/highavailability/SetupLocalHAReplica.java b/src/main/java/com/ericsson/gerrit/plugins/highavailability/SetupLocalHAReplica.java
index b5c9730..374d327 100644
--- a/src/main/java/com/ericsson/gerrit/plugins/highavailability/SetupLocalHAReplica.java
+++ b/src/main/java/com/ericsson/gerrit/plugins/highavailability/SetupLocalHAReplica.java
@@ -46,17 +46,17 @@
class SetupLocalHAReplica {
private static final String DATABASE = "database";
- private final SitePaths masterSitePaths;
- private final FileBasedConfig masterConfig;
+ private final SitePaths primarySitePaths;
+ private final FileBasedConfig primaryConfig;
private final Path sharedDir;
private SitePaths replicaSitePaths;
@Inject
- SetupLocalHAReplica(SitePaths masterSitePaths, InitFlags flags) {
- this.masterSitePaths = masterSitePaths;
- this.masterConfig = flags.cfg;
- this.sharedDir = masterSitePaths.site_path.resolve(DEFAULT_SHARED_DIRECTORY);
+ SetupLocalHAReplica(SitePaths primarySitePaths, InitFlags flags) {
+ this.primarySitePaths = primarySitePaths;
+ this.primaryConfig = flags.cfg;
+ this.sharedDir = primarySitePaths.site_path.resolve(DEFAULT_SHARED_DIRECTORY);
}
void run(SitePaths replica, FileBasedConfig pluginConfig)
@@ -74,15 +74,15 @@
mkdir(replicaSitePaths.logs_dir);
mkdir(replicaSitePaths.tmp_dir);
- symlink(Paths.get(masterConfig.getString("gerrit", null, "basePath")));
+ symlink(Paths.get(primaryConfig.getString("gerrit", null, "basePath")));
symlink(sharedDir);
FileBasedConfig replicaConfig =
new FileBasedConfig(replicaSitePaths.gerrit_config.toFile(), FS.DETECTED);
replicaConfig.load();
- if ("h2".equals(masterConfig.getString(DATABASE, null, "type"))) {
- masterConfig.setBoolean(DATABASE, "h2", "autoServer", true);
+ if ("h2".equals(primaryConfig.getString(DATABASE, null, "type"))) {
+ primaryConfig.setBoolean(DATABASE, "h2", "autoServer", true);
replicaConfig.setBoolean(DATABASE, "h2", "autoServer", true);
symlinkH2ReviewDbDir();
}
@@ -91,32 +91,32 @@
private List<Path> listDirsForCopy() throws IOException {
ImmutableList.Builder<Path> toSkipBuilder = ImmutableList.builder();
toSkipBuilder.add(
- masterSitePaths.resolve(masterConfig.getString("gerrit", null, "basePath")),
- masterSitePaths.db_dir,
- masterSitePaths.logs_dir,
+ primarySitePaths.resolve(primaryConfig.getString("gerrit", null, "basePath")),
+ primarySitePaths.db_dir,
+ primarySitePaths.logs_dir,
replicaSitePaths.site_path,
- masterSitePaths.site_path.resolve(sharedDir),
- masterSitePaths.tmp_dir);
- if ("h2".equals(masterConfig.getString(DATABASE, null, "type"))) {
+ primarySitePaths.site_path.resolve(sharedDir),
+ primarySitePaths.tmp_dir);
+ if ("h2".equals(primaryConfig.getString(DATABASE, null, "type"))) {
toSkipBuilder.add(
- masterSitePaths.resolve(masterConfig.getString(DATABASE, null, DATABASE)).getParent());
+ primarySitePaths.resolve(primaryConfig.getString(DATABASE, null, DATABASE)).getParent());
}
final ImmutableList<Path> toSkip = toSkipBuilder.build();
final ArrayList<Path> dirsForCopy = new ArrayList<>();
Files.walkFileTree(
- masterSitePaths.site_path,
+ primarySitePaths.site_path,
EnumSet.of(FileVisitOption.FOLLOW_LINKS),
Integer.MAX_VALUE,
new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
throws IOException {
- if (Files.isSameFile(dir, masterSitePaths.site_path)) {
+ if (Files.isSameFile(dir, primarySitePaths.site_path)) {
return FileVisitResult.CONTINUE;
}
- Path p = masterSitePaths.site_path.relativize(dir);
+ Path p = primarySitePaths.site_path.relativize(dir);
if (shouldSkip(p)) {
return FileVisitResult.SKIP_SUBTREE;
}
@@ -125,7 +125,7 @@
}
private boolean shouldSkip(Path p) throws IOException {
- Path resolved = masterSitePaths.site_path.resolve(p);
+ Path resolved = primarySitePaths.site_path.resolve(p);
for (Path skip : toSkip) {
if (skip.toFile().exists() && Files.isSameFile(resolved, skip)) {
return true;
@@ -139,7 +139,7 @@
}
private void copyFiles(Path dir) throws IOException {
- final Path source = masterSitePaths.site_path.resolve(dir);
+ final Path source = primarySitePaths.site_path.resolve(dir);
final Path target = replicaSitePaths.site_path.resolve(dir);
Files.createDirectories(target);
Files.walkFileTree(
@@ -167,12 +167,12 @@
if (!path.isAbsolute()) {
Files.createSymbolicLink(
replicaSitePaths.site_path.resolve(path),
- masterSitePaths.site_path.resolve(path).toAbsolutePath().normalize());
+ primarySitePaths.site_path.resolve(path).toAbsolutePath().normalize());
}
}
private void symlinkH2ReviewDbDir() throws IOException {
- symlink(Paths.get(masterConfig.getString(DATABASE, null, DATABASE)).getParent());
+ symlink(Paths.get(primaryConfig.getString(DATABASE, null, DATABASE)).getParent());
}
private void configureMainSection(FileBasedConfig pluginConfig) throws IOException {
@@ -180,7 +180,7 @@
MAIN_SECTION,
null,
SHARED_DIRECTORY_KEY,
- masterSitePaths.site_path.relativize(sharedDir).toString());
+ primarySitePaths.site_path.relativize(sharedDir).toString());
pluginConfig.save();
}
diff --git a/src/main/java/com/ericsson/gerrit/plugins/highavailability/SharedDirectory.java b/src/main/java/com/ericsson/gerrit/plugins/highavailability/SharedDirectory.java
index 29e2a6b..d0d7d25 100644
--- a/src/main/java/com/ericsson/gerrit/plugins/highavailability/SharedDirectory.java
+++ b/src/main/java/com/ericsson/gerrit/plugins/highavailability/SharedDirectory.java
@@ -20,7 +20,7 @@
import java.lang.annotation.Retention;
/**
- * {@link java.nio.file.Path} to a directory accessible from both master instances.
+ * {@link java.nio.file.Path} to a directory accessible from both primary instances.
*
* <p>Example of usage:
*
diff --git a/src/main/java/com/ericsson/gerrit/plugins/highavailability/forwarder/Forwarder.java b/src/main/java/com/ericsson/gerrit/plugins/highavailability/forwarder/Forwarder.java
index 59ba29b..3854ee3 100644
--- a/src/main/java/com/ericsson/gerrit/plugins/highavailability/forwarder/Forwarder.java
+++ b/src/main/java/com/ericsson/gerrit/plugins/highavailability/forwarder/Forwarder.java
@@ -18,11 +18,11 @@
import com.google.gerrit.server.events.Event;
import java.util.concurrent.CompletableFuture;
-/** Forward indexing, stream events and cache evictions to the other master */
+/** Forward indexing, stream events and cache evictions to the other primary */
public interface Forwarder {
/**
- * Forward a account indexing event to the other master.
+ * Forward an account indexing event to the other primary.
*
* @param accountId the account to index.
* @param indexEvent the details of the index event.
@@ -32,7 +32,7 @@
CompletableFuture<Boolean> indexAccount(int accountId, IndexEvent indexEvent);
/**
- * Forward a change indexing event to the other master.
+ * Forward a change indexing event to the other primary.
*
* @param projectName the project of the change to index.
* @param changeId the change to index.
@@ -43,7 +43,7 @@
CompletableFuture<Boolean> indexChange(String projectName, int changeId, IndexEvent indexEvent);
/**
- * Forward a change indexing event to the other master using batch index endpoint.
+ * Forward a change indexing event to the other primary using batch index endpoint.
*
* @param projectName the project of the change to index.
* @param changeId the change to index.
@@ -55,7 +55,7 @@
String projectName, int changeId, IndexEvent indexEvent);
/**
- * Forward a delete change from index event to the other master.
+ * Forward a delete change from index event to the other primary.
*
* @param changeId the change to remove from the index.
* @param indexEvent the details of the index event.
@@ -65,7 +65,7 @@
CompletableFuture<Boolean> deleteChangeFromIndex(int changeId, IndexEvent indexEvent);
/**
- * Forward a group indexing event to the other master.
+ * Forward a group indexing event to the other primary.
*
* @param uuid the group to index.
* @param indexEvent the details of the index event.
@@ -75,7 +75,7 @@
CompletableFuture<Boolean> indexGroup(String uuid, IndexEvent indexEvent);
/**
- * Forward a project indexing event to the other master.
+ * Forward a project indexing event to the other primary.
*
* @param projectName the project to index.
* @param indexEvent the details of the index event.
@@ -85,7 +85,7 @@
CompletableFuture<Boolean> indexProject(String projectName, IndexEvent indexEvent);
/**
- * Forward a stream event to the other master.
+ * Forward a stream event to the other primary.
*
* @param event the event to forward.
* @return {@link CompletableFuture} of true if successful, otherwise {@link CompletableFuture} of
@@ -94,7 +94,7 @@
CompletableFuture<Boolean> send(Event event);
/**
- * Forward a cache eviction event to the other master.
+ * Forward a cache eviction event to the other primary.
*
* @param cacheName the name of the cache to evict an entry from.
* @param key the key identifying the entry to evict from the cache.
@@ -104,7 +104,7 @@
CompletableFuture<Boolean> evict(String cacheName, Object key);
/**
- * Forward an addition to the project list cache to the other master.
+ * Forward an addition to the project list cache to the other primary.
*
* @param projectName the name of the project to add to the project list cache
* @return {@link CompletableFuture} of true if successful, otherwise {@link CompletableFuture} of
@@ -113,7 +113,7 @@
CompletableFuture<Boolean> addToProjectList(String projectName);
/**
- * Forward a removal from the project list cache to the other master.
+ * Forward a removal from the project list cache to the other primary.
*
* @param projectName the name of the project to remove from the project list cache
* @return {@link CompletableFuture} of true if successful, otherwise {@link CompletableFuture} of
@@ -122,7 +122,7 @@
CompletableFuture<Boolean> removeFromProjectList(String projectName);
/**
- * Forward the removal of all project changes from index to the other master.
+ * Forward the removal of all project changes from index to the other primary.
*
* @param projectName the name of the project whose changes should be removed from the index
* @return {@link CompletableFuture} of true if successful, otherwise {@link CompletableFuture} of
diff --git a/src/test/README.md b/src/test/README.md
index 16e4df9..80fe2e4 100644
--- a/src/test/README.md
+++ b/src/test/README.md
@@ -1,7 +1,7 @@
# Gerrit high-availability docker setup example
The Docker Compose project in the docker directory contains a simple test
-environment of two Gerrit masters in HA configuration, with their git repos
+environment of two Gerrit primaries in HA configuration, with their git repos
hosted on NFS filesystem.
## How to build