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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
ad92514d
Commit
ad92514d
authored
Apr 10, 2005
by
pekka@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ndb - wl-2451: Increase max schema object to > 1600
parent
4c1e9238
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
605 additions
and
247 deletions
+605
-247
mysql-test/Makefile.am
mysql-test/Makefile.am
+3
-0
ndb/include/debugger/SignalLoggerManager.hpp
ndb/include/debugger/SignalLoggerManager.hpp
+1
-1
ndb/include/kernel/ndb_limits.h
ndb/include/kernel/ndb_limits.h
+1
-1
ndb/src/common/debugger/SignalLoggerManager.cpp
ndb/src/common/debugger/SignalLoggerManager.cpp
+7
-2
ndb/src/kernel/blocks/dbdict/Dbdict.cpp
ndb/src/kernel/blocks/dbdict/Dbdict.cpp
+313
-115
ndb/src/kernel/blocks/dbdict/Dbdict.hpp
ndb/src/kernel/blocks/dbdict/Dbdict.hpp
+43
-12
ndb/src/kernel/blocks/dbdict/SchemaFile.hpp
ndb/src/kernel/blocks/dbdict/SchemaFile.hpp
+37
-5
ndb/src/kernel/blocks/dbdict/printSchemaFile.cpp
ndb/src/kernel/blocks/dbdict/printSchemaFile.cpp
+147
-56
ndb/src/ndbapi/NdbDictionaryImpl.cpp
ndb/src/ndbapi/NdbDictionaryImpl.cpp
+2
-0
ndb/test/ndbapi/testDict.cpp
ndb/test/ndbapi/testDict.cpp
+51
-55
No files found.
mysql-test/Makefile.am
View file @
ad92514d
...
@@ -59,6 +59,9 @@ dist-hook:
...
@@ -59,6 +59,9 @@ dist-hook:
$(INSTALL_DATA)
$(srcdir)
/std_data/
*
.frm
$(distdir)
/std_data
$(INSTALL_DATA)
$(srcdir)
/std_data/
*
.frm
$(distdir)
/std_data
install-data-local
:
install-data-local
:
true
x-install-data-local
:
$(mkinstalldirs)
\
$(mkinstalldirs)
\
$(DESTDIR)$(testdir)
/t
\
$(DESTDIR)$(testdir)
/t
\
$(DESTDIR)$(testdir)
/r
\
$(DESTDIR)$(testdir)
/r
\
...
...
ndb/include/debugger/SignalLoggerManager.hpp
View file @
ad92514d
...
@@ -87,7 +87,7 @@ public:
...
@@ -87,7 +87,7 @@ public:
/**
/**
* Generic messages in the signal log
* Generic messages in the signal log
*/
*/
void
log
(
BlockNumber
bno
,
const
char
*
msg
);
void
log
(
BlockNumber
bno
,
const
char
*
msg
,
...
);
/**
/**
* LogModes
* LogModes
...
...
ndb/include/kernel/ndb_limits.h
View file @
ad92514d
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
**/
**/
#define MAX_TUPLES_PER_PAGE 8191
#define MAX_TUPLES_PER_PAGE 8191
#define MAX_TUPLES_BITS 13
/* 13 bits = 8191 tuples per page */
#define MAX_TUPLES_BITS 13
/* 13 bits = 8191 tuples per page */
#define MAX_TABLES
1600
#define MAX_TABLES
20320
/* SchemaFile.hpp */
#define MAX_TAB_NAME_SIZE 128
#define MAX_TAB_NAME_SIZE 128
#define MAX_ATTR_NAME_SIZE 32
#define MAX_ATTR_NAME_SIZE 32
#define MAX_ATTR_DEFAULT_VALUE_SIZE 128
#define MAX_ATTR_DEFAULT_VALUE_SIZE 128
...
...
ndb/src/common/debugger/SignalLoggerManager.cpp
View file @
ad92514d
...
@@ -383,7 +383,7 @@ SignalLoggerManager::sendSignalWithDelay(Uint32 delayInMilliSeconds,
...
@@ -383,7 +383,7 @@ SignalLoggerManager::sendSignalWithDelay(Uint32 delayInMilliSeconds,
* Generic messages in the signal log
* Generic messages in the signal log
*/
*/
void
void
SignalLoggerManager
::
log
(
BlockNumber
bno
,
const
char
*
msg
)
SignalLoggerManager
::
log
(
BlockNumber
bno
,
const
char
*
msg
,
...
)
{
{
// Normalise blocknumber for use in logModes array
// Normalise blocknumber for use in logModes array
const
BlockNumber
bno2
=
bno
-
MIN_BLOCK_NO
;
const
BlockNumber
bno2
=
bno
-
MIN_BLOCK_NO
;
...
@@ -391,7 +391,12 @@ SignalLoggerManager::log(BlockNumber bno, const char * msg)
...
@@ -391,7 +391,12 @@ SignalLoggerManager::log(BlockNumber bno, const char * msg)
if
(
outputStream
!=
0
&&
if
(
outputStream
!=
0
&&
logModes
[
bno2
]
!=
LogOff
){
logModes
[
bno2
]
!=
LogOff
){
fprintf
(
outputStream
,
"%s: %s
\n
"
,
getBlockName
(
bno
,
"API"
),
msg
);
va_list
ap
;
va_start
(
ap
,
msg
);
fprintf
(
outputStream
,
"%s: "
,
getBlockName
(
bno
,
"API"
));
vfprintf
(
outputStream
,
msg
,
ap
);
fprintf
(
outputStream
,
"
\n
"
,
msg
);
va_end
(
ap
);
}
}
}
}
...
...
ndb/src/kernel/blocks/dbdict/Dbdict.cpp
View file @
ad92514d
This diff is collapsed.
Click to expand it.
ndb/src/kernel/blocks/dbdict/Dbdict.hpp
View file @
ad92514d
...
@@ -78,7 +78,8 @@
...
@@ -78,7 +78,8 @@
/*--------------------------------------------------------------*/
/*--------------------------------------------------------------*/
// Page constants
// Page constants
/*--------------------------------------------------------------*/
/*--------------------------------------------------------------*/
#define ZALLOCATE 1 //Variable number of page for NDBFS
#define ZBAT_SCHEMA_FILE 0 //Variable number of page for NDBFS
#define ZBAT_TABLE_FILE 1 //Variable number of page for NDBFS
#define ZPAGE_HEADER_SIZE 32
#define ZPAGE_HEADER_SIZE 32
#define ZPOS_PAGE_SIZE 16
#define ZPOS_PAGE_SIZE 16
#define ZPOS_CHECKSUM 17
#define ZPOS_CHECKSUM 17
...
@@ -92,7 +93,7 @@
...
@@ -92,7 +93,7 @@
#define ZSIZE_OF_PAGES_IN_WORDS 8192
#define ZSIZE_OF_PAGES_IN_WORDS 8192
#define ZLOG_SIZE_OF_PAGES_IN_WORDS 13
#define ZLOG_SIZE_OF_PAGES_IN_WORDS 13
#define ZMAX_PAGES_OF_TABLE_DEFINITION 8
#define ZMAX_PAGES_OF_TABLE_DEFINITION 8
#define ZNUMBER_OF_PAGES (
2 * ZMAX_PAGES_OF_TABLE_DEFINITION + 2
)
#define ZNUMBER_OF_PAGES (
ZMAX_PAGES_OF_TABLE_DEFINITION + 1
)
#define ZNO_OF_FRAGRECORD 5
#define ZNO_OF_FRAGRECORD 5
/*--------------------------------------------------------------*/
/*--------------------------------------------------------------*/
...
@@ -429,6 +430,12 @@ public:
...
@@ -429,6 +430,12 @@ public:
typedef
Ptr
<
PageRecord
>
PageRecordPtr
;
typedef
Ptr
<
PageRecord
>
PageRecordPtr
;
CArray
<
PageRecord
>
c_pageRecordArray
;
CArray
<
PageRecord
>
c_pageRecordArray
;
struct
SchemaPageRecord
{
Uint32
word
[
NDB_SF_PAGE_SIZE_IN_WORDS
];
};
CArray
<
SchemaPageRecord
>
c_schemaPageRecordArray
;
/**
/**
* A page for create index table signal.
* A page for create index table signal.
*/
*/
...
@@ -655,16 +662,20 @@ private:
...
@@ -655,16 +662,20 @@ private:
struct
ReadSchemaRecord
{
struct
ReadSchemaRecord
{
/** Page Id of schema page */
/** Page Id of schema page */
Uint32
pageId
;
Uint32
pageId
;
/** First page to read */
Uint32
firstPage
;
/** Number of pages to read */
Uint32
noOfPages
;
/** State, indicates from where it was called */
/** State, indicates from where it was called */
enum
SchemaReadState
{
enum
SchemaReadState
{
IDLE
=
0
,
IDLE
=
0
,
INITIAL_READ
=
1
INITIAL_READ_HEAD
=
1
,
INITIAL_READ
=
2
};
};
SchemaReadState
schemaReadState
;
SchemaReadState
schemaReadState
;
};
};
ReadSchemaRecord
c_readSchemaRecord
;
ReadSchemaRecord
c_readSchemaRecord
;
private:
/**
/**
* This record stores all the state needed
* This record stores all the state needed
* when a schema file is being written to disk
* when a schema file is being written to disk
...
@@ -672,6 +683,12 @@ private:
...
@@ -672,6 +683,12 @@ private:
struct
WriteSchemaRecord
{
struct
WriteSchemaRecord
{
/** Page Id of schema page */
/** Page Id of schema page */
Uint32
pageId
;
Uint32
pageId
;
/** Rewrite entire file */
Uint32
newFile
;
/** First page to write */
Uint32
firstPage
;
/** Number of pages to write */
Uint32
noOfPages
;
/** Schema Files Handled, local state variable */
/** Schema Files Handled, local state variable */
Uint32
noOfSchemaFilesHandled
;
Uint32
noOfSchemaFilesHandled
;
...
@@ -752,21 +769,33 @@ private:
...
@@ -752,21 +769,33 @@ private:
* Word 4: Currently zero
* Word 4: Currently zero
****************************************************************************/
****************************************************************************/
struct
SchemaRecord
{
struct
SchemaRecord
{
/** Schema
page
*/
/** Schema
file first page (0)
*/
Uint32
schemaPage
;
Uint32
schemaPage
;
/** Old Schema
page (used at node restart)
*/
/** Old Schema
file first page (used at node restart)
*/
Uint32
oldSchemaPage
;
Uint32
oldSchemaPage
;
Callback
m_callback
;
Callback
m_callback
;
};
};
SchemaRecord
c_schemaRecord
;
SchemaRecord
c_schemaRecord
;
void
initSchemaFile
(
SchemaFile
*
,
Uint32
sz
);
/*
void
computeChecksum
(
SchemaFile
*
);
* Schema file, list of schema pages. Use an array until a pool
bool
validateChecksum
(
const
SchemaFile
*
);
* exists and NDBFS interface can use it.
SchemaFile
::
TableEntry
*
getTableEntry
(
void
*
buf
,
Uint32
tableId
,
*/
bool
allowTooBig
=
false
);
struct
XSchemaFile
{
SchemaFile
*
schemaPage
;
Uint32
noOfPages
;
};
// 0-normal 1-old
XSchemaFile
c_schemaFile
[
2
];
void
initSchemaFile
(
XSchemaFile
*
,
Uint32
firstPage
,
Uint32
lastPage
,
bool
initEntries
);
void
resizeSchemaFile
(
XSchemaFile
*
xsf
,
Uint32
noOfPages
);
void
computeChecksum
(
XSchemaFile
*
,
Uint32
pageNo
);
bool
validateChecksum
(
const
XSchemaFile
*
);
SchemaFile
::
TableEntry
*
getTableEntry
(
XSchemaFile
*
,
Uint32
tableId
);
Uint32
computeChecksum
(
const
Uint32
*
src
,
Uint32
len
);
Uint32
computeChecksum
(
const
Uint32
*
src
,
Uint32
len
);
...
@@ -1631,7 +1660,8 @@ private:
...
@@ -1631,7 +1660,8 @@ private:
void
openSchemaFile
(
Signal
*
signal
,
void
openSchemaFile
(
Signal
*
signal
,
Uint32
fileNo
,
Uint32
fileNo
,
Uint32
fsPtr
,
Uint32
fsPtr
,
bool
writeFlag
);
bool
writeFlag
,
bool
newFile
);
void
writeSchemaFile
(
Signal
*
signal
,
Uint32
filePtr
,
Uint32
fsPtr
);
void
writeSchemaFile
(
Signal
*
signal
,
Uint32
filePtr
,
Uint32
fsPtr
);
void
writeSchemaConf
(
Signal
*
signal
,
void
writeSchemaConf
(
Signal
*
signal
,
FsConnectRecordPtr
fsPtr
);
FsConnectRecordPtr
fsPtr
);
...
@@ -1673,6 +1703,7 @@ private:
...
@@ -1673,6 +1703,7 @@ private:
void
readSchemaRef
(
Signal
*
signal
,
FsConnectRecordPtr
fsPtr
);
void
readSchemaRef
(
Signal
*
signal
,
FsConnectRecordPtr
fsPtr
);
void
closeReadSchemaConf
(
Signal
*
signal
,
void
closeReadSchemaConf
(
Signal
*
signal
,
FsConnectRecordPtr
fsPtr
);
FsConnectRecordPtr
fsPtr
);
bool
convertSchemaFileTo_5_0_5
(
XSchemaFile
*
);
/* ------------------------------------------------------------ */
/* ------------------------------------------------------------ */
// Get table definitions
// Get table definitions
...
...
ndb/src/kernel/blocks/dbdict/SchemaFile.hpp
View file @
ad92514d
...
@@ -18,16 +18,35 @@
...
@@ -18,16 +18,35 @@
#define DBDICT_SCHEMA_FILE_HPP
#define DBDICT_SCHEMA_FILE_HPP
#include <ndb_types.h>
#include <ndb_types.h>
#include <ndb_version.h>
#include <string.h>
#include <string.h>
#define NDB_SF_MAGIC "NDBSCHMA"
// page size 4k
#define NDB_SF_PAGE_SIZE_IN_WORDS_LOG2 10
#define NDB_SF_PAGE_SIZE_IN_WORDS (1 << NDB_SF_PAGE_SIZE_IN_WORDS_LOG2)
#define NDB_SF_PAGE_SIZE (NDB_SF_PAGE_SIZE_IN_WORDS << 2)
// 4k = (1 + 127) * 32
#define NDB_SF_PAGE_ENTRIES 127
// 160 pages = 20320 objects
#define NDB_SF_MAX_PAGES 160
// versions where format changed
#define NDB_SF_VERSION_5_0_5 MAKE_VERSION(5, 0, 5)
// One page in schema file.
struct
SchemaFile
{
struct
SchemaFile
{
// header size 32 bytes
char
Magic
[
8
];
char
Magic
[
8
];
Uint32
ByteOrder
;
Uint32
ByteOrder
;
Uint32
NdbVersion
;
Uint32
NdbVersion
;
Uint32
FileSize
;
// In bytes
Uint32
FileSize
;
// In bytes
Uint32
Unused
;
Uint32
PageNumber
;
Uint32
CheckSum
;
// Of this page
Uint32
CheckSum
;
Uint32
NoOfTableEntries
;
// On this page (NDB_SF_PAGE_ENTRIES)
enum
TableState
{
enum
TableState
{
INIT
=
0
,
INIT
=
0
,
...
@@ -38,20 +57,33 @@ struct SchemaFile {
...
@@ -38,20 +57,33 @@ struct SchemaFile {
ALTER_TABLE_COMMITTED
=
5
ALTER_TABLE_COMMITTED
=
5
};
};
// entry size 32 bytes
struct
TableEntry
{
struct
TableEntry
{
Uint32
m_tableState
;
Uint32
m_tableState
;
Uint32
m_tableVersion
;
Uint32
m_tableVersion
;
Uint32
m_tableType
;
Uint32
m_tableType
;
Uint32
m_noOfPages
;
Uint32
m_noOfPages
;
Uint32
m_gcp
;
Uint32
m_gcp
;
Uint32
m_unused
[
3
];
bool
operator
==
(
const
TableEntry
&
o
)
const
{
bool
operator
==
(
const
TableEntry
&
o
)
const
{
return
memcmp
(
this
,
&
o
,
sizeof
(
*
this
))
==
0
;
return
memcmp
(
this
,
&
o
,
sizeof
(
*
this
))
==
0
;
}
}
};
};
// pre-5.0.5
struct
TableEntry_old
{
Uint32
m_tableState
;
Uint32
m_tableVersion
;
Uint32
m_tableType
;
Uint32
m_noOfPages
;
Uint32
m_gcp
;
};
Uint32
NoOfTableEntries
;
union
{
TableEntry
TableEntries
[
1
];
TableEntry
TableEntries
[
NDB_SF_PAGE_ENTRIES
];
TableEntry_old
TableEntries_old
[
1
];
};
};
};
#endif
#endif
ndb/src/kernel/blocks/dbdict/printSchemaFile.cpp
View file @
ad92514d
#if 0
#if 0
make -f Makefile -f - printSchemaFile <<'_eof_'
make -f Makefile -f - printSchemaFile <<'_eof_'
printSchemaFile: printSchemaFile.cpp
printSchemaFile: printSchemaFile.cpp
SchemaFile.hpp
$(CXXCOMPILE) -o $@ $@.cpp -L../../../common/util/.libs -lgeneral
$(CXXCOMPILE) -o $@ $@.cpp -L../../../common/util/.libs -lgeneral
_eof_
_eof_
exit $?
exit $?
...
@@ -24,19 +24,28 @@ exit $?
...
@@ -24,19 +24,28 @@ exit $?
#include <ndb_global.h>
#include <ndb_global.h>
#include <ndb_version.h>
#include <NdbMain.h>
#include <NdbMain.h>
#include <NdbOut.hpp>
#include <NdbOut.hpp>
#include <SchemaFile.hpp>
#include <SchemaFile.hpp>
void
static
const
char
*
progname
=
0
;
usage
(
const
char
*
prg
){
static
bool
allflag
=
false
;
ndbout
<<
"Usage "
<<
prg
static
bool
checkonly
=
false
;
<<
" P0.SchemaLog"
<<
endl
;
static
int
xitcode
=
0
;
static
void
usage
()
{
ndbout
<<
"Usage "
<<
progname
<<
" [-ac]"
<<
" P0.SchemaLog"
<<
endl
;
}
}
void
static
void
fill
(
const
char
*
buf
,
int
mod
){
fill
(
const
char
*
buf
,
int
mod
)
{
int
len
=
strlen
(
buf
)
+
1
;
int
len
=
strlen
(
buf
)
+
1
;
ndbout
<<
buf
<<
" "
;
ndbout
<<
buf
<<
" "
;
while
((
len
%
mod
)
!=
0
){
while
((
len
%
mod
)
!=
0
){
...
@@ -45,19 +54,34 @@ fill(const char * buf, int mod){
...
@@ -45,19 +54,34 @@ fill(const char * buf, int mod){
}
}
}
}
void
static
void
print
(
const
char
*
filename
,
const
SchemaFile
*
file
){
print_head
(
const
char
*
filename
,
const
SchemaFile
*
sf
)
ndbout
<<
"----- Schemafile: "
<<
filename
<<
" -----"
<<
endl
;
{
ndbout_c
(
"Magic: %.*s ByteOrder: %.8x NdbVersion: %d FileSize: %d"
,
if
(
!
checkonly
)
{
sizeof
(
file
->
Magic
),
file
->
Magic
,
ndbout
<<
"----- Schemafile: "
<<
filename
<<
" -----"
<<
endl
;
file
->
ByteOrder
,
ndbout_c
(
"Magic: %.*s ByteOrder: %.8x NdbVersion: %d.%d.%d FileSize: %d"
,
file
->
NdbVersion
,
sizeof
(
sf
->
Magic
),
file
->
FileSize
);
sf
->
Magic
,
sf
->
ByteOrder
,
for
(
Uint32
i
=
0
;
i
<
file
->
NoOfTableEntries
;
i
++
){
sf
->
NdbVersion
>>
16
,
SchemaFile
::
TableEntry
te
=
file
->
TableEntries
[
i
];
(
sf
->
NdbVersion
>>
8
)
&
0xFF
,
if
(
te
.
m_tableState
!=
SchemaFile
::
INIT
){
sf
->
NdbVersion
&
0xFF
,
ndbout
<<
"Table "
<<
i
<<
": State = "
<<
te
.
m_tableState
sf
->
FileSize
);
}
}
static
void
print_old
(
const
char
*
filename
,
const
SchemaFile
*
sf
)
{
print_head
(
filename
,
sf
);
for
(
Uint32
i
=
0
;
i
<
sf
->
NoOfTableEntries
;
i
++
)
{
SchemaFile
::
TableEntry_old
te
=
sf
->
TableEntries_old
[
i
];
if
(
allflag
||
(
te
.
m_tableState
!=
SchemaFile
::
INIT
&&
te
.
m_tableState
!=
SchemaFile
::
DROP_TABLE_COMMITTED
))
{
ndbout
<<
"Table "
<<
i
<<
":"
<<
" State = "
<<
te
.
m_tableState
<<
" version = "
<<
te
.
m_tableVersion
<<
" version = "
<<
te
.
m_tableVersion
<<
" type = "
<<
te
.
m_tableType
<<
" type = "
<<
te
.
m_tableType
<<
" noOfPages = "
<<
te
.
m_noOfPages
<<
" noOfPages = "
<<
te
.
m_noOfPages
...
@@ -66,47 +90,114 @@ print(const char * filename, const SchemaFile * file){
...
@@ -66,47 +90,114 @@ print(const char * filename, const SchemaFile * file){
}
}
}
}
NDB_COMMAND
(
printSchemafile
,
static
void
"printSchemafile"
,
"printSchemafile"
,
"Prints a schemafile"
,
16384
){
print
(
const
char
*
filename
,
const
SchemaFile
*
xsf
,
Uint32
sz
)
if
(
argc
<
2
){
{
usage
(
argv
[
0
]);
int
retcode
=
0
;
return
0
;
}
const
char
*
filename
=
argv
[
1
]
;
print_head
(
filename
,
xsf
)
;
struct
stat
sbuf
;
assert
(
sizeof
(
SchemaFile
)
==
NDB_SF_PAGE_SIZE
);
const
int
res
=
stat
(
filename
,
&
sbuf
);
if
(
xsf
->
FileSize
!=
sz
||
xsf
->
FileSize
%
NDB_SF_PAGE_SIZE
!=
0
)
{
if
(
res
!=
0
){
ndbout
<<
"***** invalid FileSize "
<<
xsf
->
FileSize
<<
endl
;
ndbout
<<
"Could not find file:
\"
"
<<
filename
<<
"
\"
"
<<
endl
;
retcode
=
1
;
return
0
;
}
}
const
Uint32
bytes
=
sbuf
.
st_size
;
Uint32
noOfPages
=
xsf
->
FileSize
/
NDB_SF_PAGE_SIZE
;
for
(
Uint32
n
=
0
;
n
<
noOfPages
;
n
++
)
{
Uint32
*
buf
=
new
Uint32
[
bytes
/
4
+
1
];
if
(
!
checkonly
)
{
ndbout
<<
"----- Page: "
<<
n
<<
" ("
<<
noOfPages
<<
") -----"
<<
endl
;
FILE
*
f
=
fopen
(
filename
,
"rb"
);
}
if
(
f
==
0
){
const
SchemaFile
*
sf
=
&
xsf
[
n
];
ndbout
<<
"Failed to open file"
<<
endl
;
if
(
sf
->
FileSize
!=
xsf
->
FileSize
)
{
delete
[]
buf
;
ndbout
<<
"***** page "
<<
n
<<
" FileSize changed to "
<<
sf
->
FileSize
<<
"!="
<<
xsf
->
FileSize
<<
endl
;
return
0
;
retcode
=
1
;
}
Uint32
cs
=
0
;
for
(
Uint32
j
=
0
;
j
<
NDB_SF_PAGE_SIZE_IN_WORDS
;
j
++
)
cs
^=
((
const
Uint32
*
)
sf
)[
j
];
if
(
cs
!=
0
)
{
ndbout
<<
"***** page "
<<
n
<<
" invalid CheckSum"
<<
endl
;
retcode
=
1
;
}
if
(
sf
->
NoOfTableEntries
!=
NDB_SF_PAGE_ENTRIES
)
{
ndbout
<<
"***** page "
<<
n
<<
" invalid NoOfTableEntries "
<<
sf
->
NoOfTableEntries
<<
endl
;
retcode
=
1
;
}
for
(
Uint32
i
=
0
;
i
<
NDB_SF_PAGE_ENTRIES
;
i
++
)
{
SchemaFile
::
TableEntry
te
=
sf
->
TableEntries
[
i
];
Uint32
j
=
n
*
NDB_SF_PAGE_ENTRIES
+
i
;
if
(
allflag
||
(
te
.
m_tableState
!=
SchemaFile
::
INIT
&&
te
.
m_tableState
!=
SchemaFile
::
DROP_TABLE_COMMITTED
))
{
if
(
!
checkonly
)
ndbout
<<
"Table "
<<
j
<<
":"
<<
" State = "
<<
te
.
m_tableState
<<
" version = "
<<
te
.
m_tableVersion
<<
" type = "
<<
te
.
m_tableType
<<
" noOfPages = "
<<
te
.
m_noOfPages
<<
" gcp: "
<<
te
.
m_gcp
<<
endl
;
}
if
(
te
.
m_unused
[
0
]
!=
0
||
te
.
m_unused
[
1
]
!=
0
||
te
.
m_unused
[
2
]
!=
0
)
{
ndbout
<<
"***** entry "
<<
j
<<
" garbage in m_unused[3]"
<<
endl
;
retcode
=
1
;
}
}
}
}
Uint32
sz
=
fread
(
buf
,
1
,
bytes
,
f
);
fclose
(
f
);
if
(
retcode
!=
0
)
if
(
sz
!=
bytes
){
xitcode
=
1
;
ndbout
<<
"Failure while reading file"
<<
endl
;
else
if
(
checkonly
)
delete
[]
buf
;
ndbout
<<
"ok: "
<<
filename
<<
endl
;
return
0
;
}
NDB_COMMAND
(
printSchemafile
,
"printSchemafile"
,
"printSchemafile"
,
"Prints a schemafile"
,
16384
)
{
progname
=
argv
[
0
];
while
(
argv
[
1
][
0
]
==
'-'
)
{
if
(
strchr
(
argv
[
1
],
'a'
)
!=
0
)
allflag
=
true
;
if
(
strchr
(
argv
[
1
],
'c'
)
!=
0
)
checkonly
=
true
;
argc
--
,
argv
++
;
}
}
print
(
filename
,
(
SchemaFile
*
)
&
buf
[
0
]);
Uint32
chk
=
0
,
i
;
while
(
argc
>
1
)
{
for
(
i
=
0
;
i
<
bytes
/
4
;
i
++
)
const
char
*
filename
=
argv
[
1
];
chk
^=
buf
[
i
];
argc
--
,
argv
++
;
if
(
chk
!=
0
)
ndbout
<<
"Invalid checksum!"
<<
endl
;
struct
stat
sbuf
;
const
int
res
=
stat
(
filename
,
&
sbuf
);
if
(
res
!=
0
)
{
ndbout
<<
"Could not find file:
\"
"
<<
filename
<<
"
\"
"
<<
endl
;
return
1
;
}
const
Uint32
bytes
=
sbuf
.
st_size
;
Uint32
*
buf
=
new
Uint32
[
bytes
/
4
+
1
];
FILE
*
f
=
fopen
(
filename
,
"rb"
);
if
(
f
==
0
)
{
ndbout
<<
"Failed to open file"
<<
endl
;
delete
[]
buf
;
return
1
;
}
Uint32
sz
=
fread
(
buf
,
1
,
bytes
,
f
);
fclose
(
f
);
if
(
sz
!=
bytes
)
{
ndbout
<<
"Failure while reading file"
<<
endl
;
delete
[]
buf
;
return
1
;
}
SchemaFile
*
sf
=
(
SchemaFile
*
)
&
buf
[
0
];
if
(
sf
->
NdbVersion
<
NDB_SF_VERSION_5_0_5
)
print_old
(
filename
,
sf
);
else
print
(
filename
,
sf
,
sz
);
delete
[]
buf
;
}
delete
[]
buf
;
return
xitcode
;
return
0
;
}
}
ndb/src/ndbapi/NdbDictionaryImpl.cpp
View file @
ad92514d
...
@@ -208,11 +208,13 @@ NdbColumnImpl::equal(const NdbColumnImpl& col) const
...
@@ -208,11 +208,13 @@ NdbColumnImpl::equal(const NdbColumnImpl& col) const
if
(
m_nullable
!=
col
.
m_nullable
){
if
(
m_nullable
!=
col
.
m_nullable
){
DBUG_RETURN
(
false
);
DBUG_RETURN
(
false
);
}
}
#ifdef ndb_dictionary_dkey_fixed
if
(
m_pk
){
if
(
m_pk
){
if
(
m_distributionKey
!=
col
.
m_distributionKey
){
if
(
m_distributionKey
!=
col
.
m_distributionKey
){
DBUG_RETURN
(
false
);
DBUG_RETURN
(
false
);
}
}
}
}
#endif
if
(
m_precision
!=
col
.
m_precision
||
if
(
m_precision
!=
col
.
m_precision
||
m_scale
!=
col
.
m_scale
||
m_scale
!=
col
.
m_scale
||
m_length
!=
col
.
m_length
||
m_length
!=
col
.
m_length
||
...
...
ndb/test/ndbapi/testDict.cpp
View file @
ad92514d
...
@@ -428,103 +428,99 @@ int runUseTableUntilStopped(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -428,103 +428,99 @@ int runUseTableUntilStopped(NDBT_Context* ctx, NDBT_Step* step){
}
}
int
runCreateMaxTables
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
int
int
failures
=
0
;
runCreateMaxTables
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
)
{
char
tabName
[
256
];
char
tabName
[
256
];
int
numTables
=
ctx
->
getProperty
(
"tables"
,
1000
);
int
numTables
=
ctx
->
getProperty
(
"tables"
,
1000
);
Ndb
*
pNdb
=
GETNDB
(
step
);
Ndb
*
pNdb
=
GETNDB
(
step
);
NdbDictionary
::
Dictionary
*
pDic
=
pNdb
->
getDictionary
();
for
(
int
i
=
0
;
i
<
numTables
&&
failures
<
5
;
i
++
){
int
i
=
0
;
for
(
i
=
0
;
i
<
numTables
;
i
++
)
{
BaseString
::
snprintf
(
tabName
,
256
,
"MAXTAB%d"
,
i
);
BaseString
::
snprintf
(
tabName
,
256
,
"MAXTAB%d"
,
i
);
if
(
pNdb
->
waitUntilReady
(
30
)
!=
0
)
{
if
(
pNdb
->
waitUntilReady
(
30
)
!=
0
){
// Db is not ready, return with failure
// Db is not ready, return with failure
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
const
NdbDictionary
::
Table
*
pTab
=
ctx
->
getTab
();
const
NdbDictionary
::
Table
*
pTab
=
ctx
->
getTab
();
ndbout
<<
"|- "
<<
tabName
<<
endl
;
//ndbout << "|- " << tabName << endl;
// Set new name for T1
// Set new name for T1
NdbDictionary
::
Table
newTab
(
*
pTab
);
NdbDictionary
::
Table
newTab
(
*
pTab
);
newTab
.
setName
(
tabName
);
newTab
.
setName
(
tabName
);
// Drop any old (or try to)
(
void
)
pDic
->
dropTable
(
newTab
.
getName
());
// Try to create table in db
// Try to create table in db
if
(
newTab
.
createTableInDb
(
pNdb
)
!=
0
){
if
(
newTab
.
createTableInDb
(
pNdb
)
!=
0
)
{
ndbout
<<
tabName
<<
" coult not be created"
<<
endl
;
ndbout
<<
tabName
<<
" could not be created: "
failures
++
;
<<
pDic
->
getNdbError
()
<<
endl
;
continue
;
if
(
pDic
->
getNdbError
().
code
==
707
||
pDic
->
getNdbError
().
code
==
708
||
pDic
->
getNdbError
().
code
==
826
||
pDic
->
getNdbError
().
code
==
827
)
break
;
return
NDBT_FAILED
;
}
}
// Verify that table exists in db
// Verify that table exists in db
const
NdbDictionary
::
Table
*
pTab3
=
const
NdbDictionary
::
Table
*
pTab3
=
NDBT_Table
::
discoverTableFromDb
(
pNdb
,
tabName
)
;
NDBT_Table
::
discoverTableFromDb
(
pNdb
,
tabName
)
;
if
(
pTab3
==
NULL
){
if
(
pTab3
==
NULL
){
ndbout
<<
tabName
<<
" was not found in DB
"
<<
endl
;
ndbout
<<
tabName
<<
" was not found in DB
: "
failures
++
;
<<
pDic
->
getNdbError
()
<<
endl
;
continue
;
return
NDBT_FAILED
;
}
}
if
(
!
newTab
.
equal
(
*
pTab3
))
{
if
(
pTab
->
equal
(
*
pTab3
)
==
false
){
ndbout
<<
"It was not equal"
<<
endl
;
abort
();
ndbout
<<
"It was not equal"
<<
endl
;
return
NDBT_FAILED
;
failures
++
;
}
}
int
records
=
ctx
->
getNumRecords
();
int
records
=
1000
;
HugoTransactions
hugoTrans
(
*
pTab3
);
HugoTransactions
hugoTrans
(
*
pTab3
);
if
(
hugoTrans
.
loadTable
(
pNdb
,
records
)
!=
0
){
if
(
hugoTrans
.
loadTable
(
pNdb
,
records
)
!=
0
)
{
ndbout
<<
"It can NOT be loaded"
<<
endl
;
ndbout
<<
"It can NOT be loaded"
<<
endl
;
}
else
{
return
NDBT_FAILED
;
ndbout
<<
"It can be loaded"
<<
endl
;
}
UtilTransactions
utilTrans
(
*
pTab3
);
UtilTransactions
utilTrans
(
*
pTab3
);
if
(
utilTrans
.
clearTable
(
pNdb
,
records
,
64
)
!=
0
)
{
if
(
utilTrans
.
clearTable
(
pNdb
,
records
,
64
)
!=
0
){
ndbout
<<
"It can NOT be cleared"
<<
endl
;
ndbout
<<
"It can NOT be cleared"
<<
endl
;
return
NDBT_FAILED
;
}
else
{
ndbout
<<
"It can be cleared"
<<
endl
;
}
}
}
}
}
if
(
pNdb
->
waitUntilReady
(
30
)
!=
0
){
if
(
pNdb
->
waitUntilReady
(
30
)
!=
0
)
{
// Db is not ready, return with failure
// Db is not ready, return with failure
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
ctx
->
setProperty
(
"maxtables"
,
i
);
// HURRAAA!
// HURRAAA!
return
NDBT_OK
;
return
NDBT_OK
;
}
}
int
runDropMaxTables
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
)
{
int
runDropMaxTables
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
)
int
result
=
NDBT_OK
;
{
char
tabName
[
256
];
char
tabName
[
256
];
int
numTables
=
ctx
->
getProperty
(
"
tables"
,
100
0
);
int
numTables
=
ctx
->
getProperty
(
"
maxtables"
,
(
Uint32
)
0
);
Ndb
*
pNdb
=
GETNDB
(
step
);
Ndb
*
pNdb
=
GETNDB
(
step
);
NdbDictionary
::
Dictionary
*
pDic
=
pNdb
->
getDictionary
();
for
(
int
i
=
0
;
i
<
numTables
;
i
++
){
for
(
int
i
=
0
;
i
<
numTables
;
i
++
)
{
BaseString
::
snprintf
(
tabName
,
256
,
"MAXTAB%d"
,
i
);
BaseString
::
snprintf
(
tabName
,
256
,
"MAXTAB%d"
,
i
);
if
(
pNdb
->
waitUntilReady
(
30
)
!=
0
)
{
if
(
pNdb
->
waitUntilReady
(
30
)
!=
0
){
// Db is not ready, return with failure
// Db is not ready, return with failure
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
// Verify that table exists in db
// Verify that table exists in db
const
NdbDictionary
::
Table
*
pTab3
=
const
NdbDictionary
::
Table
*
pTab3
=
NDBT_Table
::
discoverTableFromDb
(
pNdb
,
tabName
)
;
NDBT_Table
::
discoverTableFromDb
(
pNdb
,
tabName
)
;
if
(
pTab3
==
NULL
){
if
(
pTab3
==
NULL
)
{
ndbout
<<
tabName
<<
" was not found in DB"
<<
endl
;
ndbout
<<
tabName
<<
" was not found in DB: "
continue
;
<<
pDic
->
getNdbError
()
<<
endl
;
return
NDBT_FAILED
;
}
}
// Try to drop table in db
// Try to drop table in db
if
(
pNdb
->
getDictionary
()
->
dropTable
(
pTab3
->
getName
())
!=
0
){
if
(
pDic
->
dropTable
(
pTab3
->
getName
())
!=
0
)
{
ndbout
<<
tabName
<<
" coult not be dropped"
<<
endl
;
ndbout
<<
tabName
<<
" could not be dropped: "
result
=
NDBT_FAILED
;
<<
pDic
->
getNdbError
()
<<
endl
;
return
NDBT_FAILED
;
}
}
}
}
return
result
;
return
NDBT_OK
;
}
}
int
runTestFragmentTypes
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
int
runTestFragmentTypes
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
...
@@ -1622,7 +1618,7 @@ TESTCASE("CreateMaxTables",
...
@@ -1622,7 +1618,7 @@ TESTCASE("CreateMaxTables",
"Create tables until db says that it can't create any more
\n
"
){
"Create tables until db says that it can't create any more
\n
"
){
TC_PROPERTY
(
"tables"
,
1000
);
TC_PROPERTY
(
"tables"
,
1000
);
INITIALIZER
(
runCreateMaxTables
);
INITIALIZER
(
runCreateMaxTables
);
FIN
ALIZER
(
runDropMaxTables
);
INITI
ALIZER
(
runDropMaxTables
);
}
}
TESTCASE
(
"PkSizes"
,
TESTCASE
(
"PkSizes"
,
"Create tables with all different primary key sizes.
\n
"
\
"Create tables with all different primary key sizes.
\n
"
\
...
...
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