8000 Feature/new server infra by maierlars · Pull Request #7733 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Feature/new server infra #7733

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 42 commits into from
Jan 8, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
6f3593b
Decoupled IO handling from Scheduler.
Jul 23, 2018
1bd0db0
Fixed SSL start up bug.
Jul 24, 2018
0a3fe50
Replaced Scheduler with new worker farm implementation.
Jul 25, 2018
0400054
Added minimal statistics and info string for Scheduler.
Jul 25, 2018
bc0f94c
Added support for timed submissions.
Jul 27, 2018
fdd2033
Updated delayed submission api. Updated code that used timers.
Jul 31, 2018
3cb9b62
Extracted new Scheduler into a virtual parent class. The implementati…
Aug 1, 2018
bdc8d9b
Signal handler now working.
Aug 1, 2018
3796c3b
Changed threads names, `_stop` is atomic, check for failure during th…
Aug 2, 2018
5e6a3f2
Commented on source code and added TODOs.
Aug 3, 2018
e9ccd72
Merge branch 'devel' into feature/new-server-infra
Aug 3, 2018
0e99af6
Played around with start-stop-conditions
Aug 8, 2018
6fd7f26
Play around with start stop condition.
Aug 8, 2018
e65585c
start stop cond
Aug 8, 2018
c6ac00f
Sart Stop Conditions
Aug 8, 2018
a5516b2
Removed bad cv_status check.
Aug 9, 2018
3e12cb0
Merge remote-tracking branch 'origin/devel' into feature/new-server-i…
Aug 10, 2018
aa6672c
Merge remote-tracking branch 'origin/devel' into feature/new-server-i…
Aug 10, 2018
43fb2d9
Bug fix: now compare the actual objects instead of pointer values. Se…
Aug 10, 2018
c6a54c1
Moved most of the stuff now unrelated to the Scheduler to GeneralServ…
Aug 13, 2018
556f3e9
Instead of waiting for a thread to terminate, put it on a clean up li…
Aug 15, 2018
0ed5f82
Allow detaching long running threads.
Aug 15, 2018
20132a0
Merge remote-tracking branch 'origin/devel' into feature/new-server-i…
Dec 11, 2018
e2fc7e1
Fixed test mock.
Dec 12, 2018
ebcd63a
Merge remote-tracking branch 'origin/devel' into feature/new-server-i…
Dec 17, 2018
d186d14
Updated the WorkHandle logic. Removed post functions.
Dec 18, 2018
80c9f6a
Fixed crash when obtaining shared_ptr from this in destructor.
Dec 18, 2018
fdff089
Merge remote-tracking branch 'origin/devel' into feature/new-server-i…
Dec 18, 2018
a61a809
Added lost mutex.
Dec 18, 2018
8d4c003
Fixed memory leak.
Dec 18, 2018
3ff4806
Fixed merge bug.
Dec 18, 2018
e2fa338
Changed a lot of code to optimize the scheduler.
Dec 19, 2018
090e2cd
Merge remote-tracking branch 'origin/devel' into feature/new-server-i…
Dec 19, 2018
b37d5fd
Fixed bug of invalidated iterator. Dont remove task on shutdown at di…
Dec 19, 2018
2ccf743
Only by value calls to queue.
Dec 20, 2018
947fe2f
Added options again.
Dec 20, 2018
992e44c
Clean up of code.
Dec 20, 2018
b6bbc8c
UI Request Lane added.
Dec 20, 2018
1e8d3bd
Bug fixes in Scheduler.
Dec 21, 2018
4d6b0a0
Merge remote-tracking branch 'origin/devel' into feature/new-server-i…
Jan 7, 2019
83a775e
Applied reformat.
Jan 7, 2019
55e70a3
Use sigaction.
Jan 7, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'origin/devel' into feature/new-server-i…
…nfra
  • Loading branch information
lamai93 committed Dec 11, 2018
commit 20132a0fc6f8c7b2cd9cb6d680aea36da2081625
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ BasedOnStyle: Google
DerivePointerAlignment: false
PointerAlignment: Left
Standard: Cpp11
SortUsingDeclarations: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@ build
Thumbs.db

enterprise
upgrade-data-tests
compile_commands.json
instanceinfo.json
testresult.json
testsStarted
soc-pokec-*

Documentation/man

build.sh
/build*/
Build64/
Expand Down
8 changes: 0 additions & 8 deletions 3rdParty/.gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
*.ao
*.d
*.pc

