Skip to content

Commit

Permalink
Remove Hadoop native zlib requirement
Browse files Browse the repository at this point in the history
In some rare cases the CI fails to initialize the Hadoop zlib native
library.
  • Loading branch information
dain committed Aug 8, 2024
1 parent 68569ac commit 54f2c7f
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions src/test/java/io/airlift/compress/v2/HadoopNative.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@
*/
package io.airlift.compress.v2;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.compress.CompressionCodec;
import org.apache.hadoop.io.compress.CompressionCodecFactory;
import org.apache.hadoop.io.compress.GzipCodec;
import org.apache.hadoop.io.compress.zlib.ZlibDecompressor;
import org.apache.hadoop.io.compress.zlib.ZlibFactory;
import org.apache.hadoop.util.NativeCodeLoader;

import java.io.File;
Expand Down Expand Up @@ -51,8 +45,6 @@ public static synchronized void requireHadoopNative()
loadLibrary("gplcompression");
loadLibrary("lzo2");

requireNativeZlib();

loaded = true;
}
catch (Throwable t) {
Expand All @@ -61,24 +53,6 @@ public static synchronized void requireHadoopNative()
}
}

private static void requireNativeZlib()
{
Configuration conf = new Configuration();
if (!ZlibFactory.isNativeZlibLoaded(conf)) {
throw new RuntimeException("native zlib is not loaded");
}

CompressionCodecFactory factory = new CompressionCodecFactory(conf);
CompressionCodec codec = factory.getCodecByClassName(GzipCodec.class.getName());
if (codec == null) {
throw new RuntimeException("failed to load GzipCodec");
}
org.apache.hadoop.io.compress.Decompressor decompressor = codec.createDecompressor();
if (!(decompressor instanceof ZlibDecompressor)) {
throw new RuntimeException("wrong gzip decompressor: " + decompressor.getClass().getName());
}
}

private static void setStatic(Field field, Object value)
throws IllegalAccessException
{
Expand Down

0 comments on commit 54f2c7f

Please sign in to comment.