Commit df7bb879 authored by unknown's avatar unknown
Browse files

Bug#8167 signal usage clash between mysql server and ndb shared memory

    added shared memory config parameter, signum for use in signalling
    added global variable for holdign signum to be used for shared memory connection
    only fiddle with signals if it is set
    simplified common ndb client option handling


ndb/include/Makefile.am:
  added common defaults file
ndb/include/mgmapi/mgmapi_config_parameters.h:
  added shared memory config parameter, signum for use in signalling
ndb/include/transporter/TransporterDefinitions.hpp:
  added shared memory config parameter, signum for use in signalling
ndb/include/util/ndb_opts.h:
  simplified common ndb client option handling
ndb/src/common/mgmcommon/IPCConfig.cpp:
  added shared memory config parameter, signum for use in signalling
ndb/src/common/portlib/NdbThread.c:
  added global variable for holdign signum to be used for shared memory connection
  only block signals if shared memory is used
ndb/src/common/transporter/SHM_Transporter.cpp:
  use signum in new global variable for shared memory signalling
ndb/src/common/transporter/TransporterRegistry.cpp:
  use signum in new global variable for shared memory signalling
  only fiddle with signals if it is set
ndb/src/cw/cpcd/main.cpp:
  ndb_opts not really used
ndb/src/kernel/vm/Configuration.cpp:
  simplified common ndb client option handling
ndb/src/mgmclient/main.cpp:
  simplified common ndb client option handling
ndb/src/mgmsrv/ConfigInfo.cpp:
  added shared memory config parameter, signum for use in signalling
ndb/src/mgmsrv/main.cpp:
  simplified common ndb client option handling
ndb/tools/delete_all.cpp:
  simplified common ndb client option handling
ndb/tools/desc.cpp:
  simplified common ndb client option handling
ndb/tools/drop_index.cpp:
  simplified common ndb client option handling
ndb/tools/drop_tab.cpp:
  simplified common ndb client option handling
ndb/tools/listTables.cpp:
  simplified common ndb client option handling
ndb/tools/restore/restore_main.cpp:
  simplified common ndb client option handling
ndb/tools/select_all.cpp:
  simplified common ndb client option handling
ndb/tools/select_count.cpp:
  simplified common ndb client option handling
ndb/tools/waiter.cpp:
  simplified common ndb client option handling
parent a271a6c8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ ndb_version.h

ndbapiinclude_HEADERS = \
ndbapi/ndbapi_limits.h \
ndbapi/ndb_opt_defaults.h \
ndbapi/Ndb.hpp \
ndbapi/NdbApi.hpp \
ndbapi/NdbConnection.hpp \
+1 −0
Original line number Diff line number Diff line
@@ -121,6 +121,7 @@
#define CFG_SHM_CHECKSUM              501
#define CFG_SHM_KEY                   502
#define CFG_SHM_BUFFER_MEM            503
#define CFG_SHM_SIGNUM                504

#define CFG_SCI_HOST1_ID_0            550
#define CFG_SCI_HOST1_ID_1            551
+27 −0
Original line number Diff line number Diff line
/* Copyright (C) 2003 MySQL AB

   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; either version 2 of the License, or
   (at your option) any later version.

   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

#ifndef NDB_OPT_DEFAULTS_H
#define NDB_OPT_DEFAULTS_H

#ifdef SIGRTMIN
#define OPT_NDB_SHM_SIGNUM_DEFAULT SIGRTMIN+2
#else
#define OPT_NDB_SHM_SIGNUM_DEFAULT 0
#endif
#define OPT_NDB_SHM_DEFAULT 0

#endif
+1 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ struct SHM_TransporterConfiguration {
  
  Uint32 shmKey;
  Uint32 shmSize;
  int    signum;
};

/**
+49 −10
Original line number Diff line number Diff line
@@ -22,24 +22,16 @@
#include <my_getopt.h>
#include <mysql_version.h>
#include <ndb_version.h>
#include <ndb_opt_defaults.h>

#define NDB_STD_OPTS_VARS \
const char *opt_connect_str= 0;\
my_bool opt_ndb_shm;\
my_bool	opt_ndb_optimized_node_selection

#define NDB_STD_OPTS_OPTIONS \
OPT_NDB_SHM= 256,\
OPT_NDB_OPTIMIZED_NODE_SELECTION
my_bool opt_ndb_shm;

#define OPT_NDB_CONNECTSTRING 'c'

#if defined(NDB_SHM_TRANSPORTER) && MYSQL_VERSION_ID >= 50000
#define OPT_NDB_SHM_DEFAULT 1
#else
#define OPT_NDB_SHM_DEFAULT 0
#endif

#define NDB_STD_OPTS_COMMON \
  { "usage", '?', "Display this help and exit.", \
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \
@@ -75,4 +67,51 @@ OPT_NDB_OPTIMIZED_NODE_SELECTION
#define NDB_STD_OPTS(prog_name) NDB_STD_OPTS_COMMON
#endif

static void ndb_std_print_version()
{
  printf("MySQL distrib %s, for %s (%s)\n",
	 MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}

static void usage();

enum ndb_std_options {
  OPT_NDB_SHM= 256,
  OPT_NDB_SHM_SIGNUM,
  OPT_NDB_OPTIMIZED_NODE_SELECTION,
  NDB_STD_OPTIONS_LAST /* should always be last in this enum */
};

static my_bool
ndb_std_get_one_option(int optid,
		       const struct my_option *opt __attribute__((unused)),
		       const char *argument)
{
  switch (optid) {
  case '#':
    if (argument)
    {
      DBUG_PUSH(argument);
    }
    break;
  case 'V':
    ndb_std_print_version();
    exit(0);
  case '?':
    usage();
    exit(0);
  case OPT_NDB_SHM:
    if (opt_ndb_shm)
    {
#ifndef NDB_SHM_TRANSPORTER
      printf("Warning: binary not compiled with shared memory support,\n"
	     "Tcp connections will now be used instead\n");
      opt_ndb_shm= 0;
#endif
    }
    break;
  }
  return 0;
}

#endif /*_NDB_OPTS_H */
Loading