Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
89415d27
Commit
89415d27
authored
May 18, 2005
by
msvensson@neptunus.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
e7c62822
2d515425
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
197 additions
and
185 deletions
+197
-185
mysys/thr_alarm.c
mysys/thr_alarm.c
+1
-0
ndb/include/kernel/ndb_limits.h
ndb/include/kernel/ndb_limits.h
+3
-1
ndb/include/kernel/signaldata/GetTabInfo.hpp
ndb/include/kernel/signaldata/GetTabInfo.hpp
+12
-20
ndb/include/ndbapi/Ndb.hpp
ndb/include/ndbapi/Ndb.hpp
+1
-10
ndb/include/ndbapi/ndbapi_limits.h
ndb/include/ndbapi/ndbapi_limits.h
+0
-4
ndb/src/common/transporter/Packer.cpp
ndb/src/common/transporter/Packer.cpp
+1
-0
ndb/src/ndbapi/Ndb.cpp
ndb/src/ndbapi/Ndb.cpp
+18
-36
ndb/src/ndbapi/NdbDictionaryImpl.cpp
ndb/src/ndbapi/NdbDictionaryImpl.cpp
+96
-71
ndb/src/ndbapi/NdbDictionaryImpl.hpp
ndb/src/ndbapi/NdbDictionaryImpl.hpp
+7
-5
ndb/src/ndbapi/NdbImpl.hpp
ndb/src/ndbapi/NdbImpl.hpp
+31
-0
ndb/src/ndbapi/Ndbinit.cpp
ndb/src/ndbapi/Ndbinit.cpp
+4
-12
ndb/src/ndbapi/ndb_cluster_connection.cpp
ndb/src/ndbapi/ndb_cluster_connection.cpp
+16
-8
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+5
-17
sql/opt_range.cc
sql/opt_range.cc
+2
-1
No files found.
mysys/thr_alarm.c
View file @
89415d27
...
...
@@ -85,6 +85,7 @@ void init_thr_alarm(uint max_alarms)
#else
{
struct
sigaction
sact
;
sact
.
sa_flags
=
0
;
bzero
((
char
*
)
&
sact
,
sizeof
(
sact
));
sact
.
sa_handler
=
thread_alarm
;
sigaction
(
THR_CLIENT_ALARM
,
&
sact
,
(
struct
sigaction
*
)
0
);
...
...
ndb/include/kernel/ndb_limits.h
View file @
89415d27
...
...
@@ -17,6 +17,8 @@
#ifndef NDB_LIMITS_H
#define NDB_LIMITS_H
#include <mysql.h>
#define RNIL 0xffffff00
/**
...
...
@@ -52,7 +54,7 @@
#define MAX_TUPLES_BITS 13
/* 13 bits = 8191 tuples per page */
#define MAX_TABLES 20320
/* SchemaFile.hpp */
#define MAX_TAB_NAME_SIZE 128
#define MAX_ATTR_NAME_SIZE
32
#define MAX_ATTR_NAME_SIZE
NAME_LEN
/* From mysql_com.h */
#define MAX_ATTR_DEFAULT_VALUE_SIZE 128
#define MAX_ATTRIBUTES_IN_TABLE 128
#define MAX_ATTRIBUTES_IN_INDEX 32
...
...
ndb/include/kernel/signaldata/GetTabInfo.hpp
View file @
89415d27
...
...
@@ -39,23 +39,16 @@ class GetTabInfoReq {
friend
bool
printGET_TABINFO_REQ
(
FILE
*
,
const
Uint32
*
,
Uint32
,
Uint16
);
public:
STATIC_CONST
(
SignalLength
=
5
);
// STATIC_CONST( MaxTableNameLengthInWords = 20 );
public:
Uint32
senderData
;
Uint32
senderData
;
Uint32
senderRef
;
/**
* 0 = request by id, 1 = request by name
*/
Uint32
requestType
;
Uint32
requestType
;
// Bitmask of GetTabInfoReq::RequestType
union
{
Uint32
tableId
;
Uint32
tableId
;
Uint32
tableNameLen
;
};
Uint32
unused
;
// This is located here so that Req & Ref have the same format
// Uint32 tableName[MaxTableNameLengthInWords];
enum
RequestType
{
RequestById
=
0
,
RequestByName
=
1
,
...
...
@@ -79,22 +72,21 @@ class GetTabInfoRef {
friend
bool
printGET_TABINFO_REF
(
FILE
*
,
const
Uint32
*
,
Uint32
,
Uint16
);
public:
STATIC_CONST
(
SignalLength
=
5
);
public:
Uint32
senderData
;
Uint32
senderData
;
Uint32
senderRef
;
Uint32
requestType
;
//
0 = request by id, 1 = request by nam
e
Uint32
requestType
;
//
Bitmask of GetTabInfoReq::RequestTyp
e
union
{
Uint32
tableId
;
Uint32
tableId
;
Uint32
tableNameLen
;
};
Uint32
errorCode
;
Uint32
errorCode
;
enum
ErrorCode
{
InvalidTableId
=
709
,
InvalidTableId
=
709
,
TableNotDefined
=
723
,
TableNameTooLong
=
702
,
Busy
=
701
Busy
=
701
};
};
...
...
@@ -114,10 +106,10 @@ class GetTabInfoConf {
friend
bool
printGET_TABINFO_CONF
(
FILE
*
,
const
Uint32
*
,
Uint32
,
Uint16
);
public:
STATIC_CONST
(
SignalLength
=
4
);
SECTION
(
DICT_TAB_INFO
=
0
);
public:
Uint32
senderData
;
Uint32
senderData
;
Uint32
tableId
;
Uint32
gci
;
// For table
Uint32
totalLen
;
// In words
...
...
ndb/include/ndbapi/Ndb.hpp
View file @
89415d27
...
...
@@ -999,10 +999,6 @@ typedef void (* NdbEventCallback)(NdbEventOperation*, Ndb*, void*);
#define WAITFOR_RESPONSE_TIMEOUT 120000 // Milliseconds
#endif
#define NDB_MAX_INTERNAL_TABLE_LENGTH NDB_MAX_DATABASE_NAME_SIZE + \
NDB_MAX_SCHEMA_NAME_SIZE + \
NDB_MAX_TAB_NAME_SIZE*2
/**
* @class Ndb
* @brief Represents the NDB kernel and is the main class of the NDB API.
...
...
@@ -1626,12 +1622,7 @@ private:
bool
fullyQualifiedNames
;
// Ndb database name.
char
theDataBase
[
NDB_MAX_DATABASE_NAME_SIZE
];
// Ndb database schema name.
char
theDataBaseSchema
[
NDB_MAX_SCHEMA_NAME_SIZE
];
char
prefixName
[
NDB_MAX_INTERNAL_TABLE_LENGTH
];
char
*
prefixEnd
;
class
NdbImpl
*
theImpl
;
class
NdbDictionaryImpl
*
theDictionary
;
...
...
ndb/include/ndbapi/ndbapi_limits.h
View file @
89415d27
...
...
@@ -19,10 +19,6 @@
#define NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY 32
#define NDB_MAX_ATTRIBUTES_IN_INDEX NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY
#define NDB_MAX_DATABASE_NAME_SIZE 128
#define NDB_MAX_SCHEMA_NAME_SIZE 128
#define NDB_MAX_TAB_NAME_SIZE 128
#define NDB_MAX_ATTR_NAME_SIZE 32
#define NDB_MAX_ATTRIBUTES_IN_TABLE 128
#define NDB_MAX_TUPLE_SIZE_IN_WORDS 2013
...
...
ndb/src/common/transporter/Packer.cpp
View file @
89415d27
...
...
@@ -93,6 +93,7 @@ TransporterRegistry::unpack(Uint32 * readPtr,
signalHeader
.
theSendersSignalId
=
*
signalData
;
signalData
++
;
}
//if
signalHeader
.
theSignalId
=
~
0
;
Uint32
*
sectionPtr
=
signalData
+
signalHeader
.
theLength
;
Uint32
*
sectionData
=
sectionPtr
+
signalHeader
.
m_noOfSections
;
...
...
ndb/src/ndbapi/Ndb.cpp
View file @
89415d27
...
...
@@ -1041,39 +1041,31 @@ convertEndian(Uint32 Data)
}
const
char
*
Ndb
::
getCatalogName
()
const
{
return
the
DataBase
;
return
the
Impl
->
m_dbname
.
c_str
()
;
}
void
Ndb
::
setCatalogName
(
const
char
*
a_catalog_name
)
{
if
(
a_catalog_name
)
{
BaseString
::
snprintf
(
theDataBase
,
sizeof
(
theDataBase
),
"%s"
,
a_catalog_name
?
a_catalog_name
:
""
);
int
len
=
BaseString
::
snprintf
(
prefixName
,
sizeof
(
prefixName
),
"%s%c%s%c"
,
theDataBase
,
table_name_separator
,
theDataBaseSchema
,
table_name_separator
);
prefixEnd
=
prefixName
+
(
len
<
(
int
)
sizeof
(
prefixName
)
?
len
:
sizeof
(
prefixName
)
-
1
);
if
(
a_catalog_name
)
{
theImpl
->
m_dbname
.
assign
(
a_catalog_name
);
theImpl
->
update_prefix
();
}
}
const
char
*
Ndb
::
getSchemaName
()
const
{
return
the
DataBaseSchema
;
return
the
Impl
->
m_schemaname
.
c_str
()
;
}
void
Ndb
::
setSchemaName
(
const
char
*
a_schema_name
)
{
if
(
a_schema_name
)
{
BaseString
::
snprintf
(
theDataBaseSchema
,
sizeof
(
theDataBase
),
"%s"
,
a_schema_name
?
a_schema_name
:
""
);
int
len
=
BaseString
::
snprintf
(
prefixName
,
sizeof
(
prefixName
),
"%s%c%s%c"
,
theDataBase
,
table_name_separator
,
theDataBaseSchema
,
table_name_separator
);
prefixEnd
=
prefixName
+
(
len
<
(
int
)
sizeof
(
prefixName
)
?
len
:
sizeof
(
prefixName
)
-
1
);
theImpl
->
m_schemaname
.
assign
(
a_schema_name
);
theImpl
->
update_prefix
();
}
}
...
...
@@ -1153,10 +1145,8 @@ Ndb::externalizeIndexName(const char * internalIndexName)
const
char
*
Ndb
::
internalizeTableName
(
const
char
*
externalTableName
)
{
if
(
fullyQualifiedNames
)
{
strncpy
(
prefixEnd
,
externalTableName
,
NDB_MAX_TAB_NAME_SIZE
);
return
prefixName
;
}
if
(
fullyQualifiedNames
)
return
theImpl
->
internalize_table_name
(
externalTableName
);
else
return
externalTableName
;
}
...
...
@@ -1165,16 +1155,8 @@ const char *
Ndb
::
internalizeIndexName
(
const
NdbTableImpl
*
table
,
const
char
*
externalIndexName
)
{
if
(
fullyQualifiedNames
)
{
char
tableId
[
10
];
sprintf
(
tableId
,
"%d"
,
table
->
m_tableId
);
Uint32
tabIdLen
=
strlen
(
tableId
);
strncpy
(
prefixEnd
,
tableId
,
tabIdLen
);
prefixEnd
[
tabIdLen
]
=
table_name_separator
;
strncpy
(
prefixEnd
+
tabIdLen
+
1
,
externalIndexName
,
NDB_MAX_TAB_NAME_SIZE
);
return
prefixName
;
}
if
(
fullyQualifiedNames
)
return
theImpl
->
internalize_index_name
(
table
,
externalIndexName
);
else
return
externalIndexName
;
}
...
...
ndb/src/ndbapi/NdbDictionaryImpl.cpp
View file @
89415d27
...
...
@@ -172,6 +172,7 @@ NdbColumnImpl::init(Type t)
m_length
=
1
;
// legal
m_cs
=
NULL
;
break
;
default:
case
Undefined
:
assert
(
false
);
break
;
...
...
@@ -299,22 +300,25 @@ NdbTableImpl::~NdbTableImpl()
void
NdbTableImpl
::
init
(){
clearNewProperties
();
m_changeMask
=
0
;
m_tableId
=
RNIL
;
m_frm
.
clear
();
m_fragmentType
=
NdbDictionary
::
Object
::
FragAllSmall
;
m_logging
=
true
;
m_kvalue
=
6
;
m_minLoadFactor
=
78
;
m_maxLoadFactor
=
80
;
m_index
=
0
;
m_indexType
=
NdbDictionary
::
Index
::
Undefined
;
m_noOfKeys
=
0
;
m_noOfDistributionKeys
=
0
;
m_fragmentCount
=
0
;
m_keyLenInWords
=
0
;
m_noOfBlobs
=
0
;
m_fragmentType
=
NdbDictionary
::
Object
::
FragAllSmall
;
m_hashValueMask
=
0
;
m_hashpointerValue
=
0
;
m_logging
=
true
;
m_kvalue
=
6
;
m_minLoadFactor
=
78
;
m_maxLoadFactor
=
80
;
m_keyLenInWords
=
0
;
m_fragmentCount
=
0
;
m_dictionary
=
NULL
;
m_index
=
NULL
;
m_indexType
=
NdbDictionary
::
Index
::
Undefined
;
m_noOfKeys
=
0
;
m_noOfDistributionKeys
=
0
;
m_noOfBlobs
=
0
;
m_replicaCount
=
0
;
}
bool
...
...
@@ -428,19 +432,6 @@ NdbTableImpl::getName() const
return
m_newExternalName
.
c_str
();
}
void
NdbTableImpl
::
clearNewProperties
()
{
m_newExternalName
.
assign
(
""
);
m_changeMask
=
0
;
}
void
NdbTableImpl
::
copyNewProperties
()
{
if
(
!
m_newExternalName
.
empty
())
{
m_externalName
.
assign
(
m_newExternalName
);
AlterTableReq
::
setNameFlag
(
m_changeMask
,
true
);
}
}
void
NdbTableImpl
::
buildColumnHash
(){
...
...
@@ -537,14 +528,22 @@ NdbIndexImpl::NdbIndexImpl() :
NdbDictionary
::
Index
(
*
this
),
m_facade
(
this
)
{
m_logging
=
true
;
init
()
;
}
NdbIndexImpl
::
NdbIndexImpl
(
NdbDictionary
::
Index
&
f
)
:
NdbDictionary
::
Index
(
*
this
),
m_facade
(
&
f
)
{
m_logging
=
true
;
init
();
}
void
NdbIndexImpl
::
init
()
{
m_indexId
=
RNIL
;
m_type
=
NdbDictionary
::
Index
::
Undefined
;
m_logging
=
true
;
m_table
=
NULL
;
}
NdbIndexImpl
::~
NdbIndexImpl
(){
...
...
@@ -589,20 +588,26 @@ NdbEventImpl::NdbEventImpl() :
NdbDictionary
::
Event
(
*
this
),
m_facade
(
this
)
{
mi_type
=
0
;
m_dur
=
NdbDictionary
::
Event
::
ED_UNDEFINED
;
eventOp
=
NULL
;
m_tableImpl
=
NULL
;
init
();
}
NdbEventImpl
::
NdbEventImpl
(
NdbDictionary
::
Event
&
f
)
:
NdbDictionary
::
Event
(
*
this
),
m_facade
(
&
f
)
{
mi_type
=
0
;
m_dur
=
NdbDictionary
::
Event
::
ED_UNDEFINED
;
eventOp
=
NULL
;
m_tableImpl
=
NULL
;
init
();
}
void
NdbEventImpl
::
init
()
{
m_eventId
=
RNIL
;
m_eventKey
=
RNIL
;
m_tableId
=
RNIL
;
mi_type
=
0
;
m_dur
=
NdbDictionary
::
Event
::
ED_UNDEFINED
;
m_tableImpl
=
NULL
;
m_bufferId
=
RNIL
;
eventOp
=
NULL
;
}
NdbEventImpl
::~
NdbEventImpl
()
...
...
@@ -715,11 +720,13 @@ NdbDictionaryImpl::~NdbDictionaryImpl()
delete
NdbDictionary
::
Column
::
ROW_COUNT
;
delete
NdbDictionary
::
Column
::
COMMIT_COUNT
;
delete
NdbDictionary
::
Column
::
ROW_SIZE
;
delete
NdbDictionary
::
Column
::
RANGE_NO
;
NdbDictionary
::
Column
::
FRAGMENT
=
0
;
NdbDictionary
::
Column
::
FRAGMENT_MEMORY
=
0
;
NdbDictionary
::
Column
::
ROW_COUNT
=
0
;
NdbDictionary
::
Column
::
COMMIT_COUNT
=
0
;
NdbDictionary
::
Column
::
ROW_SIZE
=
0
;
NdbDictionary
::
Column
::
RANGE_NO
=
0
;
}
m_globalHash
->
unlock
();
}
else
{
...
...
@@ -1049,61 +1056,75 @@ NdbDictInterface::dictSignal(NdbApiSignal* signal,
DBUG_RETURN
(
-
1
);
}
/*****************************************************************
* get tab info
/*
Get dictionary information for a table using table id as reference
DESCRIPTION
Sends a GET_TABINFOREQ signal containing the table id
*/
NdbTableImpl
*
NdbTableImpl
*
NdbDictInterface
::
getTable
(
int
tableId
,
bool
fullyQualifiedNames
)
{
NdbApiSignal
tSignal
(
m_reference
);
GetTabInfoReq
*
const
req
=
CAST_PTR
(
GetTabInfoReq
,
tSignal
.
getDataPtrSend
());
GetTabInfoReq
*
const
req
=
CAST_PTR
(
GetTabInfoReq
,
tSignal
.
getDataPtrSend
());
req
->
senderRef
=
m_reference
;
req
->
senderData
=
0
;
req
->
requestType
=
req
->
requestType
=
GetTabInfoReq
::
RequestById
|
GetTabInfoReq
::
LongSignalConf
;
req
->
tableId
=
tableId
;
tSignal
.
theReceiversBlockNumber
=
DBDICT
;
tSignal
.
theVerId_signalNumber
=
GSN_GET_TABINFOREQ
;
tSignal
.
theLength
=
GetTabInfoReq
::
SignalLength
;
return
getTable
(
&
tSignal
,
0
,
0
,
fullyQualifiedNames
);
}
NdbTableImpl
*
/*
Get dictionary information for a table using table name as the reference
DESCRIPTION
Send GET_TABINFOREQ signal with the table name in the first
long section part
*/
NdbTableImpl
*
NdbDictInterface
::
getTable
(
const
char
*
name
,
bool
fullyQualifiedNames
)
{
NdbApiSignal
tSignal
(
m_reference
);
GetTabInfoReq
*
const
req
=
CAST_PTR
(
GetTabInfoReq
,
tSignal
.
getDataPtrSend
());
const
Uint32
strLen
=
strlen
(
name
)
+
1
;
// NULL Terminated
if
(
strLen
>
MAX_TAB_NAME_SIZE
)
{
//sizeof(req->tableName)){
m_error
.
code
=
4307
;
return
0
;
}
GetTabInfoReq
*
const
req
=
CAST_PTR
(
GetTabInfoReq
,
tSignal
.
getDataPtrSend
());
req
->
senderRef
=
m_reference
;
req
->
senderData
=
0
;
req
->
requestType
=
const
Uint32
str_len
=
strlen
(
name
)
+
1
;
// NULL terminated
/* Note! It might be a good idea to check that the length of
table name does not exceed the max size of a long signal */
m_namebuf
.
clear
();
m_namebuf
.
grow
(
str_len
+
(
4
-
str_len
%
4
));
// Round up to word size
m_namebuf
.
append
(
name
,
str_len
);
req
->
senderRef
=
m_reference
;
req
->
senderData
=
0
;
req
->
requestType
=
GetTabInfoReq
::
RequestByName
|
GetTabInfoReq
::
LongSignalConf
;
req
->
tableNameLen
=
strL
en
;
tSignal
.
theReceiversBlockNumber
=
DBDICT
;
tSignal
.
theVerId_signalNumber
=
GSN_GET_TABINFOREQ
;
// tSignal.theLength = GetTabInfoReq::HeaderLength + ((strLen + 3) / 4)
;
tSignal
.
theLength
=
GetTabInfoReq
::
SignalLength
;
req
->
tableNameLen
=
str_l
en
;
tSignal
.
theReceiversBlockNumber
=
DBDICT
;
tSignal
.
theVerId_signalNumber
=
GSN_GET_TABINFOREQ
;
tSignal
.
theLength
=
GetTabInfoReq
::
SignalLength
;
LinearSectionPtr
ptr
[
1
];
ptr
[
0
].
p
=
(
Uint32
*
)
name
;
ptr
[
0
].
sz
=
strLen
;
ptr
[
0
].
p
=
(
Uint32
*
)
m_namebuf
.
get_data
()
;
ptr
[
0
].
sz
=
(
str_len
+
3
)
/
4
;
// Size in words
return
getTable
(
&
tSignal
,
ptr
,
1
,
fullyQualifiedNames
);
}
NdbTableImpl
*
NdbDictInterface
::
getTable
(
class
NdbApiSignal
*
signal
,
NdbDictInterface
::
getTable
(
class
NdbApiSignal
*
signal
,
LinearSectionPtr
ptr
[
3
],
Uint32
noOfSections
,
bool
fullyQualifiedNames
)
{
//GetTabInfoReq * const req = CAST_PTR(GetTabInfoReq, signal->getDataPtrSend());
int
errCodes
[]
=
{
GetTabInfoRef
::
Busy
};
int
r
=
dictSignal
(
signal
,
ptr
,
noOfSections
,
...
...
@@ -1464,7 +1485,7 @@ NdbDictionaryImpl::createBlobTables(NdbTableImpl &t)
return
-
1
;
// Save BLOB table handle
Ndb_local_table_info
*
info
=
get_local_table_info
(
bt
.
m_internalName
.
c_str
(),
false
);
get_local_table_info
(
bt
.
m_internalName
.
c_str
(),
false
);
if
(
info
==
0
)
{
return
-
1
;
}
...
...
@@ -1560,7 +1581,11 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
DBUG_RETURN
(
-
1
);
}
impl
.
copyNewProperties
();
if
(
!
impl
.
m_newExternalName
.
empty
())
{
impl
.
m_externalName
.
assign
(
impl
.
m_newExternalName
);
AlterTableReq
::
setNameFlag
(
impl
.
m_changeMask
,
true
);
}
//validate();
//aggregate();
...
...
@@ -1677,7 +1702,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
NdbApiSignal
tSignal
(
m_reference
);
tSignal
.
theReceiversBlockNumber
=
DBDICT
;
LinearSectionPtr
ptr
[
3
];
LinearSectionPtr
ptr
[
1
];
ptr
[
0
].
p
=
(
Uint32
*
)
m_buffer
.
get_data
();
ptr
[
0
].
sz
=
m_buffer
.
length
()
/
4
;
int
ret
;
...
...
@@ -2182,7 +2207,7 @@ NdbDictInterface::createIndex(Ndb & ndb,
}
attributeList
.
id
[
i
]
=
col
->
m_attrId
;
}
LinearSectionPtr
ptr
[
3
];
LinearSectionPtr
ptr
[
2
];
ptr
[
0
].
p
=
(
Uint32
*
)
&
attributeList
;
ptr
[
0
].
sz
=
1
+
attributeList
.
sz
;
ptr
[
1
].
p
=
(
Uint32
*
)
m_buffer
.
get_data
();
...
...
@@ -2489,7 +2514,7 @@ NdbDictInterface::createEvent(class Ndb & ndb,
w
.
add
(
SimpleProperties
::
StringValue
,
ndb
.
internalizeTableName
(
evnt
.
m_tableName
.
c_str
()));
LinearSectionPtr
ptr
[
3
];
LinearSectionPtr
ptr
[
1
];
ptr
[
0
].
p
=
(
Uint32
*
)
m_buffer
.
get_data
();
ptr
[
0
].
sz
=
(
m_buffer
.
length
()
+
3
)
>>
2
;
...
...
ndb/src/ndbapi/NdbDictionaryImpl.hpp
View file @
89415d27
...
...
@@ -161,8 +161,6 @@ public:
*/
bool
equal
(
const
NdbTableImpl
&
)
const
;
void
assign
(
const
NdbTableImpl
&
);
void
clearNewProperties
();
void
copyNewProperties
();
static
NdbTableImpl
&
getImpl
(
NdbDictionary
::
Table
&
t
);
static
NdbTableImpl
&
getImpl
(
const
NdbDictionary
::
Table
&
t
);
...
...
@@ -180,6 +178,7 @@ public:
NdbIndexImpl
(
NdbDictionary
::
Index
&
);
~
NdbIndexImpl
();
void
init
();
void
setName
(
const
char
*
name
);
const
char
*
getName
()
const
;
void
setTable
(
const
char
*
table
);
...
...
@@ -209,6 +208,7 @@ public:
NdbEventImpl
(
NdbDictionary
::
Event
&
);
~
NdbEventImpl
();
void
init
();
void
setName
(
const
char
*
name
);
const
char
*
getName
()
const
;
void
setTable
(
const
NdbDictionary
::
Table
&
table
);
...
...
@@ -368,6 +368,8 @@ private:
Uint32
m_fragmentId
;
UtilBuffer
m_buffer
;
// Buffer used when requesting a table by name
UtilBuffer
m_namebuf
;
};
class
NdbDictionaryImpl
:
public
NdbDictionary
::
Dictionary
{
...
...
@@ -378,7 +380,7 @@ public:
bool
setTransporter
(
class
Ndb
*
ndb
,
class
TransporterFacade
*
tf
);
bool
setTransporter
(
class
TransporterFacade
*
tf
);
int
createTable
(
NdbTableImpl
&
t
);
int
createBlobTables
(
NdbTableImpl
&
);
int
addBlobTables
(
NdbTableImpl
&
);
...
...
@@ -560,7 +562,7 @@ NdbTableImpl::getColumn(const char * name){
do
{
if
(
hashValue
==
(
tmp
&
0xFFFE
)){
NdbColumnImpl
*
col
=
cols
[
tmp
>>
16
];
if
(
strncmp
(
name
,
col
->
m_name
.
c_str
(),
NDB_MAX_ATTR_NAME_SIZE
-
1
)
==
0
){
if
(
strncmp
(
name
,
col
->
m_name
.
c_str
(),
col
->
m_name
.
length
()
)
==
0
){
return
col
;
}
}
...
...
@@ -578,7 +580,7 @@ NdbTableImpl::getColumn(const char * name){
}
else
{
for
(
Uint32
i
=
0
;
i
<
sz
;
i
++
){
NdbColumnImpl
*
col
=
*
cols
++
;
if
(
col
!=
0
&&
strncmp
(
name
,
col
->
m_name
.
c_str
(),
NDB_MAX_ATTR_NAME_SIZE
-
1
)
==
0
)
if
(
col
!=
0
&&
strncmp
(
name
,
col
->
m_name
.
c_str
(),
col
->
m_name
.
length
()
)
==
0
)
return
col
;
}
}
...
...
ndb/src/ndbapi/NdbImpl.hpp
View file @
89415d27
...
...
@@ -59,6 +59,37 @@ public:
NdbWaiter
theWaiter
;
int
m_optimized_node_selection
;
BaseString
m_dbname
;
// Database name
BaseString
m_schemaname
;
// Schema name
BaseString
m_prefix
;
// Buffer for preformatted internal name <db>/<schema>/
BaseString
m_internalname
;
void
update_prefix
()
{
m_prefix
.
assfmt
(
"%s%c%s%c"
,
m_dbname
.
c_str
(),
table_name_separator
,
m_schemaname
.
c_str
(),
table_name_separator
);
}
const
char
*
internalize_table_name
(
const
char
*
ext_name
)
{
// Internal table name format <db>/<schema>/<table>
return
m_internalname
.
assign
(
m_prefix
).
append
(
ext_name
).
c_str
();
}
const
char
*
internalize_index_name
(
const
NdbTableImpl
*
table
,
const
char
*
ext_name
)
{
// Internal index name format <db>/<schema>/<tabid>/<table>
return
m_internalname
.
assign
(
m_prefix
).
appfmt
(
"%d%c%s"
,
table
->
m_tableId
,
table_name_separator
,
ext_name
).
c_str
();
}
};
#ifdef VM_TRACE
...
...
ndb/src/ndbapi/Ndbinit.cpp
View file @
89415d27
...
...
@@ -62,7 +62,6 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection,
theNoOfAllocatedTransactions
=
0
;
theMaxNoOfTransactions
=
0
;
theMinNoOfEventsToWakeUp
=
0
;
prefixEnd
=
NULL
;
theConIdleList
=
NULL
;
theOpIdleList
=
NULL
;
theScanOpIdleList
=
NULL
;
...
...
@@ -109,17 +108,10 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection,
theFirstTupleId
[
i
]
=
0
;
theLastTupleId
[
i
]
=
0
;
}
//for
BaseString
::
snprintf
(
theDataBase
,
sizeof
(
theDataBase
),
"%s"
,
aDataBase
?
aDataBase
:
""
);
BaseString
::
snprintf
(
theDataBaseSchema
,
sizeof
(
theDataBaseSchema
),
"%s"
,
aSchema
?
aSchema
:
""
);
int
len
=
BaseString
::
snprintf
(
prefixName
,
sizeof
(
prefixName
),
"%s%c%s%c"
,
theDataBase
,
table_name_separator
,
theDataBaseSchema
,
table_name_separator
);
prefixEnd
=
prefixName
+
(
len
<
(
int
)
sizeof
(
prefixName
)
?
len
:
sizeof
(
prefixName
)
-
1
);
theImpl
->
m_dbname
.
assign
(
aDataBase
);
theImpl
->
m_schemaname
.
assign
(
aSchema
);
theImpl
->
update_prefix
();
theImpl
->
theWaiter
.
m_mutex
=
TransporterFacade
::
instance
()
->
theMutexPtr
;
...
...
ndb/src/ndbapi/ndb_cluster_connection.cpp
View file @
89415d27
...
...
@@ -265,14 +265,11 @@ Ndb_cluster_connection_impl::Ndb_cluster_connection_impl(const char *
m_connect_callback
=
0
;
if
(
ndb_global_event_buffer_mutex
==
NULL
)
{
ndb_global_event_buffer_mutex
=
NdbMutex_Create
();
}
#ifdef VM_TRACE
if
(
ndb_print_state_mutex
==
NULL
)
{
ndb_print_state_mutex
=
NdbMutex_Create
();
}
#endif
m_config_retriever
=
new
ConfigRetriever
(
connect_string
,
NDB_VERSION
,
NODE_TYPE_API
);
...
...
@@ -294,7 +291,6 @@ Ndb_cluster_connection_impl::Ndb_cluster_connection_impl(const char *
Ndb_cluster_connection_impl
::~
Ndb_cluster_connection_impl
()
{
DBUG_ENTER
(
"~Ndb_cluster_connection"
);
DBUG_PRINT
(
"enter"
,(
"~Ndb_cluster_connection this=0x%x"
,
this
));
TransporterFacade
::
stop_instance
();
if
(
m_connect_thread
)
{
...
...
@@ -312,10 +308,22 @@ Ndb_cluster_connection_impl::~Ndb_cluster_connection_impl()
TransporterFacade
::
theFacadeInstance
=
0
;
}
if
(
m_config_retriever
)
{
delete
m_config_retriever
;
// fragmentToNodeMap.release();
m_config_retriever
=
NULL
;
}
if
(
ndb_global_event_buffer_mutex
!=
NULL
)
{
NdbMutex_Destroy
(
ndb_global_event_buffer_mutex
);
ndb_global_event_buffer_mutex
=
NULL
;
}
#ifdef VM_TRACE
if
(
ndb_print_state_mutex
!=
NULL
)
{
NdbMutex_Destroy
(
ndb_print_state_mutex
);
ndb_print_state_mutex
=
NULL
;
}
#endif
DBUG_VOID_RETURN
;
}
...
...
sql/ha_ndbcluster.cc
View file @
89415d27
...
...
@@ -985,16 +985,13 @@ static int fix_unique_index_attr_order(NDB_INDEX_DATA &data,
for
(
unsigned
i
=
0
;
key_part
!=
end
;
key_part
++
,
i
++
)
{
const
char
*
field_name
=
key_part
->
field
->
field_name
;
unsigned
name_sz
=
strlen
(
field_name
);
if
(
name_sz
>=
NDB_MAX_ATTR_NAME_SIZE
)
name_sz
=
NDB_MAX_ATTR_NAME_SIZE
-
1
;
#ifndef DBUG_OFF
data
.
unique_index_attrid_map
[
i
]
=
255
;
#endif
for
(
unsigned
j
=
0
;
j
<
sz
;
j
++
)
{
const
NDBCOL
*
c
=
index
->
getColumn
(
j
);
if
(
str
ncmp
(
field_name
,
c
->
getName
(),
name_sz
)
==
0
)
if
(
str
cmp
(
field_name
,
c
->
getName
()
)
==
0
)
{
data
.
unique_index_attrid_map
[
i
]
=
j
;
break
;
...
...
@@ -3545,12 +3542,7 @@ static int create_ndb_column(NDBCOL &col,
HA_CREATE_INFO
*
info
)
{
// Set name
{
char
truncated_field_name
[
NDB_MAX_ATTR_NAME_SIZE
];
strnmov
(
truncated_field_name
,
field
->
field_name
,
sizeof
(
truncated_field_name
));
truncated_field_name
[
sizeof
(
truncated_field_name
)
-
1
]
=
'\0'
;
col
.
setName
(
truncated_field_name
);
}
col
.
setName
(
field
->
field_name
);
// Get char set
CHARSET_INFO
*
cs
=
field
->
charset
();
// Set type and sizes
...
...
@@ -4040,12 +4032,7 @@ int ha_ndbcluster::create_index(const char *name,
{
Field
*
field
=
key_part
->
field
;
DBUG_PRINT
(
"info"
,
(
"attr: %s"
,
field
->
field_name
));
{
char
truncated_field_name
[
NDB_MAX_ATTR_NAME_SIZE
];
strnmov
(
truncated_field_name
,
field
->
field_name
,
sizeof
(
truncated_field_name
));
truncated_field_name
[
sizeof
(
truncated_field_name
)
-
1
]
=
'\0'
;
ndb_index
.
addColumnName
(
truncated_field_name
);
}
ndb_index
.
addColumnName
(
field
->
field_name
);
}
if
(
dict
->
createIndex
(
ndb_index
))
...
...
@@ -5507,7 +5494,8 @@ ndb_get_table_statistics(Ndb* ndb, const char * table,
DBUG_RETURN
(
0
);
}
while
(
0
);
ndb
->
closeTransaction
(
pTrans
);
if
(
pTrans
)
ndb
->
closeTransaction
(
pTrans
);
DBUG_PRINT
(
"exit"
,
(
"failed"
));
DBUG_RETURN
(
-
1
);
}
...
...
sql/opt_range.cc
View file @
89415d27
...
...
@@ -713,7 +713,8 @@ SQL_SELECT::~SQL_SELECT()
QUICK_SELECT_I
::
QUICK_SELECT_I
()
:
max_used_key_length
(
0
),
used_key_parts
(
0
)
used_key_parts
(
0
),
records
(
0
)
{}
QUICK_RANGE_SELECT
::
QUICK_RANGE_SELECT
(
THD
*
thd
,
TABLE
*
table
,
uint
key_nr
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment