Merge branch 'stable-3.6' into stable-3.7

* stable-3.6:
  Add sentinel to prevent out of sync with global-refdb
  Verify global-refdb formatting using GJF 1.7

Change-Id: Ib31f723503439001aec21b6509abef05ad65065d
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 7b8b8a7..a331a83 100644
--- a/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/RefUpdateValidator.java
+++ b/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/RefUpdateValidator.java
@@ -161,7 +161,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;
   }
 
@@ -177,7 +177,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;
   }
 
@@ -219,12 +219,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 {
       if (!sharedRefDb.isNoop()) {
@@ -254,6 +248,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);
     }
   }