private static void verifyFileDescriptor() { OptionalLong maxFileDescriptorCount = getMaxFileDescriptorCount(); if (!maxFileDescriptorCount.isPresent()) { // This should never happen since we have verified the OS and JVM above failRequirement("Cannot read OS file descriptor limit"); } if (maxFileDescriptorCount.getAsLong() < MIN_FILE_DESCRIPTORS) { failRequirement("Presto requires at least %s file descriptors (found %s)", MIN_FILE_DESCRIPTORS, maxFileDescriptorCount.getAsLong()); } if (maxFileDescriptorCount.getAsLong() < RECOMMENDED_FILE_DESCRIPTORS) { warnRequirement("Current OS file descriptor limit is %s. Presto recommends at least %s", maxFileDescriptorCount.getAsLong(), RECOMMENDED_FILE_DESCRIPTORS); } }
public static void verifyJvmRequirements() { verifyJavaVersion(); verify64BitJvm(); verifyOsArchitecture(); verifyByteOrder(); verifyUsingG1Gc(); verifyFileDescriptor(); verifySlice(); }
private static void verifyUsingG1Gc() { try { List<String> garbageCollectors = ManagementFactory.getGarbageCollectorMXBeans().stream() .map(GarbageCollectorMXBean::getName) .collect(toImmutableList()); if (garbageCollectors.stream().noneMatch(name -> name.toUpperCase(Locale.US).startsWith("G1 "))) { warnRequirement("Current garbage collectors are %s. Presto recommends the G1 garbage collector.", garbageCollectors); } } catch (RuntimeException e) { // This should never happen since we have verified the OS and JVM above failRequirement("Cannot read garbage collector information: %s", e); } }
@Override public void run() verifyJvmRequirements(); verifySystemTimeIsReasonable();
private static void verify64BitJvm() { String dataModel = System.getProperty("sun.arch.data.model"); if (!"64".equals(dataModel)) { failRequirement("Presto requires a 64-bit JVM (found %s)", dataModel); } }
@Test public void testVerifyJvmRequirements() { verifyJvmRequirements(); }
@Test public void testSystemTimeSanityCheck() { verifySystemTimeIsReasonable(); } }
@Override public void run() verifyJvmRequirements(); verifySystemTimeIsReasonable();
private static void verifyUsingG1Gc() { try { List<String> garbageCollectors = ManagementFactory.getGarbageCollectorMXBeans().stream() .map(GarbageCollectorMXBean::getName) .collect(toImmutableList()); if (garbageCollectors.stream().noneMatch(name -> name.toUpperCase(Locale.US).startsWith("G1 "))) { warnRequirement("Current garbage collectors are %s. Presto recommends the G1 garbage collector.", garbageCollectors); } } catch (RuntimeException e) { // This should never happen since we have verified the OS and JVM above failRequirement("Cannot read garbage collector information: %s", e); } }
private static void verifyByteOrder() { ByteOrder order = ByteOrder.nativeOrder(); if (!order.equals(ByteOrder.LITTLE_ENDIAN)) { failRequirement("Presto requires a little endian platform (found %s)", order); } }
@Test public void testVerifyJvmRequirements() { verifyJvmRequirements(); }
@Test public void testSystemTimeSanityCheck() { verifySystemTimeIsReasonable(); } }
public static void verifyJvmRequirements() { verifyJavaVersion(); verify64BitJvm(); verifyOsArchitecture(); verifyByteOrder(); verifyUsingG1Gc(); verifyFileDescriptor(); verifySlice(); }
private static void verifyFileDescriptor() { OptionalLong maxFileDescriptorCount = getMaxFileDescriptorCount(); if (!maxFileDescriptorCount.isPresent()) { // This should never happen since we have verified the OS and JVM above failRequirement("Cannot read OS file descriptor limit"); } if (maxFileDescriptorCount.getAsLong() < MIN_FILE_DESCRIPTORS) { failRequirement("Presto requires at least %s file descriptors (found %s)", MIN_FILE_DESCRIPTORS, maxFileDescriptorCount.getAsLong()); } if (maxFileDescriptorCount.getAsLong() < RECOMMENDED_FILE_DESCRIPTORS) { warnRequirement("Current OS file descriptor limit is %s. Presto recommends at least %s", maxFileDescriptorCount.getAsLong(), RECOMMENDED_FILE_DESCRIPTORS); } }
private static void verifyOsArchitecture() { String osName = StandardSystemProperty.OS_NAME.value(); String osArch = StandardSystemProperty.OS_ARCH.value(); if ("Linux".equals(osName)) { if (!"amd64".equals(osArch) && !"ppc64le".equals(osArch)) { failRequirement("Presto requires amd64 or ppc64le on Linux (found %s)", osArch); } if ("ppc64le".equals(osArch)) { warnRequirement("Support for the POWER architecture is experimental"); } } else if ("Mac OS X".equals(osName)) { if (!"x86_64".equals(osArch)) { failRequirement("Presto requires x86_64 on Mac OS X (found %s)", osArch); } } else { failRequirement("Presto requires Linux or Mac OS X (found %s)", osName); } }
private static void verify64BitJvm() { String dataModel = System.getProperty("sun.arch.data.model"); if (!"64".equals(dataModel)) { failRequirement("Presto requires a 64-bit JVM (found %s)", dataModel); } }
private static void verifyOsArchitecture() { String osName = StandardSystemProperty.OS_NAME.value(); String osArch = StandardSystemProperty.OS_ARCH.value(); if ("Linux".equals(osName)) { if (!"amd64".equals(osArch) && !"ppc64le".equals(osArch)) { failRequirement("Presto requires amd64 or ppc64le on Linux (found %s)", osArch); } if ("ppc64le".equals(osArch)) { warnRequirement("Support for the POWER architecture is experimental"); } } else if ("Mac OS X".equals(osName)) { if (!"x86_64".equals(osArch)) { failRequirement("Presto requires x86_64 on Mac OS X (found %s)", osArch); } } else { failRequirement("Presto requires Linux or Mac OS X (found %s)", osName); } }
private static void verifyByteOrder() { ByteOrder order = ByteOrder.nativeOrder(); if (!order.equals(ByteOrder.LITTLE_ENDIAN)) { failRequirement("Presto requires a little endian platform (found %s)", order); } }
/** * Perform a sanity check to make sure that the year is reasonably current, to guard against * issues in third party libraries. */ public static void verifySystemTimeIsReasonable() { int currentYear = DateTime.now().year().get(); if (currentYear < 2019) { failRequirement("Presto requires the system time to be current (found year %s)", currentYear); } }
/** * Perform a sanity check to make sure that the year is reasonably current, to guard against * issues in third party libraries. */ public static void verifySystemTimeIsReasonable() { int currentYear = DateTime.now().year().get(); if (currentYear < 2019) { failRequirement("Presto requires the system time to be current (found year %s)", currentYear); } }