Skip to content

Commit 0e74f1e

Browse files
authored
Fix thread safety of EC decoding during concurrent preads (apache#3881)
1 parent ca8ba24 commit 0e74f1e

File tree

1 file changed

+3
-3
lines changed
  • hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder

1 file changed

+3
-3
lines changed

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RawErasureDecoder.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public RawErasureDecoder(ErasureCoderOptions coderOptions) {
8181
* @param outputs output buffers to put decoded data into according to
8282
* erasedIndexes, ready for read after the call
8383
*/
84-
public void decode(ByteBuffer[] inputs, int[] erasedIndexes,
84+
public synchronized void decode(ByteBuffer[] inputs, int[] erasedIndexes,
8585
ByteBuffer[] outputs) throws IOException {
8686
ByteBufferDecodingState decodingState = new ByteBufferDecodingState(this,
8787
inputs, erasedIndexes, outputs);
@@ -130,7 +130,7 @@ protected abstract void doDecode(ByteBufferDecodingState decodingState)
130130
* erasedIndexes, ready for read after the call
131131
* @throws IOException if the decoder is closed.
132132
*/
133-
public void decode(byte[][] inputs, int[] erasedIndexes, byte[][] outputs)
133+
public synchronized void decode(byte[][] inputs, int[] erasedIndexes, byte[][] outputs)
134134
throws IOException {
135135
ByteArrayDecodingState decodingState = new ByteArrayDecodingState(this,
136136
inputs, erasedIndexes, outputs);
@@ -163,7 +163,7 @@ protected abstract void doDecode(ByteArrayDecodingState decodingState)
163163
* erasedIndexes, ready for read after the call
164164
* @throws IOException if the decoder is closed
165165
*/
166-
public void decode(ECChunk[] inputs, int[] erasedIndexes,
166+
public synchronized void decode(ECChunk[] inputs, int[] erasedIndexes,
167167
ECChunk[] outputs) throws IOException {
168168
ByteBuffer[] newInputs = CoderUtil.toBuffers(inputs);
169169
ByteBuffer[] newOutputs = CoderUtil.toBuffers(outputs);

0 commit comments

Comments
 (0)