Merge commit '8ac11a97c29ac9ce3e4099e77a9aa9475c1002b4' into 2.4
This commit is contained in:
commit
4d513941a7
@ -240,7 +240,7 @@ public:
|
||||
*
|
||||
* @return The id of the routing worker.
|
||||
*/
|
||||
int id() const
|
||||
int id() const override
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
@ -335,6 +335,16 @@ public:
|
||||
|
||||
virtual ~Worker();
|
||||
|
||||
/**
|
||||
* Returns the id of the worker
|
||||
*
|
||||
* @return The address of the worker cast to an int
|
||||
*/
|
||||
virtual int id() const
|
||||
{
|
||||
return (intptr_t)this;
|
||||
}
|
||||
|
||||
int load(Load::counter_t counter)
|
||||
{
|
||||
return m_load.percentage(counter);
|
||||
|
@ -17,10 +17,12 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fstream>
|
||||
#include <mutex>
|
||||
#include <maxbase/assert.h>
|
||||
#include <maxbase/log.h>
|
||||
#include <maxbase/string.hh>
|
||||
#include <maxbase/worker.hh>
|
||||
#include <maxbase/format.hh>
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -146,10 +148,23 @@ MessageQueue* MessageQueue::create(Handler* pHandler)
|
||||
*/
|
||||
if (fcntl(fds[0], F_SETPIPE_SZ, this_unit.pipe_max_size) == -1)
|
||||
{
|
||||
MXB_WARNING("Failed to increase pipe buffer size to '%d': %d, %s",
|
||||
this_unit.pipe_max_size,
|
||||
errno,
|
||||
mxb_strerror(errno));
|
||||
MXB_WARNING("Failed to increase pipe buffer size to '%d': %d, %s. "
|
||||
"Increase pipe-user-pages-soft (sysctl fs.pipe-user-pages-soft) "
|
||||
"or reduce pipe-max-size (sysctl fs.pipe-max-size).",
|
||||
this_unit.pipe_max_size, errno, mxb_strerror(errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
static int current_pipe_max_size = 0;
|
||||
static std::mutex pipe_size_lock;
|
||||
std::lock_guard<std::mutex> guard(pipe_size_lock);
|
||||
|
||||
if (current_pipe_max_size == 0)
|
||||
{
|
||||
current_pipe_max_size = this_unit.pipe_max_size;
|
||||
MXB_NOTICE("Worker message queue size: %s",
|
||||
mxb::to_binary_size(this_unit.pipe_max_size).c_str());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
pThis = new(std::nothrow) MessageQueue(pHandler, read_fd, write_fd);
|
||||
@ -219,7 +234,8 @@ bool MessageQueue::post(const Message& message) const
|
||||
|
||||
if (n == -1)
|
||||
{
|
||||
MXB_ERROR("Failed to write message: %d, %s", errno, mxb_strerror(errno));
|
||||
MXB_ERROR("Failed to write message to worker %d: %d, %s",
|
||||
m_pWorker->id(), errno, mxb_strerror(errno));
|
||||
|
||||
static bool warn_pipe_buffer_size = true;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user