@Test public void shouldFailOn_9_5_0() { thrown.expectMessage("Versions 9.5.0 and 9.5.1 contain a known bug"); PostgresVersionCheck.checkDatabaseVersion("9.5.0", mock(Logger.class)); }
public static void checkDatabaseVersion(String version, Logger log) { boolean checkPasses = version.matches("^[\\.0-9]+$") && VersionStrings.compareVersions(version, MIN_POSTGRES_VERSION) >= 0; if (VersionStrings.compareVersions(version, "9.5") >= 0 && VersionStrings.compareVersions(version, "9.5.2") < 0) { throw new DbkvsVersionException( "You are running Postgres " + version + ". Versions 9.5.0 and 9.5.1 contain a known bug " + "that causes incorrect results to be returned for certain queries. " + "Please update your Postgres distribution."); } AssertUtils.assertAndLog(log, checkPasses, "Your key value service currently uses version %s of postgres." + " The minimum supported version is %s." + " If you absolutely need to use an older version of postgres," + " please contact Palantir support for assistance.", version, MIN_POSTGRES_VERSION); }
PostgresVersionCheck { public static void checkDatabaseVersion(String version, Logger log) { boolean checkPasses = version.matches("^[\\.0-9]+$") && VersionStrings.compareVersions(version, MIN_POSTGRES_VERSION) >= 0; if (VersionStrings.compareVersions(version, "9.5") >= 0 && VersionStrings.compareVersions(version, "9.5.2") < 0) { throw new DbkvsVersionException( "You are running Postgres " + version + ". Versions 9.5.0 and 9.5.1 contain a known bug " + "that causes incorrect results to be returned for certain queries. " + "Please update your Postgres distribution."); } AssertUtils.assertAndLog(log, checkPasses, "Your key value service currently uses version %s of postgres." + " The minimum supported version is %s." + " If you absolutely need to use an older version of postgres," + " please contact Palantir support for assistance.", version, MIN_POSTGRES_VERSION); } }
PostgresVersionCheck { public static void checkDatabaseVersion(String version, Logger log) { boolean checkPasses = version.matches("^[\\.0-9]+$") && VersionStrings.compareVersions(version, MIN_POSTGRES_VERSION) >= 0; if (VersionStrings.compareVersions(version, "9.5") >= 0 && VersionStrings.compareVersions(version, "9.5.2") < 0) { throw new DbkvsVersionException( "You are running Postgres " + version + ". Versions 9.5.0 and 9.5.1 contain a known bug " + "that causes incorrect results to be returned for certain queries. " + "Please update your Postgres distribution."); } AssertUtils.assertAndLog(log, checkPasses, "Your key value service currently uses version %s of postgres." + " The minimum supported version is %s." + " If you absolutely need to use an older version of postgres," + " please contact Palantir support for assistance.", version, MIN_POSTGRES_VERSION); } private  PostgresVersionCheck(); }
PostgresVersionCheck { public static void checkDatabaseVersion(String version, Logger log) { boolean checkPasses = version.matches("^[\\.0-9]+$") && VersionStrings.compareVersions(version, MIN_POSTGRES_VERSION) >= 0; if (VersionStrings.compareVersions(version, "9.5") >= 0 && VersionStrings.compareVersions(version, "9.5.2") < 0) { throw new DbkvsVersionException( "You are running Postgres " + version + ". Versions 9.5.0 and 9.5.1 contain a known bug " + "that causes incorrect results to be returned for certain queries. " + "Please update your Postgres distribution."); } AssertUtils.assertAndLog(log, checkPasses, "Your key value service currently uses version %s of postgres." + " The minimum supported version is %s." + " If you absolutely need to use an older version of postgres," + " please contact Palantir support for assistance.", version, MIN_POSTGRES_VERSION); } private  PostgresVersionCheck(); static void checkDatabaseVersion(String version, Logger log); }
PostgresVersionCheck { public static void checkDatabaseVersion(String version, Logger log) { boolean checkPasses = version.matches("^[\\.0-9]+$") && VersionStrings.compareVersions(version, MIN_POSTGRES_VERSION) >= 0; if (VersionStrings.compareVersions(version, "9.5") >= 0 && VersionStrings.compareVersions(version, "9.5.2") < 0) { throw new DbkvsVersionException( "You are running Postgres " + version + ". Versions 9.5.0 and 9.5.1 contain a known bug " + "that causes incorrect results to be returned for certain queries. " + "Please update your Postgres distribution."); } AssertUtils.assertAndLog(log, checkPasses, "Your key value service currently uses version %s of postgres." + " The minimum supported version is %s." + " If you absolutely need to use an older version of postgres," + " please contact Palantir support for assistance.", version, MIN_POSTGRES_VERSION); } private  PostgresVersionCheck(); static void checkDatabaseVersion(String version, Logger log);  }