-
Notifications
You must be signed in to change notification settings - Fork 615
HDDS-14225. Upgrade RocksDB from 7.7.3 to 10.10.1 #9813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
f822b30
HDDS-14225. Upgrade RocksDB from 7.7.3 to 10.4.2
smengcl d7e5170
findbugs
smengcl e42ca37
Patch rocks-native.patch
smengcl 6c960eb
Address comment https://github.com/apache/ozone/pull/9813#pullrequest…
smengcl 471e6dc
Merge branch 'master' into rocksdb-v10-upgrade
smengcl 7260d5b
Fix RocksDB JNI 10.4.2 runtime classpath
smengcl 24dd415
Fix snapshot existence checks after RocksDB 9.10.0 keyMayExist behavi…
smengcl 7b49c19
Handle RocksDB keyMayExist buffer semantics and db restore
smengcl 21bc915
Switch to self-built rocksdbjni 10.10.1 snapshot fat jar
smengcl 7270ac0
Adjust RDBTableStore metrics tests for keyMayExist fallback
smengcl 84da109
Implement getSkipCache in InMemoryTestTable
smengcl f67327d
Fix replicas-test.sh
smengcl 8ab8f58
Fix replicas-test.sh attempt 2
smengcl b3715f0
Fix replicas-test.sh attempt 3
smengcl 602e0db
Fix replicas-test.sh attempt 4
smengcl 9ef409e
Fix replicas-test.sh attempt 5
smengcl d416db1
Fix replicas-test.sh attempt 6
smengcl 1044f33
Handle already-stopped datanodes in replicas-test.sh
smengcl 4c971a3
Use upstream rocksdbjni 10.5.1 for testing
smengcl ab967ec
Revert "Use upstream rocksdbjni 10.5.1 for testing"
smengcl 763440d
Restore replicas-test.sh state offline
smengcl ed1d278
Use official rocksdbjni 10.10.1 release
smengcl 7f3abff
Sort pom
smengcl 9b6f43f
Remove unneeded pom changes
smengcl e2f4ca9
Restore pom line
smengcl 0f389c7
Merge remote-tracking branch 'asf' into rocksdb-v10-upgrade
smengcl 626b417
Fix replicas-test
smengcl 7b47f38
Use 10.10.1.1, which presumably has some packaging side fixes
smengcl 94a075a
Simplify RocksDB key existence checks
smengcl ddccd9d
Fix RocksDB tools source version parsing
smengcl 32c18f6
Fix raw_sst_file_reader patch hunk length
smengcl 946f4ac
Merge branch 'master' into rocksdb-v10-upgrade
smengcl b22b4f3
Add inline comments
smengcl 8486ae7
RDBSstFileWriter should also use pinned format version
smengcl 56a211c
Remove redundant key.duplicate()
smengcl 5405ebd
TestRocksDBCheckpointDiffer: Strengthen diffAllSnapshots assertions
smengcl 6ce7736
HDDS-14225. Harden RDBTable and SST diff tests
smengcl 560e69e
HDDS-14225. Route ManagedDBOptions.setLogger through the LoggerInterf…
smengcl a781513
HDDS-14225. Add independent oracle to diffAllSnapshots
smengcl 0758ccf
HDDS-14225. Correct stale deleteFile level-guard comment
smengcl 2e9bca7
HDDS-14225. Clarify ManagedBloomFilter equals/hashCode delegate comment
smengcl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/utils/db/TestRDBTable.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.hadoop.hdds.utils.db; | ||
|
|
||
| import static java.nio.charset.StandardCharsets.UTF_8; | ||
| import static org.junit.jupiter.api.Assertions.assertArrayEquals; | ||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| import static org.mockito.ArgumentMatchers.any; | ||
| import static org.mockito.ArgumentMatchers.eq; | ||
| import static org.mockito.Mockito.mock; | ||
| import static org.mockito.Mockito.never; | ||
| import static org.mockito.Mockito.verify; | ||
| import static org.mockito.Mockito.when; | ||
|
|
||
| import java.nio.ByteBuffer; | ||
| import java.util.function.Supplier; | ||
| import org.apache.hadoop.hdds.utils.db.RocksDatabase.ColumnFamily; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| /** | ||
| * Unit tests for {@link RDBTable}. | ||
| */ | ||
| public class TestRDBTable { | ||
|
|
||
| @Test | ||
| public void testGetIfExistByteBufferFallbackUsesFreshKeyBuffer() | ||
| throws Exception { | ||
| RocksDatabase db = mock(RocksDatabase.class); | ||
| ColumnFamily columnFamily = mock(ColumnFamily.class); | ||
| RDBMetrics metrics = mock(RDBMetrics.class); | ||
| RDBTable table = new RDBTable(db, columnFamily, metrics); | ||
|
|
||
| byte[] keyBytes = "key-1".getBytes(UTF_8); | ||
| ByteBuffer key = ByteBuffer.wrap(keyBytes); | ||
| ByteBuffer outValue = ByteBuffer.allocate(64); | ||
|
|
||
| // RocksDatabase.keyMayExist duplicates the key internally, so it leaves the | ||
| // caller's key buffer untouched. Return an inconclusive result (value-less | ||
| // "may exist") to force the fallback point-get. | ||
| when(db.keyMayExist(eq(columnFamily), any(ByteBuffer.class), | ||
| any(ByteBuffer.class))).thenReturn((Supplier<Integer>) () -> null); | ||
|
|
||
| // get() advances the key buffer position as native RocksDB does. It must | ||
| // still see the full key, i.e. RDBTable must hand it a fresh duplicate. | ||
| when(db.get(eq(columnFamily), any(ByteBuffer.class), any(ByteBuffer.class))) | ||
| .thenAnswer(invocation -> { | ||
| ByteBuffer keyBuffer = invocation.getArgument(1); | ||
| if (keyBuffer.remaining() != keyBytes.length) { | ||
| return null; | ||
| } | ||
| keyBuffer.position(keyBuffer.limit()); | ||
| return 0; | ||
| }); | ||
|
|
||
| Integer result = table.getIfExist(key, outValue); | ||
| assertEquals(0, result); | ||
| assertEquals(0, key.position(), "caller key buffer position must be unchanged"); | ||
| } | ||
|
|
||
| @Test | ||
| public void testGetIfExistByteBufferFastPathReturnsValue() | ||
| throws Exception { | ||
| RocksDatabase db = mock(RocksDatabase.class); | ||
| ColumnFamily columnFamily = mock(ColumnFamily.class); | ||
| RDBMetrics metrics = mock(RDBMetrics.class); | ||
| RDBTable table = new RDBTable(db, columnFamily, metrics); | ||
|
|
||
| byte[] keyBytes = "key-1".getBytes(UTF_8); | ||
| byte[] valueBytes = "value-1".getBytes(UTF_8); | ||
| ByteBuffer key = ByteBuffer.wrap(keyBytes); | ||
| ByteBuffer outValue = ByteBuffer.allocate(64); | ||
|
|
||
| // Simulate the RocksDB "exists with value" fast path: native code writes | ||
| // the value into the buffer handed to keyMayExist and reports its length. | ||
| // getIfExist passes outValue.duplicate(), so the write must land in the | ||
| // caller's outValue via the shared backing memory. | ||
| when(db.keyMayExist(eq(columnFamily), any(ByteBuffer.class), | ||
| any(ByteBuffer.class))).thenAnswer(invocation -> { | ||
| ByteBuffer valueBuffer = invocation.getArgument(2); | ||
| valueBuffer.put(valueBytes); | ||
| return (Supplier<Integer>) () -> valueBytes.length; | ||
| }); | ||
|
|
||
| Integer result = table.getIfExist(key, outValue); | ||
| assertEquals(valueBytes.length, result); | ||
| // The fast path must not fall back to a point-get. | ||
| verify(db, never()).get(eq(columnFamily), any(ByteBuffer.class), any(ByteBuffer.class)); | ||
| // Value bytes written through the duplicate are visible in the caller's buffer. | ||
| byte[] readBack = new byte[valueBytes.length]; | ||
| outValue.duplicate().get(readBack); | ||
| assertArrayEquals(valueBytes, readBack); | ||
| } | ||
| } | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.