1
0
Fork 0

Reenabled snappy (#2504)

* fixed snappy config

* added numactl and GLIBCXX_FORCE_NEW

* enabled snappy

* fix snappy include path

* windows paths
This commit is contained in:
Frank Celler 2017-05-26 20:53:23 +02:00 committed by GitHub
parent ef7488b216
commit b7961ef3dd
8 changed files with 32 additions and 131 deletions

View File

@ -22,14 +22,18 @@ else ()
endif ()
# snappy settings
set(USE_SNAPPY_DEFAULT 1 CACHE BOOL "enable snappy")
set(SNAPPY_HOME ${CMAKE_SOURCE_DIR}/3rdParty/snappy/google-snappy-d53de18/)
set(SNAPPY_HOME ${CMAKE_SOURCE_DIR}/3rdParty/snappy/google-snappy-d53de18/ )
set(SNAPPY_INCLUDE ${SNAPPY_HOME} CACHE PATH "include path")
# list(APPEND SNAPPY_INCLUDE ${CMAKE_BINARY_DIR}/3rdParty/snappy/google-snappy-d53de18/)
set(SNAPPY_LIB_DEBUG snappystatic CACHE FILEPATH "debug library")
set(SNAPPY_LIB_RELEASE snappystatic CACHE FILEPATH "release library")
if (WIN32)
set(SNAPPY 1 CACHE BOOL "enable snappy")
set(SNAPPY_INCLUDE ${SNAPPY_HOME};${CMAKE_BINARY_DIR}/3rdParty/snappy/google-snappy-d53de18/)
set(SNAPPY_LIB_DEBUG snappystatic)
set(SNAPPY_LIB_RELEASE snappystatic)
else ()
set(WITH_SNAPPY ON CACHE BOOL "enable snappy")
set(SNAPPY_INCLUDE_DIR ${SNAPPY_HOME};${CMAKE_BINARY_DIR}/3rdParty/snappy/google-snappy-d53de18/)
set(SNAPPY_LIBRARIES ${CMAKE_BINARY_DIR}/3rdParty/snappy/google-snappy-d53de18/libsnappystatic.a)
endif ()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/v5.1.4)

View File

@ -65,10 +65,10 @@ endif ()
#
# Edit these 4 lines to define paths to Snappy
#
set(SNAPPY_HOME $ENV{THIRDPARTY_HOME}/Snappy.Library)
set(SNAPPY_INCLUDE ${SNAPPY_HOME}/inc/inc)
set(SNAPPY_LIB_DEBUG ${SNAPPY_HOME}/bin/debug/amd64/snappy.lib)
set(SNAPPY_LIB_RELEASE ${SNAPPY_HOME}/bin/retail/amd64/snappy.lib)
#set(SNAPPY_HOME $ENV{THIRDPARTY_HOME}/Snappy.Library)
#set(SNAPPY_INCLUDE ${SNAPPY_HOME}/inc/inc)
#set(SNAPPY_LIB_DEBUG ${SNAPPY_HOME}/bin/debug/amd64/snappy.lib)
#set(SNAPPY_LIB_RELEASE ${SNAPPY_HOME}/bin/retail/amd64/snappy.lib)
#
# Don't touch these lines

View File

@ -611,6 +611,8 @@ include_directories(${ROCKSDB_INCLUDE_DIR})
set(ROCKSDB_LIBS rocksdblib;snappystatic)
add_dependencies(rocksdblib snappystatic)
if (USE_JEMALLOC)
add_dependencies(rocksdblib jemalloc)
endif ()

View File

