public static boolean testCompression(String codec) {
    codec = codec.toLowerCase(Locale.ROOT);

    Compression.Algorithm a;

    try {
      a = Compression.getCompressionAlgorithmByName(codec);
    } catch (IllegalArgumentException e) {
      LOG.warn("Codec type: " + codec + " is not known");
      return false;
    }

    try {
      testCompression(a);
      return true;
    } catch (IOException ignored) {
      LOG.warn("Can't instantiate codec: " + codec, ignored);
      return false;
    }
  }
Compression validation test. Checks compression is working. Be sure to run on every node in your
cluster.
hbase-server/src/main/java/org/apache/hadoop/hbase/util/CompressionTest.java