Skip to content

Commit

Permalink
apacheGH-39265: [Java] Make it run well with the netty newest version…
Browse files Browse the repository at this point in the history
… 4.1.104 (apache#39266)

### Describe the enhancement requested

When I used `netty arrow memory 14.0.1` and `netty 4.1.104.Final` in Spark, the following error occurred,
After pr: netty/netty#13613, `PoolArena` no longer extends `SizeClasses`, but instead uses it as one of its fields, as follows:
<img width="1051" alt="image" src="https:/apache/arrow/assets/15246973/6112757b-b2b7-42aa-b4c1-6ab473b91a09">
in order to ensure that `netty arrow memory 14.0.1` works well with `netty 4.1.104.Final` version, I suggest making similar modifications here.
1.Compilation errors are as follows:
https:/panbingkun/spark/actions/runs/7237466030/job/19717162391
<img width="1005" alt="image" src="https:/apache/arrow/assets/15246973/98edb6a1-f0e6-4d4e-b568-fbdbffe612f0">

2.Some bugs have been fixed in `netty 4.1.104.Final` as follows:
<img width="862" alt="image" src="https:/apache/arrow/assets/15246973/12354a1e-cddd-4ab8-b168-e92712d84cea">
<img width="861" alt="image" src="https:/apache/arrow/assets/15246973/bd7d27e1-3953-451c-8c9b-24ecb0d61efd">

4.1.104.Final release note: https://netty.io/news/2023/12/15/4-1-104-Final.html
4.1.103.Final release note: https://netty.io/news/2023/12/13/4-1-103-Final.html
4.1.101.Final release note: https://netty.io/news/2023/11/09/4-1-101-Final.html

### Component(s)

Java
* Closes: apache#39265

Authored-by: panbingkun <[email protected]>
Signed-off-by: David Li <[email protected]>
  • Loading branch information
panbingkun authored Dec 22, 2023
1 parent cd5a1bd commit a4a3d3f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public UnsafeDirectLittleEndian allocate(long size) {
}

public int getChunkSize() {
return allocator.chunkSize;
return allocator.chunkSize();
}

public long getHugeBufferSize() {
Expand Down Expand Up @@ -137,7 +137,6 @@ private class InnerAllocator extends PooledByteBufAllocator {

private final PoolArena<ByteBuffer>[] directArenas;
private final MemoryStatusThread statusThread;
private final int chunkSize;

public InnerAllocator() {
super(true);
Expand All @@ -150,8 +149,6 @@ public InnerAllocator() {
throw new RuntimeException("Failure while initializing allocator. Unable to retrieve direct arenas field.", e);
}

this.chunkSize = directArenas[0].chunkSize;

if (memoryLogger.isTraceEnabled()) {
statusThread = new MemoryStatusThread(this);
statusThread.start();
Expand All @@ -166,7 +163,7 @@ private UnsafeDirectLittleEndian newDirectBufferL(int initialCapacity, int maxCa

if (directArena != null) {

if (initialCapacity > directArena.chunkSize) {
if (initialCapacity > chunkSize()) {
// This is beyond chunk size so we'll allocate separately.
ByteBuf buf = UnpooledByteBufAllocator.DEFAULT.directBuffer(initialCapacity, maxCapacity);

Expand Down
2 changes: 1 addition & 1 deletion java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<dep.junit.jupiter.version>5.10.1</dep.junit.jupiter.version>
<dep.slf4j.version>2.0.9</dep.slf4j.version>
<dep.guava-bom.version>32.1.3-jre</dep.guava-bom.version>
<dep.netty-bom.version>4.1.100.Final</dep.netty-bom.version>
<dep.netty-bom.version>4.1.104.Final</dep.netty-bom.version>
<dep.grpc-bom.version>1.60.0</dep.grpc-bom.version>
<dep.protobuf-bom.version>3.23.1</dep.protobuf-bom.version>
<dep.jackson-bom.version>2.16.0</dep.jackson-bom.version>
Expand Down

0 comments on commit a4a3d3f

Please sign in to comment.