From b9873162f07ef6cb60573f356d520a85c4fdc6a4 Mon Sep 17 00:00:00 2001 From: topilski Date: Thu, 18 Jan 2018 14:45:48 -0800 Subject: [PATCH] Fixed get version on windows, moved throwing exceptions into cc file. Summary: Fixes for msys2 and mingw, hide exceptions into cpp file. Closes https://github.com/facebook/rocksdb/pull/3377 Differential Revision: D6746707 Pulled By: yiwu-arbug fbshipit-source-id: 456b38df80bc48b8386a2cf87f669b5a4f9999a4 --- CMakeLists.txt | 27 +++++++++++++-------------- db/memtable.cc | 8 ++++++++ include/rocksdb/memtablerep.h | 8 +------- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c4416025f2..a68b16056e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,20 +129,19 @@ endif() string(REGEX REPLACE "[^0-9a-f]+" "" GIT_SHA "${GIT_SHA}") -if(NOT WIN32) - execute_process(COMMAND - "./build_tools/version.sh" "full" - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - OUTPUT_VARIABLE ROCKSDB_VERSION - ) - string(STRIP "${ROCKSDB_VERSION}" ROCKSDB_VERSION) - execute_process(COMMAND - "./build_tools/version.sh" "major" - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - OUTPUT_VARIABLE ROCKSDB_VERSION_MAJOR - ) - string(STRIP "${ROCKSDB_VERSION_MAJOR}" ROCKSDB_VERSION_MAJOR) -endif() +set(SH_CMD "sh") +execute_process(COMMAND + ${SH_CMD} -c "build_tools/version.sh full" + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + OUTPUT_VARIABLE ROCKSDB_VERSION +) +string(STRIP "${ROCKSDB_VERSION}" ROCKSDB_VERSION) +execute_process(COMMAND + ${SH_CMD} -c "build_tools/version.sh major" + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + OUTPUT_VARIABLE ROCKSDB_VERSION_MAJOR +) +string(STRIP "${ROCKSDB_VERSION_MAJOR}" ROCKSDB_VERSION_MAJOR) option(WITH_MD_LIBRARY "build with MD" ON) if(WIN32 AND MSVC) diff --git a/db/memtable.cc b/db/memtable.cc index af3ae8f836..66bf55920a 100644 --- a/db/memtable.cc +++ b/db/memtable.cc @@ -236,6 +236,14 @@ int MemTable::KeyComparator::operator()(const char* prefix_len_key, return comparator.Compare(a, key); } +void MemTableRep::InsertConcurrently(KeyHandle handle) { +#ifndef ROCKSDB_LITE + throw std::runtime_error("concurrent insert not supported"); +#else + abort(); +#endif + } + Slice MemTableRep::UserKey(const char* key) const { Slice slice = GetLengthPrefixedSlice(key); return Slice(slice.data(), slice.size() - 8); diff --git a/include/rocksdb/memtablerep.h b/include/rocksdb/memtablerep.h index 347dd3096c..1385a83cb6 100644 --- a/include/rocksdb/memtablerep.h +++ b/include/rocksdb/memtablerep.h @@ -96,13 +96,7 @@ class MemTableRep { // Like Insert(handle), but may be called concurrent with other calls // to InsertConcurrently for other handles - virtual void InsertConcurrently(KeyHandle handle) { -#ifndef ROCKSDB_LITE - throw std::runtime_error("concurrent insert not supported"); -#else - abort(); -#endif - } + virtual void InsertConcurrently(KeyHandle handle); // Returns true iff an entry that compares equal to key is in the collection. virtual bool Contains(const char* key) const = 0;