Update netty

This commit is contained in:
Andrea Cavalli 2022-05-18 00:52:01 +02:00
parent c9a12760bc
commit 84c9a2c3cc
11 changed files with 16 additions and 26 deletions

10
pom.xml
View File

@ -102,11 +102,11 @@
<artifactId>guava</artifactId>
<version>31.1-jre</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty5-buffer</artifactId>
<version>5.0.0.Alpha1</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty5-buffer</artifactId>
<version>5.0.0.Alpha2</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>

View File

@ -1,7 +1,5 @@
package it.cavallium.dbengine.database;
import static io.netty5.buffer.Unpooled.wrappedBuffer;
import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.api.Drop;
import io.netty5.buffer.api.Owned;

View File

@ -809,7 +809,7 @@ public class LLUtils {
b1.writerOffset(b1.writerOffset() + b2.readableBytes());
return b1;
} else {
return CompositeBuffer.compose(alloc, b1.send(), b2.send());
return alloc.compose(List.of(b1.send(), b2.send()));
}
}
}
@ -834,7 +834,7 @@ public class LLUtils {
b1.writerOffset(b1.writerOffset() + b3.readableBytes());
return b1;
} else {
return CompositeBuffer.compose(alloc, b1.send(), b2.send(), b3.send());
return alloc.compose(List.of(b1.send(), b2.send(), b3.send()));
}
}
}

View File

@ -267,8 +267,8 @@ public class CappedWriteBatch extends WriteBatch {
}
@Override
public synchronized void close() {
super.close();
protected void disposeInternal(boolean owningHandle) {
super.disposeInternal(owningHandle);
releaseAllBuffers();
}
}

View File

@ -1499,7 +1499,11 @@ public class LLLocalKeyValueDatabase implements LLKeyValueDatabase {
compressedCache,
new ArrayList<>(handles.values().stream().map(RocksObj::v).toList())
);
handles.values().forEach(ResourceSupport::close);
handles.values().forEach(columnFamilyHandleRocksObj -> {
if (columnFamilyHandleRocksObj.isAccessible()) {
columnFamilyHandleRocksObj.close();
}
});
handles.clear();
deleteUnusedOldLogFiles();
} catch (RocksDBException e) {

View File

@ -12,7 +12,7 @@ public class RocksObj<T extends AbstractNativeReference> extends ResourceSupport
@Override
public void drop(RocksObj obj) {
if (obj.val != null) {
obj.val.close();
if (obj.val.isAccessible()) obj.val.close();
}
}

View File

@ -1,6 +1,5 @@
package it.cavallium.dbengine.database.serialization;
import io.netty5.buffer.ByteBufUtil;
import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.api.BufferAllocator;
import io.netty5.buffer.api.Send;

View File

@ -1,6 +1,5 @@
package it.cavallium.dbengine.lucene.directory;
import io.netty5.buffer.Unpooled;
import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.api.BufferAllocator;
import io.netty5.buffer.api.BufferRef;

View File

@ -1,7 +1,5 @@
package it.cavallium.dbengine.lucene.directory;
import io.netty5.buffer.ByteBuf;
import io.netty5.buffer.ByteBufAllocator;
import io.netty5.buffer.api.Buffer;
import org.apache.lucene.store.BufferedChecksum;
import org.apache.lucene.store.IndexOutput;

View File

@ -8,7 +8,7 @@ import static it.cavallium.dbengine.SyncUtils.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
import io.netty5.buffer.PooledByteBufAllocator;
import io.netty.buffer.PooledByteBufAllocator;
import it.cavallium.dbengine.DbTestUtils.TempDb;
import it.cavallium.dbengine.DbTestUtils.TestAllocator;
import it.cavallium.dbengine.client.HitKey;

View File

@ -1,8 +1,5 @@
package it.cavallium.dbengine.database.collections;
import static io.netty5.buffer.Unpooled.wrappedBuffer;
import io.netty5.buffer.Unpooled;
import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.api.BufferAllocator;
import it.cavallium.dbengine.database.LLUtils;
@ -26,11 +23,6 @@ public class TestRanges {
alloc = BufferAllocator.offHeapPooled();
}
@Test
public void testDirectBuffer() {
Assertions.assertTrue(wrappedBuffer(Unpooled.directBuffer(10, 10), Unpooled.buffer(10, 10)).isDirect());
}
@Test
public void testNextRangeKey() {
testNextRangeKey(new byte[] {0x00, 0x00, 0x00});