Commit 2dc4e170 authored by unknown's avatar unknown
Browse files

Merge clam.ndb.mysql.com:/space/pekka/ndb/version/my50-bug18781

into  clam.ndb.mysql.com:/space/pekka/ndb/version/my51-bug18781


storage/ndb/include/ndb_version.h.in:
  manual merge
storage/ndb/include/kernel/GlobalSignalNumbers.h:
  manual merge
storage/ndb/include/kernel/signaldata/AlterTable.hpp:
  SCCS merged
storage/ndb/include/kernel/signaldata/CreateTable.hpp:
  SCCS merged
storage/ndb/include/kernel/signaldata/DropTable.hpp:
  SCCS merged
storage/ndb/src/common/debugger/SignalLoggerManager.cpp:
  SCCS merged
storage/ndb/src/common/debugger/signaldata/SignalNames.cpp:
  manual merge
storage/ndb/src/kernel/main.cpp:
  SCCS merged
storage/ndb/src/kernel/blocks/ERROR_codes.txt:
  SCCS merged
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
  manual merge
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
  manual merge
storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp:
  manual merge
storage/ndb/src/kernel/blocks/dbdih/DbdihInit.cpp:
  SCCS merged
storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
  manual merge
storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp:
  SCCS merged
storage/ndb/src/kernel/vm/DLFifoList.hpp:
  use local
storage/ndb/src/kernel/vm/pc.hpp:
  SCCS merged
storage/ndb/src/ndbapi/ndberror.c:
  use local - add 711 later
storage/ndb/test/ndbapi/testDict.cpp:
  SCCS merged
parents 1b3ffa03 a182963c
Loading
Loading
Loading
Loading
+78 −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 DICT_LOCK_HPP
#define DICT_LOCK_HPP

#include "SignalData.hpp"

// see comments in Dbdict.hpp

class DictLockReq {
  friend class Dbdict;
  friend class Dbdih;
public:
  STATIC_CONST( SignalLength = 3 );
  enum LockType {
    NoLock = 0,
    NodeRestartLock = 1
  };
private:
  Uint32 userPtr;
  Uint32 lockType;
  Uint32 userRef;
};

class DictLockConf {
  friend class Dbdict;
  friend class Dbdih;
public:
  STATIC_CONST( SignalLength = 3 );
private:
  Uint32 userPtr;
  Uint32 lockType;
  Uint32 lockPtr;
};

class DictLockRef {
  friend class Dbdict;
  friend class Dbdih;
public:
  STATIC_CONST( SignalLength = 3 );
  enum ErrorCode {
    NotMaster = 1,
    InvalidLockType = 2,
    BadUserRef = 3,
    TooLate = 4,
    TooManyRequests = 5
  };
private:
  Uint32 userPtr;
  Uint32 lockType;
  Uint32 errorCode;
};

class DictUnlockOrd {
  friend class Dbdict;
  friend class Dbdih;
public:
  STATIC_CONST( SignalLength = 2 );
private:
  Uint32 lockPtr;
  Uint32 lockType;
};

#endif
+94 −0
Original line number Diff line number Diff line
Lock master DICT against schema operations

Implementation
--------------

[ see comments in Dbdict.hpp ]

Use case: Node startup INR / NR
-------------------------------

Master DICT (like any block) keeps list of alive nodes (c_aliveNodes).
These are participants in schema ops.

(1) c_aliveNodes is initialized when DICT starts
    in sp3 in READ_NODESCONF from CNTR

(2) when slave node fails (in any sp of the slave node)
    it is removed from c_aliveNodes in NODE_FAILREP

(3) when slave starts, it is added to c_aliveNodes
    in sp4 of the starting node in INCL_NODEREQ

Slave DIH locks master DICT in sp2 and releases the lock when started.
Based on the constraints:

- the lock is taken when master DICT is known
  DIH reads this in sp2 in READ_NODESCONF

- the lock is taken before (3)

- the lock is taken before copying starts and held until it is done
  in sp4 DIH meta, DICT meta, tuple data

- on INR in sp2 in START_PERMREQ the LCP info of the slave is erased
  in all DIH in invalidateNodeLCP() - not safe under schema ops

Signals:

All but DICT_LOCK are standard v5.0 signals.
s=starting node, m=master, a=all participants, l=local block.

* sp2 - DICT_LOCK and START_PERM

DIH/s
    DICT_LOCK_REQ
        DICT/m
    DICT_LOCK_CONF
DIH/s
    START_PERMREQ
        DIH/m
            START_INFOREQ
                DIH/a
                    invalidateNodeLCP() if INR
                DIH/a
            START_INFOCONF
        DIH/m
    START_PERMCONF
DIH/s

* sp4 - START_ME (copy metadata, no changes)

DIH/s
    START_MEREQ
        DIH/m
            COPY_TABREQ
                DIH/s
            COPY_TABCONF
        DIH/m
            DICTSTARTREQ
                DICT/s
                    GET_SCHEMA_INFOREQ
                        DICT/m
                    SCHEMA_INFO
                DICT/s
            DICTSTARTCONF
        DIH/m
            INCL_NODEREQ
                DIH/a
                    INCL_NODEREQ
                        ANY/l
                    INCL_NODECONF
                DIH/a
            INCL_NODECONF
        DIH/m
    START_MECONF
DIH/s

* sp7 - release DICT lock

DIH/s
    DICT_UNLOCK_ORD
        DICT/m

# vim: set et sw=4:
+6 −4
Original line number Diff line number Diff line
@@ -517,16 +517,12 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
#define GSN_TEST_ORD                    407
#define GSN_TESTSIG                     408
#define GSN_TIME_SIGNAL                 409
/* 410 unused  */
/* 411 unused  */
/* 412 unused */
#define GSN_TUP_ABORTREQ                414
#define GSN_TUP_ADD_ATTCONF             415
#define GSN_TUP_ADD_ATTRREF             416
#define GSN_TUP_ADD_ATTRREQ             417
#define GSN_TUP_ATTRINFO                418
#define GSN_TUP_COMMITREQ               419
/* 420 unused */

/* 421 unused */
/* 422 unused */
@@ -981,4 +977,10 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
#define GSN_DICT_ABORT_REF              668
#define GSN_DICT_ABORT_CONF             669

/* DICT LOCK signals */
#define GSN_DICT_LOCK_REQ               410
#define GSN_DICT_LOCK_CONF              411
#define GSN_DICT_LOCK_REF               412
#define GSN_DICT_UNLOCK_ORD             420

#endif
+1 −0
Original line number Diff line number Diff line
@@ -196,6 +196,7 @@ public:
    InvalidTableVersion = 241,
    DropInProgress      = 283,
    Busy = 701,
    BusyWithNR = 711,
    NotMaster = 702,
    InvalidFormat = 703,
    AttributeNameTooLong = 704,
+1 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ public:
  enum ErrorCode {
    NoError = 0,
    Busy = 701,
    BusyWithNR = 711,
    NotMaster = 702,
    InvalidFormat = 703,
    AttributeNameTooLong = 704,
Loading