spark-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sean Owen <so...@cloudera.com>
Subject Is this a little bug in BlockTransferMessage ?
Date Tue, 09 Dec 2014 21:53:08 GMT
https://github.com/apache/spark/blob/master/network/shuffle/src/main/java/org/apache/spark/network/shuffle/protocol/BlockTransferMessage.java#L70

public byte[] toByteArray() {
  ByteBuf buf = Unpooled.buffer(encodedLength());
  buf.writeByte(type().id);
  encode(buf);
  assert buf.writableBytes() == 0 : "Writable bytes remain: " +
buf.writableBytes();
  return buf.array();
}

Running the Java tests at last might have turned up a little bug here,
but wanted to check. This makes a buffer to hold enough bytes to
encode the message. But it writes 1 byte, plus the message. This makes
the buffer expand, and then does have nonzero capacity afterwards, so
the assert fails.

So just needs a "+ 1" in the size?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@spark.apache.org
For additional commands, e-mail: dev-help@spark.apache.org


Mime
View raw message