HADOOP-13684. Snappy may complain Hadoop is built without snappy if libhadoop is not found. Contributed by Wei-Chiu Chuang.
(cherry picked from commit4b32b1420d
) (cherry picked from commit56184de510
)
This commit is contained in:
parent
aeb75213d4
commit
773e2e6b6c
|
@ -60,20 +60,22 @@ public class SnappyCodec implements Configurable, CompressionCodec, DirectDecomp
|
||||||
* Are the native snappy libraries loaded & initialized?
|
* Are the native snappy libraries loaded & initialized?
|
||||||
*/
|
*/
|
||||||
public static void checkNativeCodeLoaded() {
|
public static void checkNativeCodeLoaded() {
|
||||||
if (!NativeCodeLoader.isNativeCodeLoaded() ||
|
if (!NativeCodeLoader.buildSupportsSnappy()) {
|
||||||
!NativeCodeLoader.buildSupportsSnappy()) {
|
throw new RuntimeException("native snappy library not available: " +
|
||||||
throw new RuntimeException("native snappy library not available: " +
|
"this version of libhadoop was built without " +
|
||||||
"this version of libhadoop was built without " +
|
"snappy support.");
|
||||||
"snappy support.");
|
}
|
||||||
}
|
if (!NativeCodeLoader.isNativeCodeLoaded()) {
|
||||||
if (!SnappyCompressor.isNativeCodeLoaded()) {
|
throw new RuntimeException("Failed to load libhadoop.");
|
||||||
throw new RuntimeException("native snappy library not available: " +
|
}
|
||||||
"SnappyCompressor has not been loaded.");
|
if (!SnappyCompressor.isNativeCodeLoaded()) {
|
||||||
}
|
throw new RuntimeException("native snappy library not available: " +
|
||||||
if (!SnappyDecompressor.isNativeCodeLoaded()) {
|
"SnappyCompressor has not been loaded.");
|
||||||
throw new RuntimeException("native snappy library not available: " +
|
}
|
||||||
"SnappyDecompressor has not been loaded.");
|
if (!SnappyDecompressor.isNativeCodeLoaded()) {
|
||||||
}
|
throw new RuntimeException("native snappy library not available: " +
|
||||||
|
"SnappyDecompressor has not been loaded.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isNativeCodeLoaded() {
|
public static boolean isNativeCodeLoaded() {
|
||||||
|
|
Loading…
Reference in New Issue