Commit 267407e4 authored by unknown's avatar unknown
Browse files

Merge marko@bk-internal.mysql.com:/home/bk/mysql-4.1

into hundin.mysql.fi:/home/marko/k/mysql-4.1

parents b712a1a7 05862273
Loading
Loading
Loading
Loading
+0 −18
Original line number Diff line number Diff line
@@ -1599,11 +1599,6 @@ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [
      ;;
  esac

  AC_ARG_WITH([ndb-shm],
              [
  --with-ndb-shm        Include the NDB Cluster shared memory transporter],
              [ndb_shm="$withval"],
              [ndb_shm=no])
  AC_ARG_WITH([ndb-test],
              [
  --with-ndb-test       Include the NDB Cluster ndbapi test programs],
@@ -1633,19 +1628,6 @@ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [
  AC_MSG_CHECKING([for NDB Cluster options])
  AC_MSG_RESULT([])
                                                                                
  have_ndb_shm=no
  case "$ndb_shm" in
    yes )
      AC_MSG_RESULT([-- including shared memory transporter])
      AC_DEFINE([NDB_SHM_TRANSPORTER], [1],
                [Including Ndb Cluster DB shared memory transporter])
      have_ndb_shm="yes"
      ;;
    * )
      AC_MSG_RESULT([-- not including shared memory transporter])
      ;;
  esac

  have_ndb_test=no
  case "$ndb_test" in
    yes )
+15 −4
Original line number Diff line number Diff line
@@ -1923,7 +1923,9 @@ AC_CHECK_FUNCS(alarm bcmp bfill bmove bzero chsize cuserid fchmod fcntl \
  pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \
  pthread_key_delete pthread_rwlock_rdlock pthread_setprio \
  pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
  realpath rename rint rwlock_init setupterm sighold sigset sigthreadmask \
  realpath rename rint rwlock_init setupterm \
  shmget shmat shmdt shmctl \
  sighold sigset sigthreadmask \
  snprintf socket stpcpy strcasecmp strerror strnlen strpbrk strstr strtol \
  strtoll strtoul strtoull tell tempnam thr_setconcurrency vidattr)

@@ -3078,10 +3080,19 @@ fi
AC_SUBST([ndb_port_base])

ndb_transporter_opt_objs=""
if test X"$have_ndb_shm" = Xyes
then
if test "$ac_cv_func_shmget" = "yes" &&
   test "$ac_cv_func_shmat" = "yes" &&
   test "$ac_cv_func_shmdt" = "yes" &&
   test "$ac_cv_func_shmctl" = "yes"
then
   AC_DEFINE([NDB_SHM_TRANSPORTER], [1],
             [Including Ndb Cluster DB shared memory transporter])
   AC_MSG_RESULT([Including ndb shared memory transporter])
   ndb_transporter_opt_objs="$ndb_transporter_opt_objs SHM_Transporter.lo SHM_Transporter.unix.lo"
else
   AC_MSG_RESULT([Not including ndb shared memory transporter])
fi

if test X"$have_ndb_sci" = Xyes
then
  ndb_transporter_opt_objs="$ndb_transporter_opt_objs SCI_Transporter.lo"
+1 −0
Original line number Diff line number Diff line
@@ -110,6 +110,7 @@
#define CFG_CONNECTION_SERVER_PORT    406
#define CFG_CONNECTION_HOSTNAME_1     407
#define CFG_CONNECTION_HOSTNAME_2     408
#define CFG_CONNECTION_GROUP          409

#define CFG_TCP_SERVER                452
#define CFG_TCP_SEND_BUFFER_SIZE      454
+0 −83
Original line number Diff line number Diff line
@@ -901,23 +901,6 @@ typedef void (* NdbEventCallback)(NdbEventOperation*, Ndb*, void*);
                                      NDB_MAX_SCHEMA_NAME_SIZE + \
                                      NDB_MAX_TAB_NAME_SIZE*2

#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
class NdbWaiter {
public:
  NdbWaiter();
  ~NdbWaiter();

  void wait(int waitTime);
  void nodeFail(Uint32 node);
  void signal(Uint32 state);

  Uint32 m_node;
  Uint32 m_state;
  void * m_mutex;
  struct NdbCondition * m_condition;  
};
#endif

