Fix build on OpenBSD i386 (#12142)

Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/12142

Reviewed By: pdillinger

Differential Revision: D53150218

Pulled By: ajkr

fbshipit-source-id: a4c4d9d22d99e8a82d93d1a7ef37ec5326855cb5
This commit is contained in:
Radek Hubner 2024-01-29 16:19:59 -08:00 committed by Facebook GitHub Bot
parent 17042a3fb7
commit 1d8c54aeaa
7 changed files with 27 additions and 8 deletions

View File

@ -169,21 +169,26 @@ most processors made since roughly 2013.
* Install the dependencies for RocksDB:
pkg_add gmake gflags snappy bzip2 lz4 zstd git jdk bash findutils gnuwatch
`pkg_add gmake gflags snappy bzip2 lz4 zstd git bash findutils gnuwatch`
* Build RocksDB from source:
```bash
cd ~
git clone https://github.com/facebook/rocksdb.git
cd rocksdb
gmake static_lib
```
* Build RocksJava from source (optional):
* In OpenBSD, JDK depends on XWindows system, so please check that you installed OpenBSD with `xbase` package.
* Install dependencies : `pkg_add -v jdk%1.8`
```bash
cd rocksdb
export JAVA_HOME=/usr/local/jdk-1.8.0
export PATH=$PATH:/usr/local/jdk-1.8.0/bin
gmake rocksdbjava
gmake rocksdbjava SHA256_CMD='sha256 -q'
```
* **iOS**:
* Run: `TARGET_OS=IOS make static_lib`. When building the project which uses rocksdb iOS library, make sure to define an important pre-processing macros: `IOS_CROSS_COMPILE`.

View File

@ -618,7 +618,7 @@ fi
# TODO(tec): Fix -Wshorten-64-to-32 errors on FreeBSD and enable the warning.
# -Wshorten-64-to-32 breaks compilation on FreeBSD aarch64 and i386
if ! { [ "$TARGET_OS" = FreeBSD ] && [ "$TARGET_ARCHITECTURE" = arm64 -o "$TARGET_ARCHITECTURE" = i386 ]; }; then
if ! { [ "$TARGET_OS" = FreeBSD -o "$TARGET_OS" = OpenBSD ] && [ "$TARGET_ARCHITECTURE" = arm64 -o "$TARGET_ARCHITECTURE" = i386 ]; }; then
# Test whether -Wshorten-64-to-32 is available
$CXX $PLATFORM_CXXFLAGS -x c++ - -o test.o -Wshorten-64-to-32 2>/dev/null <<EOF
int main() {}

View File

@ -201,7 +201,7 @@ void Java_org_rocksdb_test_TestableEventListener_invokeAllCallbacks(
FileOperationInfo(FileOperationType::kRead, file_path, start_timestamp,
finish_timestamp, status);
op_info.offset = UINT64_MAX;
op_info.length = SIZE_MAX;
op_info.length = 4096;
el->OnFileReadFinish(op_info);
el->OnFileWriteFinish(op_info);

View File

@ -13,12 +13,14 @@ import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import org.assertj.core.api.AbstractObjectAssert;
import org.assertj.core.api.ObjectAssert;
import org.junit.Assume;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.rocksdb.AbstractEventListener.EnabledEventCallback;
import org.rocksdb.test.TestableEventListener;
import org.rocksdb.util.Environment;
public class EventListenerTest {
@ClassRule
@ -264,7 +266,7 @@ public class EventListenerTest {
final MemTableInfo memTableInfoTestData = new MemTableInfo(
"columnFamilyName", TEST_LONG_VAL, TEST_LONG_VAL, TEST_LONG_VAL, TEST_LONG_VAL);
final FileOperationInfo fileOperationInfoTestData = new FileOperationInfo("/file/path",
TEST_LONG_VAL, TEST_LONG_VAL, 1_600_699_420_000_000_000L, 5_000_000_000L, statusTestData);
TEST_LONG_VAL, 4096, 1_600_699_420_000_000_000L, 5_000_000_000L, statusTestData);
final WriteStallInfo writeStallInfoTestData =
new WriteStallInfo("columnFamilyName", (byte) 0x0, (byte) 0x1);
final ExternalFileIngestionInfo externalFileIngestionInfoTestData =

View File

@ -7,11 +7,14 @@ package org.rocksdb;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.*;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.rocksdb.util.Environment;
@RunWith(Parameterized.class)
public class MultiGetManyKeysTest {
@ -28,6 +31,12 @@ public class MultiGetManyKeysTest {
this.numKeys = numKeys;
}
@BeforeClass
public static void beforeAllTest() {
Assume.assumeFalse("We are not running this test on 32bit systems dues to memory constraints",
!Environment.is64Bit());
}
/**
* Test for <a link="https://github.com/facebook/rocksdb/issues/8039">multiGet problem</a>
*/

View File

@ -17,6 +17,7 @@ import java.util.Arrays;
import java.util.List;
import org.junit.*;
import org.junit.rules.TemporaryFolder;
import org.rocksdb.util.Environment;
public class PerfContextTest {
@ClassRule
@ -80,6 +81,8 @@ public class PerfContextTest {
@Test
public void testGetBlockReadCpuTime() throws RocksDBException {
Assume.assumeFalse("We are not running this test on OpenBSD or Windows",
Environment.isOpenBSD() || Environment.isWindows());
db.setPerfLevel(PerfLevel.ENABLE_TIME_AND_CPU_TIME_EXCEPT_FOR_MUTEX);
db.put("key".getBytes(), "value".getBytes());
db.compactRange();

View File

@ -688,7 +688,7 @@ Status WriteCommittedTxn::CommitWithoutPrepareInternal() {
const Comparator* ucmp =
WriteBatchWithIndexInternal::GetUserComparator(*wbwi, cf);
return ucmp ? ucmp->timestamp_size()
: std::numeric_limits<uint64_t>::max();
: std::numeric_limits<size_t>::max();
});
if (!s.ok()) {
return s;
@ -763,7 +763,7 @@ Status WriteCommittedTxn::CommitInternal() {
const Comparator* ucmp =
WriteBatchWithIndexInternal::GetUserComparator(*wbwi, cf);
return ucmp ? ucmp->timestamp_size()
: std::numeric_limits<uint64_t>::max();
: std::numeric_limits<size_t>::max();
});
}
}