From d76a8eeef79dbe3b8d35c1613becf5c4ec93002c Mon Sep 17 00:00:00 2001 From: Tomas Kolda Date: Fri, 15 Jan 2021 17:51:20 -0800 Subject: [PATCH] Fixing Windows build using CMake (#7854) Summary: Builds were not producing Windows binaries properly in 6.15 branch: ``` 00:00:46.413 Tests run: 11, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.183 sec <<< FAILURE! - in org.rocksdb.EventListenerTest 00:00:46.414 testAllCallbacksInvocation(org.rocksdb.EventListenerTest) Time elapsed: 0.012 sec <<< ERROR! 00:00:46.414 java.lang.UnsatisfiedLinkError: org.rocksdb.test.TestableEventListener.invokeAllCallbacks(J)V 00:00:46.414 at org.rocksdb.test.TestableEventListener.invokeAllCallbacks(Native Method) 00:00:46.414 at org.rocksdb.test.TestableEventListener.invokeAllCallbacks(TestableEventListener.java:19) 00:00:46.414 at org.rocksdb.EventListenerTest.testAllCallbacksInvocation(EventListenerTest.java:436) ``` ``` 00:00:41.497 "D:\j\workspace\RocksDB_Build_Windows\build\java\rocksdbjni_headers.vcxproj" (default target) (3) -> 00:00:41.497 (CustomBuild target) -> 00:00:41.497 CUSTOMBUILD : error : Could not find class file for 'org.rocksdb.TestableEventListener'. [D:\j\workspace\RocksDB_Build_Windows\build\java\rocksdbjni_headers.vcxproj] ``` Also failed on Linux as library was not initialized yet: ``` 00:01:25.103 Running org.rocksdb.NativeComparatorWrapperTest 00:01:25.133 Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.006 sec <<< FAILURE! - in org.rocksdb.NativeComparatorWrapperTest 00:01:25.133 rountrip(org.rocksdb.NativeComparatorWrapperTest) Time elapsed: 0.002 sec <<< ERROR! 00:01:25.133 java.lang.UnsatisfiedLinkError: org.rocksdb.NativeComparatorWrapperTest$NativeStringComparatorWrapper.newStringComparator()J 00:01:25.133 at org.rocksdb.NativeComparatorWrapperTest$NativeStringComparatorWrapper.newStringComparator(Native Method) 00:01:25.133 at org.rocksdb.NativeComparatorWrapperTest$NativeStringComparatorWrapper.initializeNative(NativeComparatorWrapperTest.java:87) 00:01:25.133 at org.rocksdb.RocksCallbackObject.(RocksCallbackObject.java:28) 00:01:25.133 at org.rocksdb.AbstractComparator.(AbstractComparator.java:20) 00:01:25.133 at org.rocksdb.NativeComparatorWrapper.(NativeComparatorWrapper.java:16) 00:01:25.133 at org.rocksdb.NativeComparatorWrapperTest$NativeStringComparatorWrapper.(NativeComparatorWrapperTest.java:82) 00:01:25.133 at org.rocksdb.NativeComparatorWrapperTest.rountrip(NativeComparatorWrapperTest.java:30) ``` Pull Request resolved: https://github.com/facebook/rocksdb/pull/7854 Reviewed By: jay-zhuang Differential Revision: D25873378 Pulled By: ajkr fbshipit-source-id: 88afb08bfd30edff31f17da063e636df0769cbfe --- java/CMakeLists.txt | 5 +++++ .../test/java/org/rocksdb/NativeComparatorWrapperTest.java | 3 +++ utilities/blob_db/blob_db_test.cc | 3 +-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt index 765b5f48d..01b31ea11 100644 --- a/java/CMakeLists.txt +++ b/java/CMakeLists.txt @@ -65,6 +65,7 @@ set(JNI_NATIVE_SOURCES rocksjni/table.cc rocksjni/table_filter.cc rocksjni/table_filter_jnicallback.cc + rocksjni/testable_event_listener.cc rocksjni/thread_status.cc rocksjni/trace_writer.cc rocksjni/trace_writer_jnicallback.cc @@ -283,6 +284,7 @@ set(JAVA_TEST_CLASSES src/test/java/org/rocksdb/WriteBatchTest.java src/test/java/org/rocksdb/util/CapturingWriteBatchHandler.java src/test/java/org/rocksdb/util/WriteBatchGetter.java + src/test/java/org/rocksdb/test/TestableEventListener.java ) include(FindJava) @@ -434,6 +436,8 @@ if(${CMAKE_VERSION} VERSION_LESS "3.11.4" OR (${Java_VERSION_MINOR} STREQUAL "7" org.rocksdb.CompactRangeOptions org.rocksdb.ComparatorOptions org.rocksdb.CompressionOptions + org.rocksdb.ConcurrentTaskLimiterImpl + org.rocksdb.ConfigOptions org.rocksdb.DBOptions org.rocksdb.DirectSlice org.rocksdb.Env @@ -502,6 +506,7 @@ if(${CMAKE_VERSION} VERSION_LESS "3.11.4" OR (${Java_VERSION_MINOR} STREQUAL "7" org.rocksdb.WriteBatchTest org.rocksdb.WriteBatchTestInternalHelper org.rocksdb.WriteBufferManager + org.rocksdb.test.TestableEventListener ) create_javah( diff --git a/java/src/test/java/org/rocksdb/NativeComparatorWrapperTest.java b/java/src/test/java/org/rocksdb/NativeComparatorWrapperTest.java index d1bdf0f88..970e58c0c 100644 --- a/java/src/test/java/org/rocksdb/NativeComparatorWrapperTest.java +++ b/java/src/test/java/org/rocksdb/NativeComparatorWrapperTest.java @@ -15,6 +15,9 @@ import java.util.Comparator; import static org.junit.Assert.assertEquals; public class NativeComparatorWrapperTest { + static { + RocksDB.loadLibrary(); + } @Rule public TemporaryFolder dbFolder = new TemporaryFolder(); diff --git a/utilities/blob_db/blob_db_test.cc b/utilities/blob_db/blob_db_test.cc index d9b097925..cb2d7d8e3 100644 --- a/utilities/blob_db/blob_db_test.cc +++ b/utilities/blob_db/blob_db_test.cc @@ -828,8 +828,7 @@ TEST_F(BlobDBTest, SstFileManagerRestart) { const auto &fs = db_options.env->GetFileSystem(); ASSERT_OK(CreateFile(fs, blob_dir + "/000666.blob.trash", "", false)); ASSERT_OK(CreateFile(fs, blob_dir + "/000888.blob.trash", "", true)); - ASSERT_OK( - CreateFile(fs, blob_dir + "/something_not_match.trash", "", false)); + ASSERT_OK(CreateFile(fs, blob_dir + "/something_not_match.trash", "", false)); // Make sure that reopening the DB rescan the existing trash files Open(bdb_options, db_options);