You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
fix(join, threadpool): MCOL-5565: MCOL-5636: MCOL-5645: port from develop-23.02 to [develop] (#3128)
* fix(threadpool): MCOL-5565 queries stuck in FairThreadScheduler. (#3100) Meta Primitive Jobs, .e.g ADD_JOINER, LAST_JOINER stuck in Fair scheduler without out-of-band scheduler. Add OOB scheduler back to remedy the issue. * fix(messageqcpp): MCOL-5636 same node communication crashes transmiting PP errors to EM b/c error messaging leveraged socket that was a nullptr. (#3106) * fix(threadpool): MCOL-5645 errenous threadpool Job ctor implictly sets socket shared_ptr to nullptr causing sigabrt when threadpool returns an error (#3125) --------- Co-authored-by: drrtuy <roman.nozdrin@mariadb.com>
This commit is contained in:
@ -9,6 +9,7 @@ set(messageqcpp_LIB_SRCS
|
||||
bytestream.cpp
|
||||
socketparms.cpp
|
||||
inetstreamsocket.cpp
|
||||
samenodepseudosocket.cpp
|
||||
iosocket.cpp
|
||||
compressed_iss.cpp
|
||||
bytestreampool.cpp
|
||||
|
@ -39,8 +39,6 @@
|
||||
|
||||
class MessageQTestSuite;
|
||||
|
||||
#define EXPORT
|
||||
|
||||
namespace messageqcpp
|
||||
{
|
||||
class ServerSocket;
|
||||
@ -54,22 +52,22 @@ class IOSocket
|
||||
/** ctor
|
||||
*
|
||||
*/
|
||||
EXPORT explicit IOSocket(Socket* socket = 0);
|
||||
explicit IOSocket(Socket* socket = 0);
|
||||
|
||||
/** copy ctor
|
||||
*
|
||||
*/
|
||||
EXPORT IOSocket(const IOSocket& rhs);
|
||||
IOSocket(const IOSocket& rhs);
|
||||
|
||||
/** assign op
|
||||
*
|
||||
*/
|
||||
EXPORT IOSocket& operator=(const IOSocket& rhs);
|
||||
IOSocket& operator=(const IOSocket& rhs);
|
||||
|
||||
/** dtor
|
||||
*
|
||||
*/
|
||||
EXPORT virtual ~IOSocket();
|
||||
virtual ~IOSocket();
|
||||
|
||||
/** read a ByteStream from this socket
|
||||
*
|
||||
@ -84,9 +82,9 @@ class IOSocket
|
||||
* This socket needs to be connected first. Will throw runtime_error on I/O error. Caller should
|
||||
* call close() method if exception is thrown.
|
||||
*/
|
||||
EXPORT virtual void write(const ByteStream& msg, Stats* stats = NULL) const;
|
||||
EXPORT virtual void write_raw(const ByteStream& msg, Stats* stats = NULL) const;
|
||||
EXPORT virtual void write(SBS msg, Stats* stats = NULL) const;
|
||||
virtual void write(const ByteStream& msg, Stats* stats = NULL) const;
|
||||
virtual void write_raw(const ByteStream& msg, Stats* stats = NULL) const;
|
||||
virtual void write(SBS msg, Stats* stats = NULL) const;
|
||||
|
||||
/** access the sockaddr member
|
||||
*/
|
||||
@ -125,29 +123,29 @@ class IOSocket
|
||||
*
|
||||
* Install a socket implementation that meets the Socket interface
|
||||
*/
|
||||
EXPORT virtual void setSocketImpl(Socket* socket);
|
||||
virtual void setSocketImpl(Socket* socket);
|
||||
|
||||
/** get a string rep of the IOSocket
|
||||
*
|
||||
*/
|
||||
EXPORT virtual const std::string toString() const;
|
||||
virtual const std::string toString() const;
|
||||
|
||||
/** syncProto() forwarder for inherited classes
|
||||
*
|
||||
*/
|
||||
EXPORT virtual void syncProto(bool use)
|
||||
virtual void syncProto(bool use)
|
||||
{
|
||||
fSocket->syncProto(use);
|
||||
}
|
||||
|
||||
EXPORT virtual int getConnectionNum() const;
|
||||
virtual int getConnectionNum() const;
|
||||
|
||||
// Debug
|
||||
EXPORT void setSockID(uint32_t id)
|
||||
void setSockID(uint32_t id)
|
||||
{
|
||||
sockID = id;
|
||||
}
|
||||
EXPORT uint32_t getSockID()
|
||||
uint32_t getSockID()
|
||||
{
|
||||
return sockID;
|
||||
}
|
||||
@ -174,7 +172,6 @@ class IOSocket
|
||||
return fSocket->isSameAddr(ipv4Addr);
|
||||
}
|
||||
|
||||
|
||||
/** connect() forwarder for inherited classes
|
||||
*
|
||||
*/
|
||||
@ -298,5 +295,3 @@ inline std::ostream& operator<<(std::ostream& os, const IOSocket& rhs)
|
||||
}
|
||||
|
||||
} // namespace messageqcpp
|
||||
|
||||
#undef EXPORT
|
||||
|
127
utils/messageqcpp/samenodepseudosocket.cpp
Normal file
127
utils/messageqcpp/samenodepseudosocket.cpp
Normal file
@ -0,0 +1,127 @@
|
||||
/* Copyright (C) 2024 MariaDB Corp.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; version 2 of
|
||||
the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "samenodepseudosocket.h"
|
||||
#include "iosocket.h"
|
||||
|
||||
namespace messageqcpp
|
||||
{
|
||||
SameNodePseudoSocket::SameNodePseudoSocket(joblist::DistributedEngineComm* exeMgrDecPtr) : dec_(exeMgrDecPtr)
|
||||
{
|
||||
assert(dec_);
|
||||
}
|
||||
|
||||
SameNodePseudoSocket::~SameNodePseudoSocket()
|
||||
{
|
||||
}
|
||||
|
||||
void SameNodePseudoSocket::open()
|
||||
{
|
||||
}
|
||||
|
||||
void SameNodePseudoSocket::close()
|
||||
{
|
||||
}
|
||||
|
||||
Socket* SameNodePseudoSocket::clone() const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SameNodePseudoSocket::SameNodePseudoSocket(const SameNodePseudoSocket& rhs)
|
||||
{
|
||||
}
|
||||
|
||||
SameNodePseudoSocket& SameNodePseudoSocket::operator=(const SameNodePseudoSocket& rhs)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
const SBS SameNodePseudoSocket::read(const struct ::timespec* timeout, bool* isTimeOut, Stats* stats) const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// This is the only working method of this class. It puts SBS directly into DEC queue.
|
||||
void SameNodePseudoSocket::write(SBS msg, Stats* stats)
|
||||
{
|
||||
dec_->addDataToOutput(msg);
|
||||
}
|
||||
|
||||
void SameNodePseudoSocket::write(const ByteStream& msg, Stats* stats)
|
||||
{
|
||||
}
|
||||
|
||||
void SameNodePseudoSocket::write_raw(const ByteStream& msg, Stats* stats) const
|
||||
{
|
||||
}
|
||||
|
||||
void SameNodePseudoSocket::connect(const sockaddr* serv_addr)
|
||||
{
|
||||
}
|
||||
|
||||
void SameNodePseudoSocket::bind(const sockaddr* serv_addr)
|
||||
{
|
||||
}
|
||||
|
||||
const IOSocket SameNodePseudoSocket::accept(const struct timespec* timeout)
|
||||
{
|
||||
return IOSocket();
|
||||
}
|
||||
|
||||
void SameNodePseudoSocket::listen(int backlog)
|
||||
{
|
||||
}
|
||||
|
||||
const std::string SameNodePseudoSocket::toString() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
const std::string SameNodePseudoSocket::addr2String() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
bool SameNodePseudoSocket::isSameAddr(const Socket* rhs) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SameNodePseudoSocket::isSameAddr(const struct in_addr& ipv4Addr) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int SameNodePseudoSocket::ping(const std::string& ipaddr, const struct timespec* timeout)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool SameNodePseudoSocket::isConnected() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SameNodePseudoSocket::hasData() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace messageqcpp
|
99
utils/messageqcpp/samenodepseudosocket.h
Normal file
99
utils/messageqcpp/samenodepseudosocket.h
Normal file
@ -0,0 +1,99 @@
|
||||
/* Copyright (C) 2024 MariaDB Corp.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; version 2 of
|
||||
the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../dbcon/joblist/distributedenginecomm.h"
|
||||
|
||||
#include "socket.h"
|
||||
#include "socketparms.h"
|
||||
#include "bytestream.h"
|
||||
|
||||
namespace messageqcpp
|
||||
{
|
||||
class IOSocket;
|
||||
|
||||
// This class is a dummy replacement for a TCP socket
|
||||
// wrapper to communicate with the same node.
|
||||
class SameNodePseudoSocket : public Socket
|
||||
{
|
||||
public:
|
||||
explicit SameNodePseudoSocket(joblist::DistributedEngineComm* exeMgrDecPtr);
|
||||
virtual ~SameNodePseudoSocket();
|
||||
virtual void write(SBS msg, Stats* stats = NULL);
|
||||
|
||||
private:
|
||||
virtual void bind(const sockaddr* serv_addr);
|
||||
SameNodePseudoSocket(const SameNodePseudoSocket& rhs);
|
||||
virtual SameNodePseudoSocket& operator=(const SameNodePseudoSocket& rhs);
|
||||
|
||||
virtual void connectionTimeout(const struct ::timespec* timeout)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void syncProto(bool use)
|
||||
{
|
||||
}
|
||||
|
||||
int getConnectionNum() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
inline virtual void socketParms(const SocketParms& socket)
|
||||
{
|
||||
}
|
||||
|
||||
inline virtual const SocketParms socketParms() const
|
||||
{
|
||||
return SocketParms();
|
||||
}
|
||||
|
||||
// all these virtual methods are to stay inaccessable.
|
||||
inline virtual void sa(const sockaddr* sa);
|
||||
virtual void open();
|
||||
virtual void close();
|
||||
inline virtual bool isOpen() const;
|
||||
virtual const SBS read(const struct timespec* timeout = 0, bool* isTimeOut = NULL,
|
||||
Stats* stats = NULL) const;
|
||||
virtual void write(const ByteStream& msg, Stats* stats = NULL);
|
||||
virtual void write_raw(const ByteStream& msg, Stats* stats = NULL) const;
|
||||
virtual void listen(int backlog = 5);
|
||||
virtual const IOSocket accept(const struct timespec* timeout = 0);
|
||||
virtual void connect(const sockaddr* serv_addr);
|
||||
virtual Socket* clone() const;
|
||||
virtual const std::string toString() const;
|
||||
virtual const std::string addr2String() const;
|
||||
virtual bool isSameAddr(const Socket* rhs) const;
|
||||
virtual bool isSameAddr(const struct in_addr& ipv4Addr) const;
|
||||
static int ping(const std::string& ipaddr, const struct timespec* timeout = 0);
|
||||
virtual bool isConnected() const;
|
||||
virtual bool hasData() const;
|
||||
|
||||
joblist::DistributedEngineComm* dec_ = nullptr;
|
||||
};
|
||||
|
||||
inline bool SameNodePseudoSocket::isOpen() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void SameNodePseudoSocket::sa(const sockaddr* sa)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace messageqcpp
|
Reference in New Issue
Block a user