Commit 6f51e991 authored by none's avatar none
Browse files

use new static libslave

parent a5943376
CMAKE_MINIMUM_REQUIRED (VERSION 2.8)
PROJECT (replicator)
cmake_minimum_required(VERSION 2.8)
project(replicator)
set(CMAKE_VERBOSE_MAKEFILE on)
set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true)
set(REPLICATOR_NAME "replicatord")
set(COPTS_FLAGS "-pipe -O2 -fomit-frame-pointer -ffunction-sections -fdata-sections")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COPTS_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COPTS_FLAGS}")
set(REPLICATOR_ROOT "${CMAKE_SOURCE_DIR}")
set(REPLICATOR_CFLAGS "-DTB_LOCAL=${REPLICATOR_ROOT}/lib/tarantool-c/lib -std=c++0x -g")
set(REPLICATOR_SRC
${REPLICATOR_ROOT}/dbreader.cpp
${REPLICATOR_ROOT}/main.cpp
${REPLICATOR_ROOT}/tpwriter.cpp
"${REPLICATOR_ROOT}/dbreader.cpp"
"${REPLICATOR_ROOT}/main.cpp"
"${REPLICATOR_ROOT}/tpwriter.cpp"
)
add_subdirectory(lib/tarantool-c)
set(YAML_CPP_BUILD_TOOLS OFF CACHE BOOL "" FORCE)
set(YAML_CPP_BUILD_CONTRIB OFF CACHE BOOL "" FORCE)
set(TARANTOOL_C_EMBEDDED ON)
add_subdirectory(lib/libslave)
add_subdirectory(lib/yaml-cpp)
add_subdirectory(lib/tarantool-c)
include(FindPackageHandleStandardArgs)
find_path(IMYSQL mysql/mysql.h)
find_package_handle_standard_args(Mysql DEFAULT_MSG IMYSQL)
include_directories(
"${REPLICATOR_ROOT}"
BEFORE SYSTEM
"${REPLICATOR_ROOT}/lib/libslave/include"
"${REPLICATOR_ROOT}/lib/libslave/include/boost_1_59_0/boost"
)
include_directories(
${REPLICATOR_ROOT}
"${REPLICATOR_ROOT}/lib/libslave"
"${REPLICATOR_ROOT}/lib/yaml-cpp/include"
"${REPLICATOR_ROOT}/lib/tarantool-c/include"
"${REPLICATOR_ROOT}/lib/tarantool-c/third_party/msgpuck"
"${IMYSQL}/mysql"
)
find_library(LMYSQL_CLIENT_R perconaserverclient_r PATH_SUFFIXES mysql)
find_library(LPTHREAD pthread)
find_library(LBOOST_SYSTEM_MT boost_system)
find_library(LBOOST_SERIALIZATION_MT boost_serialization)
add_executable(rp ${REPLICATOR_SRC})
set_target_properties(rp PROPERTIES COMPILE_FLAGS "${REPLICATOR_CFLAGS}")
set_target_properties(rp PROPERTIES OUTPUT_NAME ${REPLICATOR_NAME})
target_link_libraries(rp tnt slave_a yaml-cpp)
target_link_libraries(rp ${LMYSQL_CLIENT_R} ${LPTHREAD} ${LBOOST_SYSTEM_MT} ${LBOOST_SERIALIZATION_MT} rt dl ssl crypto z)
set_target_properties(rp PROPERTIES COMPILE_FLAGS "-std=c++11" LINK_FLAGS "-Wl,-s -Wl,--gc-sections" OUTPUT_NAME replicatord)
target_link_libraries(rp rt dl tnt slave_a yaml-cpp ${LPTHREAD})
install(TARGETS rp RUNTIME DESTINATION sbin)
install(FILES replicatord.cfg DESTINATION etc)
install(FILES replicatord.yml DESTINATION etc)
git submodule update --init --recursive
git submodule update --init --recursive
cmake -DCMAKE_BUILD_TYPE=Release -DYAML_CPP_BUILD_TOOLS=OFF -DYAML_CPP_BUILD_CONTRIB=OFF -DTARANTOOL_C_EMBEDDED=1 .
make
#strip -s replicatord
cmake -DCMAKE_BUILD_TYPE=Release .
cmake --build .
......@@ -7,8 +7,6 @@
#include <functional>
#include <Slave.h>
#undef max
#undef min
#include <DefaultExtState.h>
#include <nanomysql.h>
......
libslave @ e06b9f4d
Subproject commit 66daede4bf53efd9feed9e2a70b14c2c18e218e4
Subproject commit e06b9f4d0ca141c28ac7df371e055f0d8749994e
......@@ -77,10 +77,7 @@ static void tpwriter_worker()
static bool dbread_callback(SerializableBinlogEventPtr&& ev)
{
if (is_term || reset) {
return true;
}
if (is_term || reset) return true;
queue.push(std::forward<SerializableBinlogEventPtr>(ev));
return false;
}
......
......@@ -47,10 +47,7 @@ template<typename T> class Queue
{
std::unique_lock<std::mutex> lock(mutex);
if (!queue.empty())
return queue.size();
if (cv1.wait_for(lock, timeout, [this] { return !queue.empty(); }))
if (!queue.empty() || cv1.wait_for(lock, timeout, [this] { return !queue.empty(); }))
return queue.size();
return 0;
......
......@@ -178,7 +178,7 @@ void TPWriter::BinlogEventCallback(SerializableBinlogEventPtr&& ev)
// sync first
RecvAll();
} else {
prev_key = curnt_key;
prev_key = std::move(curnt_key);
}
const std::map<unsigned, SerializableValue>* replace_null_;
......
......@@ -124,10 +124,10 @@ class TPWriter
{
TableSpace(
const uint32_t space_,
const std::vector<unsigned> keys_,
const std::string insert_call_,
const std::string update_call_,
const std::string delete_call_
const std::vector<unsigned>& keys_,
const std::string& insert_call_,
const std::string& update_call_,
const std::string& delete_call_
) :
space(space_), keys(keys_),
insert_call(insert_call_), update_call(update_call_), delete_call(delete_call_)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment