Merge branch 'stable-3.6' into stable-3.7
* stable-3.6:
Remove redundant format calls in log calls
Add put method to create/update global-refdb entry
Add happy path test for BatchRefUpdateValidator
Remove Maven legacy pom.xml
Return immediately if local ref update fails
Remove references to Zookeeper in logs
Squash filter/findFirst/isPresent into anyMatch
Fix typo in private method
Bump Gerrit and module to v3.6.6
Bump Gerrit and module to v3.5.6
Change-Id: Ibcc361909822c956b74721fdd8eee03649f1d8c5
diff --git a/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/RefUpdateValidator.java b/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/RefUpdateValidator.java
index 85e803a..ec8ff82 100644
--- a/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/RefUpdateValidator.java
+++ b/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/RefUpdateValidator.java
@@ -160,7 +160,7 @@
private Boolean isRefToBeIgnored(String refName) {
Boolean isRefToBeIgnored =
ignoredRefs.stream().anyMatch(ignoredRefPrefix -> refName.startsWith(ignoredRefPrefix));
- logger.atFine().log("Is project version update? %s", isRefToBeIgnored);
+ logger.atFine().log("Is project version update? %b", isRefToBeIgnored);
return isRefToBeIgnored;
}
@@ -176,7 +176,7 @@
protected Boolean isGlobalProject(String projectName) {
Boolean isGlobalProject = projectsFilter.matches(projectName);
- logger.atFine().log("Is global project? %s", isGlobalProject);
+ logger.atFine().log("Is global project? %b", isGlobalProject);
return isGlobalProject;
}
@@ -218,12 +218,6 @@
refEnforcement.getPolicy(projectName, refPair.getName());
if (refEnforcementPolicy == EnforcePolicy.IGNORED) return;
- String errorMessage =
- String.format(
- "Not able to persist the data in SharedRef for project '%s' and ref '%s',"
- + "the cluster is now in Split Brain since the commit has been "
- + "persisted locally but not in global-refdb the value %s",
- projectName, refPair.getName(), refPair.putValue);
boolean succeeded;
try {
succeeded =
@@ -237,6 +231,12 @@
}
if (!succeeded) {
+ String errorMessage =
+ String.format(
+ "Not able to persist the data in SharedRef for project '%s' and ref '%s',"
+ + "the cluster is now in Split Brain since the commit has been "
+ + "persisted locally but not in global-refdb the value %s",
+ projectName, refPair.getName(), refPair.putValue);
throw new SharedDbSplitBrainException(errorMessage);
}
}