Merge branch 'develop' into MXS-1209

This commit is contained in:
MassimilianoPinto 2017-04-28 16:43:49 +02:00
commit 23c166ba37
5 changed files with 81 additions and 6 deletions

View File

@ -970,6 +970,24 @@ closed.
For more information about persistent connections, please read the
[Administration Tutorial](../Tutorials/Administration-Tutorial.md).
#### `use_proxy_protocol`
If `use_proxy_protocol` is set to `yes`, MaxScale will send a proxy protocol
header when connecting client sessions to the server. The header contains the
original client IP address and port, as seen by MaxScale. The server will then
read the header and perform authentication as if the connection originated from
this address instead of the MaxScale IP address. With this feature, the user
accounts on the backend server can be simplified to only contain the actual
client hosts and not the MaxScale host.
Currently, using this feature is unpractical due to the restrictiveness of the
proxy protocol. The protocol requires that *all* connections from proxy enabled
addresses must send a valid proxy header. MaxScale has other connections to the
servers in addition to client sessions, e.g. monitors, and the server will
refuse these due to the lack of the header. To bypass this restriction, the
server monitor needs to be disabled and the service listener needs to be
configured to disregard authentication errors (`skip_authentication=true`).
### Server and SSL
This section describes configuration parameters for servers that control the

View File

@ -20,6 +20,17 @@
MXS_BEGIN_DECLS
/**
* Pre 4.7 GCC doesn't support the __atomic builtin functions. The older __sync
* builtins don't have proper store/load functionality so we use a somewhat ugly
* hack to emulate the store/load.
*/
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
#ifndef MXS_USE_ATOMIC_BUILTINS
#define MXS_USE_ATOMIC_BUILTINS 1
#endif
#endif
/**
* Implementation of an atomic add operations for the GCC environment.
*
@ -76,7 +87,13 @@ void atomic_store_uint64(uint64_t *variable, uint64_t value);
static inline void atomic_synchronize()
{
#ifdef __GNUC__
#ifdef MXS_USE_ATOMIC_BUILTINS
__atomic_thread_fence(__ATOMIC_SEQ_CST);
#else
__sync_synchronize(); /* Memory barrier. */
#endif
#else
#error "No GNUC atomics available."
#endif

View File

@ -38,8 +38,8 @@ MXS_BEGIN_DECLS
#else // __cplusplus
// C++11 supports thread_local natively.
#if __cplusplus < 201103
// GCC 4.8 added support for native thread_local.
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8)
#if defined(__GNUC__)
#define thread_local __thread
@ -47,7 +47,7 @@ MXS_BEGIN_DECLS
#error Do not know how to define thread_local on this compiler/OS platform.
#endif
#endif // __cplusplus < 201103
#endif
#endif // __cplusplus

View File

@ -19,45 +19,81 @@
int atomic_add(int *variable, int value)
{
#ifdef MXS_USE_ATOMIC_BUILTINS
return __atomic_fetch_add(variable, value, __ATOMIC_SEQ_CST);
#else
return __sync_fetch_and_add(variable, value);
#endif
}
int64_t atomic_add_int64(int64_t *variable, int64_t value)
{
#ifdef MXS_USE_ATOMIC_BUILTINS
return __atomic_fetch_add(variable, value, __ATOMIC_SEQ_CST);
#else
return __sync_fetch_and_add(variable, value);
#endif
}
uint64_t atomic_add_uint64(uint64_t *variable, int64_t value)
{
#ifdef MXS_USE_ATOMIC_BUILTINS
return __atomic_fetch_add(variable, value, __ATOMIC_SEQ_CST);
#else
return __sync_fetch_and_add(variable, value);
#endif
}
int atomic_load_int32(int *variable)
{
#ifdef MXS_USE_ATOMIC_BUILTINS
return __atomic_load_n(variable, __ATOMIC_SEQ_CST);
#else
return __sync_fetch_and_or(variable, 0);
#endif
}
int64_t atomic_load_int64(int64_t *variable)
{
#ifdef MXS_USE_ATOMIC_BUILTINS
return __atomic_load_n(variable, __ATOMIC_SEQ_CST);
#else
return __sync_fetch_and_or(variable, 0);
#endif
}
uint64_t atomic_load_uint64(uint64_t *variable)
{
#ifdef MXS_USE_ATOMIC_BUILTINS
return __atomic_load_n(variable, __ATOMIC_SEQ_CST);
#else
return __sync_fetch_and_or(variable, 0);
#endif
}
void atomic_store_int32(int *variable, int value)
{
return __atomic_store_n(variable, value, __ATOMIC_SEQ_CST);
#ifdef MXS_USE_ATOMIC_BUILTINS
__atomic_store_n(variable, value, __ATOMIC_SEQ_CST);
#else
__sync_lock_test_and_set(variable, value);
#endif
}
void atomic_store_int64(int64_t *variable, int64_t value)
{
return __atomic_store_n(variable, value, __ATOMIC_SEQ_CST);
#ifdef MXS_USE_ATOMIC_BUILTINS
__atomic_store_n(variable, value, __ATOMIC_SEQ_CST);
#else
__sync_lock_test_and_set(variable, value);
#endif
}
void atomic_store_uint64(uint64_t *variable, uint64_t value)
{
return __atomic_store_n(variable, value, __ATOMIC_SEQ_CST);
#ifdef MXS_USE_ATOMIC_BUILTINS
__atomic_store_n(variable, value, __ATOMIC_SEQ_CST);
#else
__sync_lock_test_and_set(variable, value);
#endif
}

View File

@ -3491,11 +3491,15 @@ int poll_add_dcb(DCB *dcb)
}
else if (dcb->dcb_role == DCB_ROLE_BACKEND_HANDLER)
{
ss_dassert(Worker::get_current_id() != -1);
worker_id = dcb->session->client_dcb->poll.thread.id;
ss_dassert(worker_id == Worker::get_current_id());
}
else
{
ss_dassert(Worker::get_current_id() != -1);
worker_id = Worker::get_current_id();
}