CUBRID Engine  latest
heartbeat.c
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Search Solution Corporation
3  * Copyright 2016 CUBRID Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 /*
20  * heartbeat.c - heartbeat resource process common
21  */
22 
23 #ident "$Id$"
24 
25 #include "config.h"
26 
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <string.h>
30 #include <errno.h>
31 #include <sys/types.h>
32 #include <assert.h>
33 #include <signal.h>
34 
35 #if defined(WINDOWS)
36 #include <winsock2.h>
37 #include <windows.h>
38 #else /* WINDOWS */
39 #include <fcntl.h>
40 #include <sys/time.h>
41 #include <sys/ioctl.h>
42 #include <sys/uio.h>
43 #include <sys/socket.h>
44 #include <netinet/in.h>
45 #endif /* WINDOWS */
46 
47 #if defined(_AIX)
48 #include <sys/select.h>
49 #endif /* _AIX */
50 
51 #if defined(SOLARIS)
52 #include <sys/filio.h>
53 #include <netdb.h>
54 #endif /* SOLARIS */
55 
56 #if defined(SOLARIS) || defined(LINUX)
57 #include <unistd.h>
58 #include <pthread.h>
59 #endif /* SOLARIS || LINUX */
60 
61 #include "environment_variable.h"
62 #include "error_context.hpp"
63 #include "porting.h"
64 #include "system_parameter.h"
65 #include "error_manager.h"
66 #include "connection_defs.h"
67 #include "connection_support.h"
68 #if defined(WINDOWS)
69 #include "wintcp.h"
70 #else /* WINDOWS */
71 #include "tcp.h"
72 #endif /* WINDOWS */
73 #include "release_string.h"
74 #include "heartbeat.h"
75 
76 extern CSS_CONN_ENTRY *css_connect_to_master_server (int master_port_id, const char *server_name, int name_length);
77 extern void css_shutdown_conn (CSS_CONN_ENTRY * conn);
78 
80 static char *hb_pack_server_name (const char *server_name, int *name_length, const char *log_path, HB_PROC_TYPE type);
81 
82 static CSS_CONN_ENTRY *hb_connect_to_master (const char *server_name, const char *log_path, HB_PROC_TYPE type);
83 static int hb_create_master_reader (void);
85 static const char *hb_type_to_str (HB_PROC_TYPE type);
86 
87 static pthread_t hb_Master_mon_th;
88 
90 static char hb_Exec_path[PATH_MAX];
91 static char **hb_Argv;
92 
93 bool hb_Proc_shutdown = false;
94 
96 
97 /*
98  * hb_process_type_string () -
99  * return: process type string
100  *
101  * ptype(in):
102  */
103 const char *
105 {
106  switch (ptype)
107  {
108  case HB_PTYPE_SERVER:
109  return HB_PTYPE_SERVER_STR;
110  case HB_PTYPE_COPYLOGDB:
111  return HB_PTYPE_COPYLOGDB_STR;
112  case HB_PTYPE_APPLYLOGDB:
114  }
115  return "invalid";
116 }
117 
118 /*
119  * hb_set_exec_path () -
120  * return: none
121  *
122  * exec_path(in):
123  */
124 void
125 hb_set_exec_path (char *exec_path)
126 {
127  strncpy (hb_Exec_path, exec_path, sizeof (hb_Exec_path) - 1);
128 }
129 
130 /*
131  * hb_set_argv () -
132  * return: none
133  *
134  * argv(in):
135  */
136 void
138 {
139  hb_Argv = argv;
140 }
141 
142 
143 /*
144  * css_send_heartbeat_request () -
145  * return:
146  *
147  * conn(in):
148  * command(in):
149  */
150 int
152 {
153  int nbytes;
154  int request;
155 
156  request = htonl (command);
157  if (conn && !IS_INVALID_SOCKET (conn->fd))
158  {
159  nbytes = send (conn->fd, (char *) &request, sizeof (int), 0);
160  if (nbytes == sizeof (int))
161  {
162  return (NO_ERRORS);
163  }
164  return (ERROR_ON_WRITE);
165  }
166  return CONNECTION_CLOSED;
167 }
168 
169 /*
170  * css_send_heartbeat_data () -
171  * return:
172  *
173  * conn(in):
174  * data(in):
175  * size(in):
176  */
177 int
178 css_send_heartbeat_data (CSS_CONN_ENTRY * conn, const char *data, int size)
179 {
180  int nbytes;
181 
182  if (conn && !IS_INVALID_SOCKET (conn->fd))
183  {
184  nbytes = send (conn->fd, (char *) data, size, 0);
185  if (nbytes == size)
186  {
187  return (NO_ERRORS);
188  }
189  return (ERROR_ON_WRITE);
190  }
191  return CONNECTION_CLOSED;
192 }
193 
194 /*
195  * css_receive_heartbeat_request () -
196  * return:
197  *
198  * conn(in):
199  * command(in):
200  */
201 int
203 {
204  int nbytes;
205  int request;
206  int size = sizeof (request);
207 
208  if (conn && !IS_INVALID_SOCKET (conn->fd))
209  {
210  nbytes = css_readn (conn->fd, (char *) &request, size, -1);
211  if (nbytes == size)
212  {
213  *command = ntohl (request);
214  return NO_ERRORS;
215  }
216  return ERROR_ON_READ;
217  }
218  return CONNECTION_CLOSED;
219 }
220 
221 /*
222  * css_receive_heartbeat_data () -
223  * return:
224  *
225  * conn(in):
226  * data(in):
227  * size(in):
228  */
229 int
230 css_receive_heartbeat_data (CSS_CONN_ENTRY * conn, char *data, int size)
231 {
232  int nbytes;
233 
234  if (conn && !IS_INVALID_SOCKET (conn->fd))
235  {
236  nbytes = css_readn (conn->fd, data, size, -1);
237  if (nbytes == size)
238  {
239  return NO_ERRORS;
240  }
241  return ERROR_ON_READ;
242  }
243  return CONNECTION_CLOSED;
244 }
245 
246 /*
247 * hb_thread_master_reader () -
248 * return: none
249 *
250 * arg(in):
251 */
254 {
255 #if !defined(WINDOWS)
256  int error;
257 
258  /* *INDENT-OFF* */
259  cuberr::context er_context (true);
260  /* *INDENT-ON* */
261 
262  error = hb_process_master_request ();
263  if (error != NO_ERROR)
264  {
265  hb_process_term ();
266 
267  /* wait 1 sec */
268  sleep (1);
269 
270 
271  /* is it ok? */
272  kill (getpid (), SIGTERM);
273  }
274 #endif
275  return (THREAD_RET_T) 0;
276 }
277 
278 
279 /*
280 * hb_make_set_hbp_register () -
281 * return:
282 *
283 * type(in):
284 */
285 static HBP_PROC_REGISTER *
287 {
288  HBP_PROC_REGISTER *hbp_register;
289  char *p, *last;
290  char **argv;
291 
292  hbp_register = (HBP_PROC_REGISTER *) malloc (sizeof (HBP_PROC_REGISTER));
293  if (NULL == hbp_register)
294  {
296  return (NULL);
297  }
298 
299  memset ((void *) hbp_register, 0, sizeof (HBP_PROC_REGISTER));
300  hbp_register->pid = htonl (getpid ());
301  hbp_register->type = htonl (type);
302  strncpy_bufsize (hbp_register->exec_path, hb_Exec_path);
303 
304  p = (char *) &hbp_register->args[0];
305  last = (char *) (p + sizeof (hbp_register->args));
306  for (argv = hb_Argv; *argv; argv++)
307  {
308  p += snprintf (p, MAX ((last - p), 0), "%s ", *argv);
309  }
310 
311  return (hbp_register);
312 }
313 
314 
315 /*
316 * hb_deregister_from_master () -
317 * return: NO_ERROR or ER_FAILED
318 *
319 */
320 int
322 {
323  int css_error;
324  int pid;
325 
326  if (hb_Conn == NULL || IS_INVALID_SOCKET (hb_Conn->fd))
327  {
328  return ER_FAILED;
329  }
330 
332  if (css_error != NO_ERRORS)
333  {
334  return ER_FAILED;
335  }
336 
337  pid = htonl (getpid ());
338  css_error = css_send_heartbeat_data (hb_Conn, (char *) &pid, sizeof (pid));
339  if (css_error != NO_ERRORS)
340  {
341  return ER_FAILED;
342  }
343 
344  return NO_ERROR;
345 }
346 
347 /*
348 * hb_register_to_master () -
349 * return: NO_ERROR or ER_FAILED
350 *
351 * conn(in):
352 * type(in):
353 */
354 int
356 {
357  int error;
358  HBP_PROC_REGISTER *hbp_register = NULL;
359 
360  if (NULL == conn)
361  {
362  er_log_debug (ARG_FILE_LINE, "invalid conn. (conn:NULL).\n");
363  return (ER_FAILED);
364  }
365 
366  hbp_register = hb_make_set_hbp_register (type);
367  if (NULL == hbp_register)
368  {
369  er_log_debug (ARG_FILE_LINE, "hbp_register failed. \n");
370  return (ER_FAILED);
371  }
372 
373  if (!IS_INVALID_SOCKET (conn->fd))
374  {
376  if (error != NO_ERRORS)
377  {
378  goto error_return;
379  }
380 
381  error = css_send_heartbeat_data (conn, (const char *) hbp_register, sizeof (*hbp_register));
382  if (error != NO_ERRORS)
383  {
384  goto error_return;
385  }
386  }
387  free_and_init (hbp_register);
388  return (NO_ERROR);
389 
390 error_return:
391  free_and_init (hbp_register);
392  return (ER_FAILED);
393 }
394 
395 /*
396 * hb_process_master_request_info () -
397 * return: NO_ERROR or ER_FAILED
398 *
399 * conn(in):
400 */
401 static int
403 {
404  int rc;
405  int command;
406 
407  if (NULL == conn)
408  {
409  er_log_debug (ARG_FILE_LINE, "invalid conn. (conn:NULL).\n");
410  return (ER_FAILED);
411  }
412 
413  rc = css_receive_heartbeat_request (conn, &command);
414  if (rc == NO_ERRORS)
415  {
416  /* Ignore request, just check connection is alive or not */
417  return (NO_ERROR);
418  }
419 
420  return (ER_FAILED);
421 }
422 
423 static const char *
425 {
426  if (type == HB_PTYPE_COPYLOGDB)
427  {
428  return "copylogdb";
429  }
430  else if (type == HB_PTYPE_APPLYLOGDB)
431  {
432  return "applylogdb";
433  }
434  else
435  {
436  return "";
437  }
438 }
439 
440 /*
441 * hb_process_to_master () -
442 * return: NO_ERROR or ER_FAILED
443 *
444 * argv(in):
445 */
446 int
448 {
449  int error;
450  int r, status = 0;
451  struct pollfd po[1] = { {0, 0, 0} };
452 
453  if (NULL == hb_Conn)
454  {
455  er_log_debug (ARG_FILE_LINE, "hb_Conn did not allocated yet. \n");
456  return (ER_FAILED);
457  }
458 
459  while (false == hb_Proc_shutdown)
460  {
461  po[0].fd = hb_Conn->fd;
462  po[0].events = POLLIN;
464 
465  switch (r)
466  {
467  case 0:
468  break;
469  case -1:
470  if (!IS_INVALID_SOCKET (hb_Conn->fd)
471 #if defined(WINDOWS)
472  && ioctlsocket (hb_Conn->fd, FIONREAD, (u_long *) (&status)) == SOCKET_ERROR
473 #else /* WINDOWS */
474  && fcntl (hb_Conn->fd, F_GETFL, status) < 0
475 #endif /* WINDOWS */
476  )
477  hb_Proc_shutdown = true;
478  break;
479  default:
480  error = hb_process_master_request_info (hb_Conn);
481  if (NO_ERROR != error)
482  {
483  hb_Proc_shutdown = true;
484  }
485  break;
486  }
487  }
488 
489  return (ER_FAILED);
490 }
491 
492 
493 /*
494  * hb_pack_server_name() - make a "server_name" string
495  * return: packed name
496  * server_name(in) : server name
497  * name_length(out) : length of packed name
498  * log_path(in) : log path
499  * copylogdbyn(in) : true if copylogdb
500  *
501  * Note:
502  * make a "server_name" string to connect to master
503  * server_name = server_type ( # ) +
504  * server_name +
505  * release_string +
506  * env_name + ($CUBRID path)
507  * pid_string (process id)
508  */
509 static char *
510 hb_pack_server_name (const char *server_name, int *name_length, const char *log_path, HB_PROC_TYPE type)
511 {
512  char *packed_name = NULL;
513  const char *env_name = NULL;
514  char pid_string[16];
515  int n_len, l_len, r_len, e_len, p_len;
516 
517  if (server_name != NULL)
518  {
519  env_name = envvar_root ();
520  if (env_name == NULL)
521  {
522  return NULL;
523  }
524 
525  /* here we changed the 2nd string in packed_name from rel_release_string() to rel_major_release_string() solely
526  * for the purpose of matching the name of the CUBRID driver. */
527 
528  snprintf (pid_string, sizeof (pid_string), "%d", getpid ());
529  n_len = (int) strlen (server_name) + 1;
530  l_len = (log_path) ? (int) strlen (log_path) + 1 : 0;
531  r_len = (int) strlen (rel_major_release_string ()) + 1;
532  e_len = (int) strlen (env_name) + 1;
533  p_len = (int) strlen (pid_string) + 1;
534  *name_length = n_len + l_len + r_len + e_len + p_len + 5;
535 
536  packed_name = (char *) malloc (*name_length);
537  if (packed_name == NULL)
538  {
540  return NULL;
541  }
542 
543  if (type == HB_PTYPE_COPYLOGDB)
544  {
545  packed_name[0] = '$';
546  }
547  else if (type == HB_PTYPE_APPLYLOGDB)
548  {
549  packed_name[0] = '%';
550  }
551  else
552  {
553  assert (0);
554 
555  free_and_init (packed_name);
556  return NULL;
557  }
558  memcpy (packed_name + 1, server_name, n_len);
559  if (l_len)
560  {
561  packed_name[(1 + n_len) - 1] = ':';
562  memcpy (packed_name + 1 + n_len, log_path, l_len);
563  }
564  memcpy (packed_name + 1 + n_len + l_len, rel_major_release_string (), r_len);
565  memcpy (packed_name + 1 + n_len + l_len + r_len, env_name, e_len);
566  memcpy (packed_name + 1 + n_len + l_len + r_len + e_len, pid_string, p_len);
567  }
568  return (packed_name);
569 }
570 
571 /*
572  * hb_connect_to_master() - connect to the master server
573  * return: conn
574  * server_name(in): server name
575  * log_path(in): log path
576  * copylogdbyn(in):
577  */
578 static CSS_CONN_ENTRY *
579 hb_connect_to_master (const char *server_name, const char *log_path, HB_PROC_TYPE type)
580 {
581  CSS_CONN_ENTRY *conn;
582  char *packed_name;
583  int name_length = 0;
584 
585  packed_name = hb_pack_server_name (server_name, &name_length, log_path, type);
586  if (packed_name == NULL)
587  {
588  return NULL;
589  }
590  conn = css_connect_to_master_server (prm_get_master_port_id (), packed_name, name_length);
591  if (conn == NULL)
592  {
593  free_and_init (packed_name);
594  return NULL;
595  }
596 
597  hb_Pipe_to_master = conn->fd;
598  free_and_init (packed_name);
599  return conn;
600 }
601 
602 /*
603 * hb_create_master_reader () -
604 * return: NO_ERROR or ER_FAILED
605 *
606 * conn(in):
607 */
608 static int
610 {
611 #if !defined (WINDOWS)
612  int rv;
613  pthread_attr_t thread_attr;
614  size_t ts_size;
615  pthread_t master_reader_th;
616 
617  rv = pthread_attr_init (&thread_attr);
618  if (rv != 0)
619  {
622  }
623 
624  rv = pthread_attr_setdetachstate (&thread_attr, PTHREAD_CREATE_DETACHED);
625  if (rv != 0)
626  {
629  }
630 
631 #if defined(AIX)
632  /* AIX's pthread is slightly different from other systems. Its performance highly depends on the pthread's scope and
633  * it's related kernel parameters. */
634  rv =
635  pthread_attr_setscope (&thread_attr,
636  prm_get_bool_value (PRM_ID_PTHREAD_SCOPE_PROCESS) ? PTHREAD_SCOPE_PROCESS :
637  PTHREAD_SCOPE_SYSTEM);
638 #else /* AIX */
639  rv = pthread_attr_setscope (&thread_attr, PTHREAD_SCOPE_SYSTEM);
640 #endif /* AIX */
641  if (rv != 0)
642  {
645  }
646 
647 #if defined(_POSIX_THREAD_ATTR_STACKSIZE)
648  rv = pthread_attr_getstacksize (&thread_attr, &ts_size);
649  if (ts_size != (size_t) prm_get_bigint_value (PRM_ID_THREAD_STACKSIZE))
650  {
651  rv = pthread_attr_setstacksize (&thread_attr, prm_get_bigint_value (PRM_ID_THREAD_STACKSIZE));
652  if (rv != 0)
653  {
656  }
657  }
658 #endif /* _POSIX_THREAD_ATTR_STACKSIZE */
659 
660  rv = pthread_create (&master_reader_th, &thread_attr, hb_thread_master_reader, (void *) NULL);
661  if (rv != 0)
662  {
664  return ER_CSS_PTHREAD_CREATE;
665  }
666 
667  return (NO_ERROR);
668 #else
669  return ER_FAILED;
670 #endif
671 }
672 
673 /*
674 * hb_process_init () -
675 * return: NO_ERROR or ER_FAILED
676 *
677 * server_name(in):
678 * log_path(in):
679 * copylogdbyn(in):
680 */
681 int
682 hb_process_init (const char *server_name, const char *log_path, HB_PROC_TYPE type)
683 {
684 #if !defined(SERVER_MODE)
685  int error;
686  static bool is_first = true;
687 
688  if (is_first == false)
689  {
690  return (NO_ERROR);
691  }
692 
693  er_log_debug (ARG_FILE_LINE, "hb_process_init. (type:%s). \n", hb_type_to_str (type));
694 
695  if (hb_Exec_path[0] == '\0' || *(hb_Argv) == 0)
696  {
697  er_log_debug (ARG_FILE_LINE, "hb_Exec_path or hb_Argv is not set. \n");
698  return (ER_FAILED);
699  }
700 
701  hb_Conn = hb_connect_to_master (server_name, log_path, type);
702 
703  /* wait 1 sec */
704  sleep (1);
705 
706  error = hb_register_to_master (hb_Conn, type);
707  if (NO_ERROR != error)
708  {
709  er_log_debug (ARG_FILE_LINE, "hb_register_to_master failed. \n");
710  return (error);
711  }
712 
713  error = hb_create_master_reader ();
714  if (NO_ERROR != error)
715  {
716  er_log_debug (ARG_FILE_LINE, "hb_create_master_reader failed. \n");
717  return (error);
718  }
719 
720  is_first = false;
721  return (NO_ERROR);
722 #else
723  return (ER_FAILED);
724 #endif
725 }
726 
727 
728 /*
729 * hb_process_term () -
730 * return: none
731 *
732 * type(in):
733 */
734 void
736 {
737  if (hb_Conn)
738  {
739  css_shutdown_conn (hb_Conn);
740  hb_Conn = NULL;
741  }
742  hb_Proc_shutdown = true;
743 }
744 
745 /*
746  * hb_node_state_string -
747  * return: node state sring
748 *
749  * nstate(in):
750  */
751 const char *
753 {
754  switch (nstate)
755  {
756  case HB_NSTATE_UNKNOWN:
757  return HB_NSTATE_UNKNOWN_STR;
758  case HB_NSTATE_SLAVE:
759  return HB_NSTATE_SLAVE_STR;
764  case HB_NSTATE_MASTER:
765  return HB_NSTATE_MASTER_STR;
766  case HB_NSTATE_REPLICA:
767  return HB_NSTATE_REPLICA_STR;
768 
769  default:
770  return "invalid";
771  }
772 }
const char * envvar_root(void)
#define NO_ERROR
Definition: error_code.h:46
#define ER_CSS_PTHREAD_ATTR_SETDETACHSTATE
Definition: error_code.h:992
int SOCKET
Definition: porting.h:482
static THREAD_RET_T THREAD_CALLING_CONVENTION hb_thread_master_reader(void *arg)
Definition: heartbeat.c:253
static int hb_process_master_request_info(CSS_CONN_ENTRY *conn)
Definition: heartbeat.c:402
unsigned int htonl(unsigned int from)
#define ER_FAILED
Definition: error_code.h:47
int hb_deregister_from_master(void)
Definition: heartbeat.c:321
#define ER_CSS_PTHREAD_CREATE
Definition: error_code.h:995
SOCKET fd
int css_receive_heartbeat_request(CSS_CONN_ENTRY *conn, int *command)
Definition: heartbeat.c:202
void hb_set_exec_path(char *exec_path)
Definition: heartbeat.c:125
static pthread_t hb_Master_mon_th
Definition: heartbeat.c:87
int css_receive_heartbeat_data(CSS_CONN_ENTRY *conn, char *data, int size)
Definition: heartbeat.c:230
#define er_log_debug(...)
#define INVALID_SOCKET
Definition: porting.h:483
bool hb_Proc_shutdown
Definition: heartbeat.c:93
int css_platform_independent_poll(POLL_FD *fds, int num_of_fds, int timeout)
#define HB_NSTATE_TO_BE_MASTER_STR
Definition: heartbeat.h:99
void hb_set_argv(char **argv)
Definition: heartbeat.c:137
#define HB_PTYPE_SERVER_STR
Definition: heartbeat.h:68
int css_send_heartbeat_data(CSS_CONN_ENTRY *conn, const char *data, int size)
Definition: heartbeat.c:178
UINT64 prm_get_bigint_value(PARAM_ID prm_id)
#define THREAD_RET_T
Definition: porting.h:713
void er_set(int severity, const char *file_name, const int line_no, int err_id, int num_args,...)
SOCKET hb_Pipe_to_master
Definition: heartbeat.c:95
#define assert(x)
int prm_get_integer_value(PARAM_ID prm_id)
#define HB_NSTATE_MASTER_STR
Definition: heartbeat.h:101
#define ER_OUT_OF_VIRTUAL_MEMORY
Definition: error_code.h:50
void css_shutdown_conn(CSS_CONN_ENTRY *conn)
#define ER_CSS_PTHREAD_ATTR_SETSCOPE
Definition: error_code.h:993
int prm_get_master_port_id(void)
#define IS_INVALID_SOCKET(socket)
Definition: porting.h:484
#define HB_NSTATE_UNKNOWN_STR
Definition: heartbeat.h:97
static int rv
Definition: area_alloc.c:52
enum hb_proc_type HB_PROC_TYPE
Definition: heartbeat.h:67
#define NULL
Definition: freelistheap.h:34
#define strncpy_bufsize(buf, str)
Definition: porting.h:340
pid_t pid
Definition: dynamic_load.c:955
static char * hb_pack_server_name(const char *server_name, int *name_length, const char *log_path, HB_PROC_TYPE type)
Definition: heartbeat.c:510
#define HB_NSTATE_TO_BE_SLAVE_STR
Definition: heartbeat.h:100
int hb_process_init(const char *server_name, const char *log_path, HB_PROC_TYPE type)
Definition: heartbeat.c:682
void er_set_with_oserror(int severity, const char *file_name, const int line_no, int err_id, int num_args,...)
#define ER_CSS_PTHREAD_ATTR_INIT
Definition: error_code.h:990
int css_send_heartbeat_request(CSS_CONN_ENTRY *conn, int command)
Definition: heartbeat.c:151
CSS_CONN_ENTRY * css_connect_to_master_server(int master_port_id, const char *server_name, int name_length)
static void error(const char *msg)
Definition: gencat.c:331
static int rc
Definition: serial.c:50
int css_readn(SOCKET fd, char *ptr, int nbytes, int timeout)
#define HB_NSTATE_SLAVE_STR
Definition: heartbeat.h:98
#define ARG_FILE_LINE
Definition: error_manager.h:44
static int hb_create_master_reader(void)
Definition: heartbeat.c:609
#define HB_NSTATE_REPLICA_STR
Definition: heartbeat.h:102
enum HB_NODE_STATE HB_NODE_STATE_TYPE
Definition: heartbeat.h:106
static char hb_Exec_path[PATH_MAX]
Definition: heartbeat.c:90
const char ** argv
Definition: dynamic_load.c:952
const char * hb_process_type_string(int ptype)
Definition: heartbeat.c:104
#define free_and_init(ptr)
Definition: memory_alloc.h:147
#define strlen(s1)
Definition: intl_support.c:43
static HBP_PROC_REGISTER * hb_make_set_hbp_register(int type)
Definition: heartbeat.c:286
bool prm_get_bool_value(PARAM_ID prm_id)
int hb_register_to_master(CSS_CONN_ENTRY *conn, int type)
Definition: heartbeat.c:355
int hb_process_master_request(void)
Definition: heartbeat.c:447
#define ER_CSS_PTHREAD_ATTR_SETSTACKSIZE
Definition: error_code.h:994
unsigned int ntohl(unsigned int from)
static CSS_CONN_ENTRY * hb_connect_to_master(const char *server_name, const char *log_path, HB_PROC_TYPE type)
Definition: heartbeat.c:579
#define HB_PTYPE_APPLYLOGDB_STR
Definition: heartbeat.h:70
static CSS_CONN_ENTRY * hb_Conn
Definition: heartbeat.c:89
static char ** hb_Argv
Definition: heartbeat.c:91
char exec_path[HB_MAX_SZ_PROC_EXEC_PATH]
Definition: heartbeat.h:142
static const char * hb_type_to_str(HB_PROC_TYPE type)
Definition: heartbeat.c:424
void hb_process_term(void)
Definition: heartbeat.c:735
const char ** p
Definition: dynamic_load.c:945
const char * hb_node_state_string(HB_NODE_STATE_TYPE nstate)
Definition: heartbeat.c:752
#define THREAD_CALLING_CONVENTION
Definition: porting.h:714
#define HB_PTYPE_COPYLOGDB_STR
Definition: heartbeat.h:69
const char * rel_major_release_string(void)
char args[HB_MAX_SZ_PROC_ARGS]
Definition: heartbeat.h:143