MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DblqhCommon.hpp
1 /* Copyright (C) 2008 MySQL AB, 2008 Sun Microsystems, Inc.
2  All rights reserved. Use is subject to license terms.
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; version 2 of the License.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
16 
17 #ifndef DBLQH_COMMON_H
18 #define DBLQH_COMMON_H
19 
20 #include <pc.hpp>
21 #include <ndb_types.h>
22 #include <Bitmask.hpp>
23 
24 /*
25  * Log part id is from DBDIH. Number of log parts is fixed as 4.
26  * A log part is identified by log part number (0-3)
27  *
28  * log part number = log part id % 4
29  *
30  * Currently instance key (1-4) is
31  *
32  * instance key = 1 + log part number
33  *
34  * This may change, and the code (except this file) must not assume
35  * any connection between log part number and instance key.
36  *
37  * Following structure computes log part info for a specific LQH
38  * instance (main instance 0 or worker instances 1-4).
39  */
41  enum { LogParts = 4 };
42  NdbLogPartInfo(Uint32 instanceNo);
43  Uint32 lqhWorkers;
44  Uint32 partCount;
45  Uint16 partNo[LogParts];
46  Bitmask<(LogParts+31)/32> partMask;
47  Uint32 partNoFromId(Uint32 lpid) const;
48  bool partNoOwner(Uint32 lpno) const;
49  bool partNoOwner(Uint32 tabId, Uint32 fragId);
50  Uint32 partNoIndex(Uint32 lpno) const;
51  Uint32 instanceKey(Uint32 lpno) const;
52 };
53 
54 #endif