Skip to content

Commit 0e0fb8f

Browse files
committed
bug: Revert 281f5fc fix: Turn off bitset length fatal check
#35 RuntimeException when running with very high options in 0.2.0.0 (Bitset too long to encode) #35 This is due to Support BitSet encoding lengths longer than Short.MAX_VALUE #37. Release 0.2.0.1 was put out incorrectly removing the check, but then it suddenly occurred to me what it was really checking. However, this situation should not have arose because of the MAX values used in the test, there should never have been that many messages uncommitted anyway. So two issues to fix here - first the reason there were so many to encode in the first place, and second upgrade the BitSet encoder to use Integers. #37 Support BitSet encoding lengths longer than Short.MAX_VALUE #37
1 parent 89fe397 commit 0e0fb8f

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

CHANGELOG.adoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
= Change Log
22

3+
== v0.2.0.2
4+
5+
* Fixes
6+
** Turns back on the https://github.com/confluentinc/parallel-consumer/issues/35[Bitset overflow check (#35)]
7+
8+
== v0.2.0.1 DO NOT USE
9+
10+
* Fixes
11+
** Incorrectly turns off an over-flow check in https://github.com/confluentinc/parallel-consumer/issues/35[offset serialisation system (#35)]
12+
313
== v0.2.0.0
414

515
* Features:

parallel-consumer-core/src/main/java/io/confluent/parallelconsumer/OffsetSimultaneousEncoder.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ private class BitsetEncoder extends Encoder {
211211
public BitsetEncoder(final int length) {
212212
// prep bit set buffer
213213
this.wrappedBitsetBytesBuffer = ByteBuffer.allocate(Short.BYTES + ((length / 8) + 1));
214+
if (length > Short.MAX_VALUE) {
215+
// need to upgrade to using Integer for the bitset length, but can't change serialisation format in-place
216+
throw new RuntimeException("Bitset too long to encode, bitset length overflows Short.MAX_VALUE: " + length + ". (max: " + Short.MAX_VALUE + ")");
217+
}
214218
// bitset doesn't serialise it's set capacity, so we have to as the unused capacity actually means something
215219
this.wrappedBitsetBytesBuffer.putShort((short) length);
216220
bitSet = new BitSet(length);

0 commit comments

Comments
 (0)