HDFS-11943. [Erasure coding] Warn log frequently print to screen in doEncode/doDecode functions. Contributed by liaoyuxiangqin

This commit is contained in:
Kai Zheng 2017-06-26 16:26:09 +08:00
parent a594f96fb1
commit 379f19a2c7
2 changed files with 14 additions and 2 deletions

View File

@ -19,6 +19,7 @@ package org.apache.hadoop.io.erasurecode.rawcoder;
import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.io.erasurecode.ErasureCoderOptions; import org.apache.hadoop.io.erasurecode.ErasureCoderOptions;
import org.apache.hadoop.util.PerformanceAdvisory;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -66,7 +67,7 @@ abstract class AbstractNativeRawDecoder extends RawErasureDecoder {
@Override @Override
protected void doDecode(ByteArrayDecodingState decodingState) { protected void doDecode(ByteArrayDecodingState decodingState) {
LOG.warn("convertToByteBufferState is invoked, " + PerformanceAdvisory.LOG.debug("convertToByteBufferState is invoked, " +
"not efficiently. Please use direct ByteBuffer inputs/outputs"); "not efficiently. Please use direct ByteBuffer inputs/outputs");
ByteBufferDecodingState bbdState = decodingState.convertToByteBufferState(); ByteBufferDecodingState bbdState = decodingState.convertToByteBufferState();
@ -78,6 +79,11 @@ abstract class AbstractNativeRawDecoder extends RawErasureDecoder {
} }
} }
@Override
public boolean preferDirectBuffer() {
return true;
}
// To link with the underlying data structure in the native layer. // To link with the underlying data structure in the native layer.
// No get/set as only used by native codes. // No get/set as only used by native codes.
private long nativeCoder; private long nativeCoder;

View File

@ -19,6 +19,7 @@ package org.apache.hadoop.io.erasurecode.rawcoder;
import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.io.erasurecode.ErasureCoderOptions; import org.apache.hadoop.io.erasurecode.ErasureCoderOptions;
import org.apache.hadoop.util.PerformanceAdvisory;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -63,7 +64,7 @@ abstract class AbstractNativeRawEncoder extends RawErasureEncoder {
@Override @Override
protected void doEncode(ByteArrayEncodingState encodingState) { protected void doEncode(ByteArrayEncodingState encodingState) {
LOG.warn("convertToByteBufferState is invoked, " + PerformanceAdvisory.LOG.debug("convertToByteBufferState is invoked, " +
"not efficiently. Please use direct ByteBuffer inputs/outputs"); "not efficiently. Please use direct ByteBuffer inputs/outputs");
ByteBufferEncodingState bbeState = encodingState.convertToByteBufferState(); ByteBufferEncodingState bbeState = encodingState.convertToByteBufferState();
@ -75,6 +76,11 @@ abstract class AbstractNativeRawEncoder extends RawErasureEncoder {
} }
} }
@Override
public boolean preferDirectBuffer() {
return true;
}
// To link with the underlying data structure in the native layer. // To link with the underlying data structure in the native layer.
// No get/set as only used by native codes. // No get/set as only used by native codes.
private long nativeCoder; private long nativeCoder;