1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-5105 This patch raises pipe read operation timeout to 20 minutes

to enable DMLProc to survive rollbacks on startup.
The patch also fixes linter warnings in service.h and pipe.h.
This commit is contained in:
Roman Nozdrin
2022-06-09 14:24:17 +00:00
parent 94ba91c687
commit 7c9da5709d
2 changed files with 12 additions and 2 deletions

View File

@ -20,6 +20,11 @@
/* /*
A helper class to hold the file descriptors returned from a pipe() call. A helper class to hold the file descriptors returned from a pipe() call.
*/ */
#include <sys/types.h>
#include <unistd.h>
#include <cerrno>
#include <string>
class Pipe class Pipe
{ {
int fd[2]; int fd[2];
@ -60,7 +65,7 @@ class Pipe
FD_ZERO(&rfds); FD_ZERO(&rfds);
FD_SET(fd[0], &rfds); FD_SET(fd[0], &rfds);
struct timeval tmptv = tv; struct timeval tmptv = tv;
int retval = select(fd[0] + 1, &rfds, NULL, NULL, &tmptv); int retval = select(fd[0] + 1, &rfds, nullptr, nullptr, &tmptv);
if (retval == -1) if (retval == -1)
return -1; return -1;
if (!retval) if (!retval)

View File

@ -18,11 +18,16 @@
#pragma once #pragma once
#include <signal.h> #include <signal.h>
#include <cstring>
#include <sstream>
#include "pipe.h" #include "pipe.h"
class Service class Service
{ {
protected: protected:
// The read operation implicitly controls how long binary waits
// before it starts. This is import for DMLProc to survive rollbacks. See MCOL-5105.
static constexpr const size_t PipeReadTimeout = 1200;
// The service name, for logging // The service name, for logging
const std::string m_name; const std::string m_name;
// The pipe to send messages from the child to the parent // The pipe to send messages from the child to the parent
@ -62,7 +67,7 @@ class Service
{ {
char str[100]; char str[100];
// Read the message from the child // Read the message from the child
ssize_t nbytes = m_pipe.readtm({120, 0}, str, sizeof(str)); ssize_t nbytes = m_pipe.readtm({PipeReadTimeout, 0}, str, sizeof(str));
if (nbytes >= 0) if (nbytes >= 0)
{ {
ParentLogChildMessage(std::string(str, nbytes)); ParentLogChildMessage(std::string(str, nbytes));