/**
 * @class Ndb 
 * @brief Represents the NDB kernel and is the main class of the NDB API.
@@ -1199,39 +1182,6 @@ public:
				  const char *  keyData = 0, 
				  Uint32        keyLen = 0);

#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
  /**
   * This method is a modification of Ndb::startTransaction, 
   * in which we use only the first two chars of keyData to 
   * select transaction coordinator.
   * This is referred to as a distribution group. 
   * There are two ways to use the method: 
   * - In the first, the two characters are used directly as 
   *   the distribution key, and 
   * - in the second the distribution is calculated as:
   *   (10 * (char[0] - 0x30) + (char[1] - 0x30)). 
   *   Thus, in the second way, the two ASCII digits '78' 
   *   will provide the distribution key = 78.
   *
   * @note Transaction priorities are not yet supported.
   *
   * @param aPrio   Priority of the transaction.<br>
   * 	Priority 0 is the highest priority and is used for short transactions 
   *      with requirements on low delay.<br>
   * 	Priority 1 is a medium priority for short transactions.<br>
   * 	Priority 2 is a medium priority for long transactions.<br>
   * 	Priority 3 is a low priority for long transactions.
   * @param keyData is a string of which the two first characters 
   *        is used to compute which fragement the data is stored in.
   * @param type is the type of distribution group.<br> 
   *        0 means direct usage of the two characters, and<br>
   *        1 means the ASCII digit variant.
   * @return NdbConnection, or NULL if it failed.
   */
  NdbConnection* startTransactionDGroup(Uint32 aPrio, 
					const char * keyData, int type);
#endif

  /**
   * When a transactions is completed, the transaction has to be closed.
   *
@@ -1586,8 +1536,6 @@ private:
/******************************************************************************
 *	These are the private variables in this class.	
 *****************************************************************************/
  Ndb_cluster_connection   *m_ndb_cluster_connection;

  NdbConnection**       thePreparedTransactionsArray;
  NdbConnection**       theSentTransactionsArray;
  NdbConnection**       theCompletedTransactionsArray;
@@ -1601,8 +1549,6 @@ private:

  Uint32                theNextConnectNode;

  NdbWaiter             theWaiter;
  
  bool fullyQualifiedNames;

  // Ndb database name.
@@ -1658,35 +1604,6 @@ private:
    InitConfigError
  } theInitState;

  /**
   * Computes fragement id for primary key
   *
   * Note that keydata has to be "shaped" as it is being sent in KEYINFO
   */
  Uint32 computeFragmentId(const char * keyData, Uint32 keyLen);
  Uint32 getFragmentId(Uint32 hashValue);
  
  /**
   * Make a guess to which node is the primary for the fragment
   */
  Uint32 guessPrimaryNode(Uint32 fragmentId);
  
  /**
   * Structure containing values for guessing primary node
   */
  struct StartTransactionNodeSelectionData {
    StartTransactionNodeSelectionData():
      fragment2PrimaryNodeMap(0) {};
    Uint32 kValue;
    Uint32 hashValueMask;
    Uint32 hashpointerValue;
    Uint32 noOfFragments;
    Uint32 * fragment2PrimaryNodeMap;
    
    void init(Uint32 noOfNodes, Uint8 nodeIds[]);
    void release();
  } startTransactionNodeSelectionData;
  
  NdbApiSignal* theCommitAckSignal;


+18 −13
Original line number Diff line number Diff line
@@ -18,13 +18,7 @@
#ifndef CLUSTER_CONNECTION_HPP
#define CLUSTER_CONNECTION_HPP

class TransporterFacade;
class ConfigRetriever;
struct NdbThread;

extern "C" {
  void* run_ndb_cluster_connection_connect_thread(void*);
}
struct Ndb_cluster_connection_node_iter;

class Ndb_cluster_connection {
public:
@@ -32,16 +26,27 @@ public:
  ~Ndb_cluster_connection();
  int connect(int no_retries, int retry_delay_in_seconds, int verbose);
  int start_connect_thread(int (*connect_callback)(void)= 0);

  // add check coupled to init state of cluster connection
  // timeout_after_first_alive negative - ok only if all alive
  // timeout_after_first_alive positive - ok if some alive
  int wait_until_ready(int timeout_for_first_alive,
		       int timeout_after_first_alive);

  const char *get_connectstring(char *buf, int buf_sz) const;
  int get_connected_port() const;
  const char *get_connected_host() const;

  void set_optimized_node_selection(int val);

  Uint32 no_db_nodes();

private:
  friend void* run_ndb_cluster_connection_connect_thread(void*);
  void connect_thread();
  TransporterFacade *m_facade;
  ConfigRetriever *m_config_retriever;
  NdbThread *m_connect_thread;
  int (*m_connect_callback)(void);
  friend class Ndb;
  friend class NdbImpl;
  friend class Ndb_cluster_connection_impl;
  class Ndb_cluster_connection_impl & m_impl;
  Ndb_cluster_connection(Ndb_cluster_connection_impl&);
};

#endif
Loading