facebook / facebook/rocksdb

Add ByteBuffer version of merge() to WriteBatchInterface and RocksDB

Open
#8,132 1 comment 2 reactions 0 assignees View on GitHub
java-api
Dominant language
C++
Stars
32.1k
Forks
6.9k
Avg merge
32m
Merged PRs (30d)
1

Description

Hi folks,

Could you please add ByteBuffer version of `merge()` to `WriteBatchInterface` and `RocksDB` ? That way I can have everything using direct memory Slices instead of copying JVM arrays.

Right now I have to allocate and copy `byte[]` just to call merge on the batch.

Alternatively (or additionally) it would be great to have offset versions of put and merge function so that it looks like

For `WriteBatchInterface`:
```
public void merge(final ColumnFamilyHandle columnFamilyHandle,
final ByteBuffer key, final ByteBuffer value) throws RocksDBException

public void put(final ColumnFamilyHandle columnFamilyHandle,
final byte[] key, final int offset, final int len,
final byte[] value, final int vOffset, final int vLen)
throws RocksDBException

public void merge(final ColumnFamilyHandle columnFamilyHandle,
final byte[] key, final int offset, final int len,
final byte[] value, final int vOffset, final int vLen)
throws RocksDBException
```

For `RocksDB`:
```
public void merge(final ColumnFamilyHandle columnFamilyHandle, final WriteOptions writeOpts,
final ByteBuffer key, final ByteBuffer value) throws RocksDBException
```

UPD: Turned out I mentioned this in comments of an old issue #2283 a year ago.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.