libev/.libs/
libev/config.h
libev/ev.lo
libev/event.lo
libev/libev.la
libev/libtool
libev/stamp-h1
41 changes: 12 additions & 29 deletions 3rdParty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,13 @@ if (USE_IRESEARCH)
set(LZ4_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/lz4")
set(SNOWBALL_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/snowball")
set(UNWIND_ROOT "invalid")
set(BFD_ROOT "invalid")

set(IRESEARCH_PREGENERATED_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/iresearch.build/")
set(GENERATED_PARSER_SOURCES "${IRESEARCH_PREGENERATED_ROOT}/core/iql/parser.cc" CACHE PATH "use pregenerated source")
include_directories("${IRESEARCH_PREGENERATED_ROOT}/core/")
include_directories("${IRESEARCH_PREGENERATED_ROOT}/external/snowball/libstemmer/")

if(MSVC)
set(USE_IQL OFF CACHE BOOL "Use IQL" FORCE) # skip IQL on MSVC until IResearch upstream is updated
endif()
Expand All @@ -179,24 +185,6 @@ if (USE_IRESEARCH)
"${IRESEARCH_ROOT}/cmake" # to find iResearch dependencies
)

# cmake will seemingly randomly delete files from ${IRESEARCH_BUILD_DIR} during configuration
# so must copy required files only after the cmake configuration phase is complete, not via file(COPY ...)
# this command must _always_ be executed because the subsequent cmake configuration runs will once again delete files
if(MSVC)
add_custom_command(OUTPUT "${IRESEARCH_BUILD_DIR}/copy_iresearch.build" # non-existent file
COMMAND ${CMAKE_COMMAND} -E copy_directory "${IRESEARCH_ROOT}.build/" "${IRESEARCH_BUILD_DIR}/"
)
else()
# 'cmake -E copy_directory' does not preserve timestamps, use 'cp' directly where avalable
add_custom_command(OUTPUT "${IRESEARCH_BUILD_DIR}/copy_iresearch.build" # non-existent file
COMMAND cp -rp "${IRESEARCH_ROOT}.build/*" "${IRESEARCH_BUILD_DIR}/" # MacOS requires '/*' suffix
)
endif()

add_custom_target("copy_iresearch.build" ALL
DEPENDS "${IRESEARCH_BUILD_DIR}/copy_iresearch.build"
)

add_subdirectory("${IRESEARCH_ROOT}" "${IRESEARCH_BUILD_DIR}" EXCLUDE_FROM_ALL) # do not build unused targets
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH_ORIGINAL}) # restore CMAKE_MODULE_PATH
unset(BUILD_SHARED_LIBS) # otherwise ZLib (below) does not build on win32
Expand All @@ -207,13 +195,6 @@ if (USE_IRESEARCH)
# cmake does not build ICU without this (cmake does not inherit dependencies)
add_dependencies(v8_build icu-build icudata-static icui18n-static icuuc-static)
endif()

# ensure the 'copy_iresearch.build' target is executed before start of build of the 'iresearch' target
if(MSVC)
add_dependencies(iresearch-static-scrt "copy_iresearch.build") # use static + staticCRT to match ArangoDB
else()
add_dependencies(iresearch-static "copy_iresearch.build") # use static to match ArangoDB
endif()
endif()


Expand Down Expand Up @@ -245,9 +226,11 @@ set(CURL_CONFIG_HAS_BEEN_RUN_BEFORE true PARENT_SCOPE)
## SNAPPY
################################################################################

