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
4614cdfa
Commit
4614cdfa
authored
Dec 09, 2004
by
joreland@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug#6995 - fixed so that ndb_restore 4.1.8 can read files
created by 4.1.7 as bugfix changed binary format
parent
0ab8c723
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
6 deletions
+42
-6
ndb/tools/restore/Restore.cpp
ndb/tools/restore/Restore.cpp
+31
-4
ndb/tools/restore/Restore.hpp
ndb/tools/restore/Restore.hpp
+3
-1
ndb/tools/restore/main.cpp
ndb/tools/restore/main.cpp
+8
-1
No files found.
ndb/tools/restore/Restore.cpp
View file @
4614cdfa
...
@@ -192,13 +192,14 @@ RestoreMetaData::readGCPEntry() {
...
@@ -192,13 +192,14 @@ RestoreMetaData::readGCPEntry() {
return
true
;
return
true
;
}
}
TableS
::
TableS
(
NdbTableImpl
*
tableImpl
)
TableS
::
TableS
(
Uint32
version
,
NdbTableImpl
*
tableImpl
)
:
m_dictTable
(
tableImpl
)
:
m_dictTable
(
tableImpl
)
{
{
m_dictTable
=
tableImpl
;
m_dictTable
=
tableImpl
;
m_noOfNullable
=
m_nullBitmaskSize
=
0
;
m_noOfNullable
=
m_nullBitmaskSize
=
0
;
m_auto_val_id
=
~
(
Uint32
)
0
;
m_auto_val_id
=
~
(
Uint32
)
0
;
m_max_auto_val
=
0
;
m_max_auto_val
=
0
;
backupVersion
=
version
;
for
(
int
i
=
0
;
i
<
tableImpl
->
getNoOfColumns
();
i
++
)
for
(
int
i
=
0
;
i
<
tableImpl
->
getNoOfColumns
();
i
++
)
createAttr
(
tableImpl
->
getColumn
(
i
));
createAttr
(
tableImpl
->
getColumn
(
i
));
...
@@ -226,11 +227,10 @@ RestoreMetaData::parseTableDescriptor(const Uint32 * data, Uint32 len)
...
@@ -226,11 +227,10 @@ RestoreMetaData::parseTableDescriptor(const Uint32 * data, Uint32 len)
debug
<<
"parseTableInfo "
<<
tableImpl
->
getName
()
<<
" done"
<<
endl
;
debug
<<
"parseTableInfo "
<<
tableImpl
->
getName
()
<<
" done"
<<
endl
;
TableS
*
table
=
new
TableS
(
tableImpl
);
TableS
*
table
=
new
TableS
(
m_fileHeader
.
NdbVersion
,
tableImpl
);
if
(
table
==
NULL
)
{
if
(
table
==
NULL
)
{
return
false
;
return
false
;
}
}
table
->
setBackupVersion
(
m_fileHeader
.
NdbVersion
);
debug
<<
"Parsed table id "
<<
table
->
getTableId
()
<<
endl
;
debug
<<
"Parsed table id "
<<
table
->
getTableId
()
<<
endl
;
debug
<<
"Parsed table #attr "
<<
table
->
getNoOfAttributes
()
<<
endl
;
debug
<<
"Parsed table #attr "
<<
table
->
getNoOfAttributes
()
<<
endl
;
...
@@ -334,6 +334,27 @@ RestoreDataIterator::getNextTuple(int & res)
...
@@ -334,6 +334,27 @@ RestoreDataIterator::getNextTuple(int & res)
Uint32
*
buf_ptr
=
(
Uint32
*
)
_buf_ptr
,
*
ptr
=
buf_ptr
;
Uint32
*
buf_ptr
=
(
Uint32
*
)
_buf_ptr
,
*
ptr
=
buf_ptr
;
ptr
+=
m_currentTable
->
m_nullBitmaskSize
;
ptr
+=
m_currentTable
->
m_nullBitmaskSize
;
Uint32
i
;
Uint32
i
;
for
(
i
=
0
;
i
<
m_currentTable
->
m_fixedKeys
.
size
();
i
++
){
assert
(
ptr
<
buf_ptr
+
dataLength
);
const
Uint32
attrId
=
m_currentTable
->
m_fixedKeys
[
i
]
->
attrId
;
AttributeData
*
attr_data
=
m_tuple
.
getData
(
attrId
);
const
AttributeDesc
*
attr_desc
=
m_tuple
.
getDesc
(
attrId
);
const
Uint32
sz
=
attr_desc
->
getSizeInWords
();
attr_data
->
null
=
false
;
attr_data
->
void_value
=
ptr
;
if
(
!
Twiddle
(
attr_desc
,
attr_data
))
{
res
=
-
1
;
return
NULL
;
}
ptr
+=
sz
;
}
for
(
i
=
0
;
i
<
m_currentTable
->
m_fixedAttribs
.
size
();
i
++
){
for
(
i
=
0
;
i
<
m_currentTable
->
m_fixedAttribs
.
size
();
i
++
){
assert
(
ptr
<
buf_ptr
+
dataLength
);
assert
(
ptr
<
buf_ptr
+
dataLength
);
...
@@ -678,6 +699,12 @@ void TableS::createAttr(NdbDictionary::Column *column)
...
@@ -678,6 +699,12 @@ void TableS::createAttr(NdbDictionary::Column *column)
if
(
d
->
m_column
->
getAutoIncrement
())
if
(
d
->
m_column
->
getAutoIncrement
())
m_auto_val_id
=
d
->
attrId
;
m_auto_val_id
=
d
->
attrId
;
if
(
d
->
m_column
->
getPrimaryKey
()
&&
backupVersion
<=
MAKE_VERSION
(
4
,
1
,
7
))
{
m_fixedKeys
.
push_back
(
d
);
return
;
}
if
(
!
d
->
m_column
->
getNullable
())
if
(
!
d
->
m_column
->
getNullable
())
{
{
m_fixedAttribs
.
push_back
(
d
);
m_fixedAttribs
.
push_back
(
d
);
...
...
ndb/tools/restore/Restore.hpp
View file @
4614cdfa
...
@@ -123,6 +123,8 @@ class TableS {
...
@@ -123,6 +123,8 @@ class TableS {
Uint32
schemaVersion
;
Uint32
schemaVersion
;
Uint32
backupVersion
;
Uint32
backupVersion
;
Vector
<
AttributeDesc
*>
allAttributesDesc
;
Vector
<
AttributeDesc
*>
allAttributesDesc
;
Vector
<
AttributeDesc
*>
m_fixedKeys
;
//Vector<AttributeDesc *> m_variableKey;
Vector
<
AttributeDesc
*>
m_fixedAttribs
;
Vector
<
AttributeDesc
*>
m_fixedAttribs
;
Vector
<
AttributeDesc
*>
m_variableAttribs
;
Vector
<
AttributeDesc
*>
m_variableAttribs
;
...
@@ -138,7 +140,7 @@ class TableS {
...
@@ -138,7 +140,7 @@ class TableS {
public:
public:
class
NdbDictionary
::
Table
*
m_dictTable
;
class
NdbDictionary
::
Table
*
m_dictTable
;
TableS
(
class
NdbTableImpl
*
dictTable
);
TableS
(
Uint32
version
,
class
NdbTableImpl
*
dictTable
);
~
TableS
();
~
TableS
();
Uint32
getTableId
()
const
{
Uint32
getTableId
()
const
{
...
...
ndb/tools/restore/main.cpp
View file @
4614cdfa
...
@@ -247,6 +247,13 @@ main(int argc, char** argv)
...
@@ -247,6 +247,13 @@ main(int argc, char** argv)
ndbout
<<
"Failed to read "
<<
metaData
.
getFilename
()
<<
endl
<<
endl
;
ndbout
<<
"Failed to read "
<<
metaData
.
getFilename
()
<<
endl
<<
endl
;
return
-
1
;
return
-
1
;
}
}
const
BackupFormat
::
FileHeader
&
tmp
=
metaData
.
getFileHeader
();
const
Uint32
version
=
tmp
.
NdbVersion
;
ndbout
<<
"Ndb version in backup files: "
<<
getVersionString
(
version
,
0
)
<<
endl
;
/**
/**
* check wheater we can restore the backup (right version).
* check wheater we can restore the backup (right version).
*/
*/
...
...
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