@ -222,13 +222,14 @@ void RocksDBEngine::start() {
static_cast<int>(opts->_maxBackgroundCompactions);
_options.max_background_flushes = static_cast<int>(opts->_maxFlushes);
_options.use_fsync = opts->_useFSync;
/*
// only compress levels >= 2
_options.compression_per_level.resize(_options.num_levels);
for (size_t level = 0; i level < _options.num_levels; ++level) {
_options.compression_per_level[level] = ((level >= 2) ? rocksdb::kLZ4Compression : rocksdb::kNoCompression);
for (int level = 0; level < _options.num_levels; ++level) {
_options.compression_per_level[level] = ((level >= 2) ? rocksdb::kSnappyCompression : rocksdb::kNoCompression);
}
// TODO: try out the effects of these options
// Number of files to trigger level-0 compaction. A value <0 means that
// level-0 compaction will not be triggered by number of files at all.
//
@ -242,29 +243,6 @@ void RocksDBEngine::start() {
// Maximum number of level-0 files. We stop writes at this point.
_options.level0_stop_writes_trigger = 256;
*/
/* TODO: needs compile support for Snappy
// only compress levels >= 2
_options.compression_per_level.resize(_options.num_levels);
for (int level = 0; level < _options.num_levels; ++level) {
_options.compression_per_level[level] = ((level >= 2) ? rocksdb::kSnappyCompression : rocksdb::kNoCompression);
}
*/
/* TODO: try out the effects of these options
// Number of files to trigger level-0 compaction. A value <0 means that
// level-0 compaction will not be triggered by number of files at all.
_options.level0_file_num_compaction_trigger = -1;
// Soft limit on number of level-0 files. We start slowing down writes at this
// point. A value <0 means that no writing slow down will be triggered by
// number of files in level-0.
_options.level0_slowdown_writes_trigger = -1;
// Maximum number of level-0 files. We stop writes at this point.
_options.level0_stop_writes_trigger = 256;
*/
_options.recycle_log_file_num = static_cast<size_t>(opts->_recycleLogFileNum);
_options.compaction_readahead_size =

View File

@ -1,91 +0,0 @@
#
# Licensed 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.
#
# Tries to find Snappy headers and libraries.
#
# Usage of this module as follows:
#
# find_package(Snappy)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# Snappy_HOME - When set, this path is inspected instead of standard library
# locations as the root of the Snappy installation.
# The environment variable SNAPPY_HOME overrides this veriable.
#
# This module defines
# SNAPPY_INCLUDE_DIR, directory containing headers
# SNAPPY_LIBS, directory containing snappy libraries
# SNAPPY_STATIC_LIB, path to libsnappy.a
# SNAPPY_SHARED_LIB, path to libsnappy's shared library
# SNAPPY_FOUND, whether snappy has been found
if( NOT "$ENV{SNAPPY_HOME}" STREQUAL "")
file( TO_CMAKE_PATH "$ENV{SNAPPY_HOME}" _native_path )
list( APPEND _snappy_roots ${_native_path} )
elseif ( Snappy_HOME )
list( APPEND _snappy_roots ${Snappy_HOME} )
endif()
# Try the parameterized roots, if they exist
if ( _snappy_roots )
find_path( SNAPPY_INCLUDE_DIR NAMES snappy.h
PATHS ${_snappy_roots} NO_DEFAULT_PATH
PATH_SUFFIXES "include" )
find_library( SNAPPY_LIBRARIES NAMES snappy
PATHS ${_snappy_roots} NO_DEFAULT_PATH
PATH_SUFFIXES "lib" )
else ()
find_path( SNAPPY_INCLUDE_DIR NAMES snappy.h )
find_library( SNAPPY_LIBRARIES NAMES snappy )
endif ()
if (SNAPPY_INCLUDE_DIR AND SNAPPY_LIBRARIES)
set(SNAPPY_FOUND TRUE)
get_filename_component( SNAPPY_LIBS ${SNAPPY_LIBRARIES} PATH )
set(SNAPPY_LIB_NAME libsnappy)
set(SNAPPY_STATIC_LIB ${SNAPPY_LIBS}/${SNAPPY_LIB_NAME}.a)
set(SNAPPY_SHARED_LIB ${SNAPPY_LIBS}/${SNAPPY_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
else ()
set(SNAPPY_FOUND FALSE)
endif ()
if (SNAPPY_FOUND)
if (NOT Snappy_FIND_QUIETLY)
message(STATUS "Found the Snappy library: ${SNAPPY_LIBRARIES}")
endif ()
else ()
if (NOT Snappy_FIND_QUIETLY)
set(SNAPPY_ERR_MSG "Could not find the Snappy library. Looked in ")
if ( _snappy_roots )
set(SNAPPY_ERR_MSG "${SNAPPY_ERR_MSG} in ${_snappy_roots}.")
else ()
set(SNAPPY_ERR_MSG "${SNAPPY_ERR_MSG} system search paths.")
endif ()
if (Snappy_FIND_REQUIRED)
message(FATAL_ERROR "${SNAPPY_ERR_MSG}")
else (Snappy_FIND_REQUIRED)
message(STATUS "${SNAPPY_ERR_MSG}")
endif (Snappy_FIND_REQUIRED)
endif ()
endif ()
mark_as_advanced(
SNAPPY_INCLUDE_DIR
SNAPPY_LIBS
SNAPPY_LIBRARIES
SNAPPY_STATIC_LIB
SNAPPY_SHARED_LIB
)

1
cmake/Findsnappy.cmake Normal file
View File

@ -0,0 +1 @@
message(STATUS "using SNAPPY include path ${SNAPPY_INCLUDE}")

View File

@ -89,10 +89,10 @@ if (ASM_OPTIMIZATIONS AND CMAKE_TARGET_ARCHITECTURE_CODE MATCHES "x86_64")
endif()
add_definitions("-DENABLE_ASM_CRC32=1")
message(STATUS "-- Will compile in hand-optimized assembler code for CRC32.")
message(STATUS "Will compile in hand-optimized assembler code for CRC32.")
else()
add_definitions("-DENABLE_ASM_CRC32=0")
message(STATUS "-- Will not compile in hand-optimized assembler code for CRC32.")
message(STATUS "Will not compile in hand-optimized assembler code for CRC32.")
endif()
if (USE_LOCAL_CLOCK_GETTIME)

View File

@ -1,5 +1,6 @@
#!/bin/bash
export PID=$$
export GLIBCXX_FORCE_NEW=1
if test -n "$ORIGINAL_PATH"; then
# running in cygwin...
@ -12,6 +13,12 @@ fi;
export PORT=`expr 1024 + $RANDOM`
NUMA=""
if `which numactl > /dev/null`; then
NUMA="numactl --interleave=all"
fi
if [ -z "${ARANGOSH}" ]; then
if [ -x build/bin/arangosh ]; then
ARANGOSH=build/bin/arangosh
@ -26,7 +33,7 @@ if [ -z "${ARANGOSH}" ]; then
fi
#
exec $ARANGOSH \
exec $NUMA $ARANGOSH \
-c etc${PS}relative${PS}arangosh.conf \
--log.level warning \
--server.endpoint tcp://127.0.0.1:${PORT} \