set(SNAPPY_VERSION "d53de18")
set(SNAPPY_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/snappy/google-snappy-${SNAPPY_VERSION}")
set(SNAPPY_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/snappy/google-snappy-${SNAPPY_VERSION}")
set(SNAPPY_VERSION "1.1.7")
set(SNAPPY_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/snappy/snappy-${SNAPPY_VERSION}")
set(SNAPPY_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/snappy/snappy-${SNAPPY_VERSION}")
set(SNAPPY_LIB "snappy")
set(SNAPPY_LIB "${SNAPPY_LIB}" PARENT_SCOPE)
add_subdirectory(${SNAPPY_SOURCE_DIR} EXCLUDE_FROM_ALL)

################################################################################
Expand All @@ -258,7 +241,7 @@ if (USE_JEMALLOC)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/jemalloc)
include_directories(SYSTEM "${JEMALLOC_HOME}/include")
link_directories("${JEMALLOC_HOME}/lib")
set(SYS_LIBS ${SYS_LIBS} ${JEMALLOC_LIB})
set(SYS_LIBS ${SYS_LIBS} ${JEMALLOC_LIB} PARENT_SCOPE)
endif ()

################################################################################
Expand Down
10 changes: 5 additions & 5 deletions 3rdParty/V8/v5.7.492.77/gypfiles/standalone.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@
'-Wnon-virtual-dtor',
'-fno-exceptions',
'-fno-rtti',
'-std=gnu++11',
'-std=gnu++14',
],
'ldflags': [ '-pth F438 read', ],
'conditions': [
Expand Down Expand Up @@ -832,7 +832,7 @@
'-Wnon-virtual-dtor',
'-fno-exceptions',
'-fno-rtti',
'-std=gnu++11',
'-std=gnu++14',
],
'conditions': [
[ 'visibility=="hidden"', {
Expand Down Expand Up @@ -1096,7 +1096,7 @@
['clang==1', {
'xcode_settings': {
'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
'CLANG_CXX_LANGUAGE_STANDARD': 'c++11', # -std=c++11
'CLANG_CXX_LANGUAGE_STANDARD': 'c++14', # -std=c++14
},
'conditions': [
['clang_xcode==0', {
Expand Down Expand Up @@ -1134,7 +1134,7 @@
}, # configurations
'cflags': [ '-Wno-abi', '-Wall', '-W', '-Wno-unused-parameter'],
'cflags_cc': [ '-Wnon-virtual-dtor', '-fno-rtti', '-fno-exceptions',
'-std=gnu++11' ],
'-std=gnu++14' ],
'target_conditions': [
['_toolset=="target"', {
'cflags!': [
Expand Down Expand Up @@ -1330,7 +1330,7 @@
['clang==0 and host_clang==1 and target_arch!="ia32" and target_arch!="x64"', {
'target_conditions': [
['_toolset=="host"', {
'cflags_cc': [ '-std=gnu++11', ],
'cflags_cc': [ '-std=gnu++14', ],
}],
],
'target_defaults': {
Expand Down
6 changes: 3 additions & 3 deletions 3rdParty/fuerte/include/fuerte/FuerteLogger.h
10000
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,21 @@
#endif

#if ENABLE_FUERTE_LOG_VSTTRACE > 0
#define FUERTE_LOG_VSTTRACE std::cout
#define FUERTE_LOG_VSTTRACE std::cout << "[vst] "
#else
#define FUERTE_LOG_VSTTRACE \
if (0) std::cout
#endif

#if ENABLE_FUERTE_LOG_VSTCHUNKTRACE > 0
#define FUERTE_LOG_VSTCHUNKTRACE std::cout
#define FUERTE_LOG_VSTCHUNKTRACE std::cout << "[vst] "
#else
#define FUERTE_LOG_VSTCHUNKTRACE \
if (0) std::cout
#endif

#if ENABLE_FUERTE_LOG_HTTPTRACE > 0
#define FUERTE_LOG_HTTPTRACE std::cout
#define FUERTE_LOG_HTTPTRACE std::cout << "[http] "
#else
#define FUERTE_LOG_HTTPTRACE \
if (0) std::cout
Expand Down
43 changes: 21 additions & 22 deletions 3rdParty/fuerte/include/fuerte/connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,48 +51,47 @@ class Connection : public std::enable_shared_from_this<Connection> {

/// @brief Send a request to the server and wait into a response it received.
std::unique_ptr<Response> sendRequest(std::unique_ptr<Request> r);

/// @brief sed request synchronously, only save to use if the
virtual std::unique_ptr<Response> sendRequestSync(std::unique_ptr<Request> r) {
return sendRequest(std::move(r));
}

// Send a request to the server and wait into a response it received.
/*std::unique_ptr<Response> sendRequest(Request const& r) {
/// @brief Send a request to the server and wait into a response it received.
/// @param r request that is copied
std::unique_ptr<Response> sendRequest(Request const& r) {
std::unique_ptr<Request> copy(new Request(r));
return sendRequest(std::move(copy));
}*/
}

// Send a request to the server and return immediately.
// When a response is received or an error occurs, the corresponding
// callbackis called. The callback is executed on a specific
// IO-Thread for this connection.
/// @brief Send a request to the server and return immediately.
/// When a response is received or an error occurs, the corresponding
/// callbackis called. The callback is executed on a specific
/// IO-Thread for this connection.
virtual MessageID sendRequest(std::unique_ptr<Request> r,
RequestCallback cb) = 0;

// Send a request to the server and return immediately.
// When a response is received or an error occurs, the corresponding
// callback is called.
/*MessageID sendRequest(Request const& r, RequestCallback cb) {
/// @brief Send a request to the server and return immediately.
/// When a response is received or an error occurs, the corresponding
/// callbackis called. The callback is executed on a specific
/// IO-Thread for this connection.
MessageID sendRequest(Request const& r, RequestCallback cb) {
std::unique_ptr<Request> copy(new Request(r));
return sendRequest(std::move(copy), cb);
}*/
}

// Return the number of requests that have not yet finished.
/// @brief Return the number of requests that have not yet finished.
virtual std::size_t requestsLeft() const = 0;

/// @brief connection state
virtual State state() const = 0;

/// @brief Activate the connection.
virtual void startConnection() = 0;
virtual void shutdownConnection(const ErrorCondition) = 0;

/// @brief cancel the connection, unusable afterwards
virtual void cancel() = 0;

std::string endpoint() const;

protected:
Connection(detail::ConnectionConfiguration const& conf)
: _config(conf) {}

/// @brief Activate the connection.
virtual void startConnection() = 0;

// Invoke the configured ConnectionFailureCallback (if any)
void onFailure(Error errorCode, const std::string& errorMessage) {
Expand Down
5 changes: 1 addition & 4 deletions 3rdParty/fuerte/include/fuerte/loop.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,12 @@ class EventLoopService {
public:
// Initialize an EventLoopService with a given number of threads
// and a given number of io_context
EventLoopService(unsigned int threadCount = 1);
explicit EventLoopService(unsigned int threadCount = 1);
virtual ~EventLoopService();

// Prevent copying
EventLoopService(EventLoopService const& other) = delete;
EventLoopService& operator=(EventLoopService const& other) = delete;

/// forcebly stop all io contexts. service is unusable after
void forceStop();

// io_service returns a reference to the boost io_service.
std::shared_ptr<asio_io_context>& nextIOContext() {
Expand Down
13 changes: 9 additions & 4 deletions 3rdParty/fuerte/include/fuerte/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,27 +175,32 @@ struct ConnectionConfiguration {
: _socketType(SocketType::Tcp),
_protocolType(ProtocolType::Vst),
_vstVersion(vst::VST1_1),
_verifyHost(false),
_host("localhost"),
_port("8529"),
_verifyHost(false),
_connectionTimeout(60000),
_maxConnectRetries(3),
_authenticationType(AuthenticationType::None),
_user(""),
_password(""),
_jwtToken("") {}

ConnectionFailureCallback _onFailure;
SocketType _socketType; // tcp, ssl or unix
ProtocolType _protocolType; // vst or http
vst::VSTVersion _vstVersion;
bool _verifyHost;


std::string _host;
std::string _port;
bool _verifyHost;

std::chrono::milliseconds _connectionTimeout;
unsigned _maxConnectRetries;

AuthenticationType _authenticationType;
std::string _user;
std::string _password;
std::string _jwtToken;
ConnectionFailureCallback _onFailure;
};
} // namespace detail
}}} // namespace arangodb::fuerte::v1
Expand Down
3 changes: 2 additions & 1 deletion 3rdParty/fuerte/include/fuerte/waitgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class WaitGroup {
// call done() when the event has finished.
void add(unsigned int increment = 1) {
assert(increment > 0);
std::lock_guard<std::mutex> lock(_mutex);
std::unique_lock<std::mutex> lock(_mutex);
_counter += increment;
}

Expand All @@ -61,6 +61,7 @@ class WaitGroup {
std::unique_lock<std::mutex> lock(_mutex);
_counter--;
if (_counter == 0) {
//lock.unlock();
_conditionVar.notify_all();
}
}
Expand Down
30 changes: 17 additions & 13 deletions 3rdParty/fuerte/src/AsioSockets.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ struct Socket<SocketType::Tcp> {
: resolver(ctx), socket(ctx) {}

~Socket() {
resolver.cancel();
shutdown();
try {
resolver.cancel();
shutdown();
} catch(...) {}
}

template<typename CallbackT>
Expand All @@ -63,10 +65,10 @@ struct Socket<SocketType::Tcp> {
}
void shutdown() {
if (socket.is_open()) {
asio_ns::error_code error; // prevents exceptions
socket.cancel(error);
socket.shutdown(asio_ns::ip::tcp::socket::shutdown_both, error);
socket.close(error);
asio_ns::error_code ec; // prevents exceptions
socket.cancel(ec);
socket.shutdown(asio_ns::ip::tcp::socket::shutdown_both, ec);
socket.close(ec);
}
}

Expand All @@ -81,8 +83,10 @@ struct Socket<fuerte::SocketType::Ssl> {
: resolver(ctx), socket(ctx, loop.sslContext()) {}

~Socket() {
resolver.cancel();
shutdown();
try {
resolver.cancel();
shutdown();
} catch(...) {}
}

template<typename CallbackT>
Expand Down Expand Up @@ -124,12 +128,12 @@ struct Socket<fuerte::SocketType::Ssl> {
resolver.async_resolve({config._host, config._port}, rcb);
}
void shutdown() {
//socket.cancel();
if (socket.lowest_layer().is_open()) {
asio_ns::error_code error;
socket.shutdown(error);
socket.lowest_layer().shutdown(asio_ns::ip::tcp::socket::shutdown_both, error);
socket.lowest_layer().close(error);
asio_ns::error_code ec;
socket.lowest_layer().cancel(ec);
socket.shutdown(ec);
socket.lowest_layer().shutdown(asio_ns::ip::tcp::socket::shutdown_both, ec);
socket.lowest_layer().close(ec);
}
}

Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.
0