Skip to content

Commit

Permalink
Fix build (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
mm304321141 committed Dec 7, 2021
1 parent ee41c65 commit a0d18cb
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 17 deletions.
3 changes: 3 additions & 0 deletions db/metrics_reporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
#ifdef WITH_BOOSTLIB
#define REPORT_DEBUG_STACKTRACE 1
#if REPORT_DEBUG_STACKTRACE
#if defined(__APPLE__)
#define _GNU_SOURCE
#endif
#include <boost/stacktrace.hpp>
#endif
#endif
Expand Down
1 change: 1 addition & 0 deletions env/env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "rocksdb/env.h"

#include <array>
#include <thread>

#include "options/db_options.h"
Expand Down
19 changes: 14 additions & 5 deletions third-party/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ cmake_minimum_required(VERSION 3.6)

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")

if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
SET(CPDIR_FLAGS "-r")
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
MESSAGE(FATAL_ERROR "Comming soon ...")
else()
SET(CPDIR_FLAGS "-rT")
endif()


PROJECT(terarkdb-third-party)
#SET(CMAKE_VERBOSE_MAKEFILE ON)

Expand Down Expand Up @@ -121,7 +130,7 @@ IF(WITH_ZSTD)
MESSAGE("[terarkdb/third-party] zstd target not exist, let's build it!")
ExternalProject_Add(zstd-project
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zstd
CONFIGURE_COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/zstd/ .
CONFIGURE_COMMAND cp ${CPDIR_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/zstd/ .
BUILD_IN_SOURCE 0
BUILD_COMMAND $(MAKE) "CXXFLAGS=-fPIC -O2" "CFLAGS=-fPIC -O2"
INSTALL_COMMAND PREFIX=${CMAKE_BINARY_DIR} $(MAKE) install
Expand All @@ -144,7 +153,7 @@ IF(WITH_LZ4)
MESSAGE("[terarkdb/third-party] lz4 target not exist, let's build it!")
ExternalProject_Add(lz4-project
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lz4
CONFIGURE_COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/lz4/ .
CONFIGURE_COMMAND cp ${CPDIR_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/lz4/ .
BUILD_IN_SOURCE 0
BUILD_COMMAND $(MAKE) "CXXFLAGS=-fPIC -O2" "CFLAGS=-fPIC -O2"
INSTALL_COMMAND prefix=${CMAKE_BINARY_DIR} $(MAKE) install)
Expand All @@ -166,7 +175,7 @@ IF(WITH_BZ2)
MESSAGE("[terarkdb/third-party] bzip2 target not exist, let's build it!")
ExternalProject_Add(bzip2-project
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/bzip2
CONFIGURE_COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/bzip2/ .
CONFIGURE_COMMAND cp ${CPDIR_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/bzip2/ .
BUILD_IN_SOURCE 0
BUILD_COMMAND $(MAKE) "CXXFLAGS=-fPIC -O2" "CFLAGS=-fPIC -O2"
INSTALL_COMMAND $(MAKE) install PREFIX=${CMAKE_BINARY_DIR})
Expand All @@ -179,7 +188,7 @@ IF(WITH_BZ2)
)
ENDIF()
ENDIF()

# Jemalloc
IF(WITH_JEMALLOC)
if(TARGET jemalloc)
Expand All @@ -188,7 +197,7 @@ IF(WITH_JEMALLOC)
MESSAGE("[terarkdb/third-party] jemalloc target not exist, let's build it!")
ExternalProject_Add(jemalloc-project
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/jemalloc
CONFIGURE_COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/jemalloc/ . && bash autogen.sh && "CFLAGS=-fPIC" "CXXFLAGS=-fPIC" "LDFLAGS=-fPIC" ./configure --prefix=${CMAKE_BINARY_DIR} --enable-prof
CONFIGURE_COMMAND cp ${CPDIR_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/jemalloc/ . && bash autogen.sh && "CFLAGS=-fPIC" "CXXFLAGS=-fPIC" "LDFLAGS=-fPIC" ./configure --prefix=${CMAKE_BINARY_DIR} --enable-prof
BUILD_IN_SOURCE 0
BUILD_COMMAND $(MAKE)
INSTALL_COMMAND $(MAKE) install PREFIX=${CMAKE_BINARY_DIR}
Expand Down
18 changes: 10 additions & 8 deletions util/sst_file_manager_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ bool SstFileManagerImpl::EnoughRoomForCompaction(
needed_headroom -= in_progress_files_size_;
if (free_space < needed_headroom + size_added_by_compaction) {
// We hit the condition of not enough disk space
ROCKS_LOG_ERROR(
logger_,
"free space [%ld bytes] is less than needed headroom [%ld bytes]\n",
free_space, needed_headroom);
ROCKS_LOG_ERROR(logger_,
"free space [%" PRIu64
" bytes] is less than needed headroom [%zd bytes]\n",
free_space, needed_headroom);
return false;
}
}
Expand Down Expand Up @@ -274,17 +274,19 @@ void SstFileManagerImpl::ClearError() {
if (bg_err_.severity() == Status::Severity::kHardError) {
if (free_space < reserved_disk_buffer_) {
ROCKS_LOG_ERROR(logger_,
"free space [%ld bytes] is less than required disk "
"buffer [%ld bytes]\n",
"free space [%" PRIu64
" bytes] is less than required disk "
"buffer [%" PRIu64 " bytes]\n",
free_space, reserved_disk_buffer_);
ROCKS_LOG_ERROR(logger_, "Cannot clear hard error\n");
s = Status::NoSpace();
}
} else if (bg_err_.severity() == Status::Severity::kSoftError) {
if (free_space < free_space_trigger_) {
ROCKS_LOG_WARN(logger_,
"free space [%ld bytes] is less than free space for "
"compaction trigger [%ld bytes]\n",
"free space [%" PRIu64
" bytes] is less than free space for "
"compaction trigger [%" PRIu64 " bytes]\n",
free_space, free_space_trigger_);
ROCKS_LOG_WARN(logger_, "Cannot clear soft error\n");
s = Status::NoSpace();
Expand Down
9 changes: 6 additions & 3 deletions utilities/flink/flink_compaction_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

#include "utilities/flink/flink_compaction_filter.h"

#include <inttypes.h>

#include <algorithm>
#include <iostream>

Expand All @@ -30,8 +32,9 @@ CompactionFilter::Decision Decide(const char* ts_bytes, const int64_t ttl,
const int64_t ttlWithoutOverflow =
timestamp > 0 ? std::min(JAVA_MAX_LONG - timestamp, ttl) : ttl;
Debug(logger.get(),
"Last access timestamp: %ld ms, ttlWithoutOverflow: %ld ms, Current "
"timestamp: %ld ms",
"Last access timestamp: %" PRIi64 " ms, ttlWithoutOverflow: %" PRIi64
" ms, Current "
"timestamp: %" PRIi64 " ms",
timestamp, ttlWithoutOverflow, current_timestamp);
return timestamp + ttlWithoutOverflow <= current_timestamp
? CompactionFilter::Decision::kRemove
Expand Down Expand Up @@ -130,7 +133,7 @@ CompactionFilter::Decision FlinkCompactionFilter::FilterV2(
Debug(logger_.get(),
"Call FlinkCompactionFilter::FilterV2 - Key: %s, Data: %s, Value type: "
"%d, "
"State type: %d, TTL: %ld ms, timestamp_offset: %ld",
"State type: %d, TTL: %" PRIi64 " ms, timestamp_offset: %zd",
key.ToString().c_str(), existing_value.ToString(true).c_str(),
value_type, config_cached_->state_type_, config_cached_->ttl_,
config_cached_->timestamp_offset_);
Expand Down

0 comments on commit a0d18cb

Please sign in to comment.