diff --git a/java/rocksjni/portal.h b/java/rocksjni/portal.h index 45abe7c6d7..d14c95b64e 100644 --- a/java/rocksjni/portal.h +++ b/java/rocksjni/portal.h @@ -6539,6 +6539,8 @@ class ChecksumTypeJni { return 0x2; case ROCKSDB_NAMESPACE::ChecksumType::kxxHash64: return 0x3; + case ROCKSDB_NAMESPACE::ChecksumType::kXXH3: + return 0x4; default: return 0x7F; // undefined } diff --git a/java/src/main/java/org/rocksdb/ChecksumType.java b/java/src/main/java/org/rocksdb/ChecksumType.java index 7b2862df87..e03fa14bac 100644 --- a/java/src/main/java/org/rocksdb/ChecksumType.java +++ b/java/src/main/java/org/rocksdb/ChecksumType.java @@ -24,7 +24,9 @@ public enum ChecksumType { /** * XX Hash 64 */ - kxxHash64((byte) 3); + kxxHash64((byte) 3), + + kXXH3((byte) 4); /** * Returns the byte value of the enumerations value @@ -35,7 +37,7 @@ public enum ChecksumType { return value_; } - private ChecksumType(byte value) { + private ChecksumType(final byte value) { value_ = value; } diff --git a/java/src/test/java/org/rocksdb/BlockBasedTableConfigTest.java b/java/src/test/java/org/rocksdb/BlockBasedTableConfigTest.java index 560dcff4ab..defffa6c7b 100644 --- a/java/src/test/java/org/rocksdb/BlockBasedTableConfigTest.java +++ b/java/src/test/java/org/rocksdb/BlockBasedTableConfigTest.java @@ -62,35 +62,37 @@ public class BlockBasedTableConfigTest { final BlockBasedTableConfig blockBasedTableConfig = new BlockBasedTableConfig(); assertThat(IndexType.values().length).isEqualTo(4); blockBasedTableConfig.setIndexType(IndexType.kHashSearch); - assertThat(blockBasedTableConfig.indexType().equals( - IndexType.kHashSearch)); + assertThat(blockBasedTableConfig.indexType()).isEqualTo(IndexType.kHashSearch); assertThat(IndexType.valueOf("kBinarySearch")).isNotNull(); blockBasedTableConfig.setIndexType(IndexType.valueOf("kBinarySearch")); - assertThat(blockBasedTableConfig.indexType().equals( - IndexType.kBinarySearch)); + assertThat(blockBasedTableConfig.indexType()).isEqualTo(IndexType.kBinarySearch); } @Test public void dataBlockIndexType() { final BlockBasedTableConfig blockBasedTableConfig = new BlockBasedTableConfig(); blockBasedTableConfig.setDataBlockIndexType(DataBlockIndexType.kDataBlockBinaryAndHash); - assertThat(blockBasedTableConfig.dataBlockIndexType().equals( - DataBlockIndexType.kDataBlockBinaryAndHash)); + assertThat(blockBasedTableConfig.dataBlockIndexType()) + .isEqualTo(DataBlockIndexType.kDataBlockBinaryAndHash); blockBasedTableConfig.setDataBlockIndexType(DataBlockIndexType.kDataBlockBinarySearch); - assertThat(blockBasedTableConfig.dataBlockIndexType().equals( - DataBlockIndexType.kDataBlockBinarySearch)); + assertThat(blockBasedTableConfig.dataBlockIndexType()) + .isEqualTo(DataBlockIndexType.kDataBlockBinarySearch); } @Test public void checksumType() { final BlockBasedTableConfig blockBasedTableConfig = new BlockBasedTableConfig(); - assertThat(ChecksumType.values().length).isEqualTo(4); + assertThat(ChecksumType.values().length).isEqualTo(5); assertThat(ChecksumType.valueOf("kxxHash")). isEqualTo(ChecksumType.kxxHash); blockBasedTableConfig.setChecksumType(ChecksumType.kNoChecksum); + assertThat(blockBasedTableConfig.checksumType()).isEqualTo(ChecksumType.kNoChecksum); blockBasedTableConfig.setChecksumType(ChecksumType.kxxHash); - assertThat(blockBasedTableConfig.checksumType().equals( - ChecksumType.kxxHash)); + assertThat(blockBasedTableConfig.checksumType()).isEqualTo(ChecksumType.kxxHash); + blockBasedTableConfig.setChecksumType(ChecksumType.kxxHash64); + assertThat(blockBasedTableConfig.checksumType()).isEqualTo(ChecksumType.kxxHash64); + blockBasedTableConfig.setChecksumType(ChecksumType.kXXH3); + assertThat(blockBasedTableConfig.checksumType()).isEqualTo(ChecksumType.kXXH3); } @Test