Merge branch 'stable-3.10' into stable-3.11
* stable-3.10:
Implement filterAndLock in ReplicationFetchFilter
Delete duplicate DisabledSharedRefLogger class
Reformat with GJF 1.24.0
Remove obsolete LockWrapper.Factory
Adding the pull-replication extension for multi-site
Change-Id: I30e306c2f4dc017842137615083cc760d26c3e7c
diff --git a/setup_local_env/README.md b/setup_local_env/README.md
index e6ec9e7..8d9665f 100644
--- a/setup_local_env/README.md
+++ b/setup_local_env/README.md
@@ -74,7 +74,7 @@
[--gerrit2-httpd-port] Gerrit Instance 2 http port; default 18081
[--gerrit2-sshd-port] Gerrit Instance 2 sshd port; default 49418
-[--replication-delay] Replication delay across the two instances in seconds
+[--replication-delay] Replication delay across the two instances in seconds; default 5 seconds
[--just-cleanup-env] Cleans up previous deployment; default false
diff --git a/src/main/java/com/googlesource/gerrit/plugins/multisite/index/ChangeChecker.java b/src/main/java/com/googlesource/gerrit/plugins/multisite/index/ChangeChecker.java
index 3277150..4a081d0 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/multisite/index/ChangeChecker.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/multisite/index/ChangeChecker.java
@@ -27,7 +27,7 @@
*
* @return notes of the Change
*/
- public Optional<ChangeNotes> getChangeNotes();
+ Optional<ChangeNotes> getChangeNotes();
/**
* Create a new index event POJO associated with the current Change.
@@ -39,7 +39,7 @@
* @return new IndexEvent
* @throws IOException if the current Change cannot read
*/
- public Optional<ChangeIndexEvent> newIndexEvent(String projectName, int changeId, boolean deleted)
+ Optional<ChangeIndexEvent> newIndexEvent(String projectName, int changeId, boolean deleted)
throws IOException;
/**
@@ -48,7 +48,7 @@
* @param indexEvent indexing event
* @return true if the local Change is up-to-date, false otherwise.
*/
- public boolean isUpToDate(Optional<ChangeIndexEvent> indexEvent);
+ boolean isUpToDate(Optional<ChangeIndexEvent> indexEvent);
/**
* Return the last computed up-to-date Change time-stamp.
@@ -58,12 +58,12 @@
* @return the Change timestamp epoch in seconds
* @throws IOException if an I/O error occurred while reading the local Change
*/
- public Optional<Long> getComputedChangeTs() throws IOException;
+ Optional<Long> getComputedChangeTs() throws IOException;
/**
* Check if the local Change contains current patchset refs
*
* @return true if local change contains meta and current patchset refs
*/
- public boolean isChangeConsistent();
+ boolean isChangeConsistent();
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/multisite/validation/MultisiteReplicationFetchFilter.java b/src/main/java/com/googlesource/gerrit/plugins/multisite/validation/MultisiteReplicationFetchFilter.java
index ca79bcd..89310bf 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/multisite/validation/MultisiteReplicationFetchFilter.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/multisite/validation/MultisiteReplicationFetchFilter.java
@@ -95,7 +95,8 @@
}
@Override
- public Map<String, AutoCloseable> filterAndLock(String projectName, Set<String> fetchRefs) {
+ public Map<String, AutoCloseable> filterAndLock(String projectName, Set<String> fetchRefs)
+ throws RefDbLockException {
Project.NameKey projectKey = Project.nameKey(projectName);
Set<String> filteredRefs = new HashSet<>();
Map<String, AutoCloseable> refLocks = new HashMap<>();
diff --git a/src/main/java/com/googlesource/gerrit/plugins/multisite/validation/ValidationModule.java b/src/main/java/com/googlesource/gerrit/plugins/multisite/validation/ValidationModule.java
index 6f8ec50..958f265 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/multisite/validation/ValidationModule.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/multisite/validation/ValidationModule.java
@@ -20,6 +20,7 @@
import com.gerritforge.gerrit.globalrefdb.validation.RefUpdateValidator;
import com.gerritforge.gerrit.globalrefdb.validation.SharedRefDatabaseWrapper;
import com.gerritforge.gerrit.globalrefdb.validation.SharedRefDbBatchRefUpdate;
+import com.gerritforge.gerrit.globalrefdb.validation.SharedRefDbExceptionHook;
import com.gerritforge.gerrit.globalrefdb.validation.SharedRefDbGitRepositoryManager;
import com.gerritforge.gerrit.globalrefdb.validation.SharedRefDbRefDatabase;
import com.gerritforge.gerrit.globalrefdb.validation.SharedRefDbRefUpdate;
@@ -30,6 +31,8 @@
import com.gerritforge.gerrit.globalrefdb.validation.dfsrefdb.SharedRefEnforcement;
import com.google.common.collect.ImmutableSet;
import com.google.gerrit.extensions.config.FactoryModule;
+import com.google.gerrit.extensions.registration.DynamicSet;
+import com.google.gerrit.server.ExceptionHook;
import com.google.gerrit.server.config.RepositoryConfig;
import com.google.inject.Scopes;
import com.google.inject.TypeLiteral;
@@ -73,5 +76,7 @@
.to(CustomSharedRefEnforcementByProject.class)
.in(Scopes.SINGLETON);
}
+
+ DynamicSet.bind(binder(), ExceptionHook.class).to(SharedRefDbExceptionHook.class);
}
}
diff --git a/src/main/resources/Documentation/about.md b/src/main/resources/Documentation/about.md
index 1587bd9..63469f3 100644
--- a/src/main/resources/Documentation/about.md
+++ b/src/main/resources/Documentation/about.md
@@ -16,12 +16,7 @@
* connected to the same message broker
* behind a load balancer (e.g., HAProxy)
-Currently, the mode supported is one primary read/write master and multiple
-read-only masters but eventually the plan is to support `n` read/write masters.
-The read/write master is handling any traffic while the
-read-only masters are serving the Gerrit GUI assets, the HTTP GET REST API and
-git-upload-pack. The read-only masters are kept updated to be always
-ready to become a read/write master.
+Currently, the plugin can support multiple read/write masters as required.
The areas of alignment between the masters are: