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
bf8dfb30
Commit
bf8dfb30
authored
Mar 23, 2006
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge pnousiainen@bk-internal.mysql.com:/home/bk/mysql-5.1-new
into mysql.com:/export/space/pekka/ndb/version/my51
parents
c7df2c6a
8bc7214f
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
152 additions
and
41 deletions
+152
-41
sql/ha_ndbcluster_binlog.cc
sql/ha_ndbcluster_binlog.cc
+58
-22
storage/ndb/include/ndbapi/NdbDictionary.hpp
storage/ndb/include/ndbapi/NdbDictionary.hpp
+1
-1
storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
+1
-0
storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp
storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp
+6
-0
storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp
storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp
+12
-3
storage/ndb/src/ndbapi/NdbBlob.cpp
storage/ndb/src/ndbapi/NdbBlob.cpp
+6
-1
storage/ndb/tools/restore/Restore.cpp
storage/ndb/tools/restore/Restore.cpp
+48
-0
storage/ndb/tools/restore/Restore.hpp
storage/ndb/tools/restore/Restore.hpp
+6
-1
storage/ndb/tools/restore/restore_main.cpp
storage/ndb/tools/restore/restore_main.cpp
+14
-13
No files found.
sql/ha_ndbcluster_binlog.cc
View file @
bf8dfb30
...
@@ -746,10 +746,10 @@ static int ndbcluster_create_schema_table(THD *thd)
...
@@ -746,10 +746,10 @@ static int ndbcluster_create_schema_table(THD *thd)
*/
*/
end
=
strmov
(
buf
,
"CREATE TABLE IF NOT EXISTS "
end
=
strmov
(
buf
,
"CREATE TABLE IF NOT EXISTS "
NDB_REP_DB
"."
NDB_SCHEMA_TABLE
NDB_REP_DB
"."
NDB_SCHEMA_TABLE
" ( db VAR
CHAR
(63) NOT NULL,"
" ( db VAR
BINARY
(63) NOT NULL,"
" name VAR
CHAR
(63) NOT NULL,"
" name VAR
BINARY
(63) NOT NULL,"
" slock BINARY(32) NOT NULL,"
" slock BINARY(32) NOT NULL,"
" query
VARCHAR(4094)
NOT NULL,"
" query
BLOB
NOT NULL,"
" node_id INT UNSIGNED NOT NULL,"
" node_id INT UNSIGNED NOT NULL,"
" epoch BIGINT UNSIGNED NOT NULL,"
" epoch BIGINT UNSIGNED NOT NULL,"
" id INT UNSIGNED NOT NULL,"
" id INT UNSIGNED NOT NULL,"
...
@@ -802,7 +802,6 @@ void ndbcluster_setup_binlog_table_shares(THD *thd)
...
@@ -802,7 +802,6 @@ void ndbcluster_setup_binlog_table_shares(THD *thd)
#define SCHEMA_TYPE_I 8u
#define SCHEMA_TYPE_I 8u
#define SCHEMA_SIZE 9u
#define SCHEMA_SIZE 9u
#define SCHEMA_SLOCK_SIZE 32u
#define SCHEMA_SLOCK_SIZE 32u
#define SCHEMA_QUERY_SIZE 4096u
struct
Cluster_schema
struct
Cluster_schema
{
{
...
@@ -813,7 +812,7 @@ struct Cluster_schema
...
@@ -813,7 +812,7 @@ struct Cluster_schema
unsigned
char
slock_length
;
unsigned
char
slock_length
;
uint32
slock
[
SCHEMA_SLOCK_SIZE
/
4
];
uint32
slock
[
SCHEMA_SLOCK_SIZE
/
4
];
unsigned
short
query_length
;
unsigned
short
query_length
;
char
query
[
SCHEMA_QUERY_SIZE
]
;
char
*
query
;
Uint64
epoch
;
Uint64
epoch
;
uint32
node_id
;
uint32
node_id
;
uint32
id
;
uint32
id
;
...
@@ -824,10 +823,26 @@ struct Cluster_schema
...
@@ -824,10 +823,26 @@ struct Cluster_schema
/*
/*
Transfer schema table data into corresponding struct
Transfer schema table data into corresponding struct
*/
*/
static
void
ndbcluster_get_schema
(
TABLE
*
tabl
e
,
static
void
ndbcluster_get_schema
(
NDB_SHARE
*
shar
e
,
Cluster_schema
*
s
)
Cluster_schema
*
s
)
{
{
TABLE
*
table
=
share
->
table
;
Field
**
field
;
Field
**
field
;
/* unpack blob values */
byte
*
blobs_buffer
=
0
;
uint
blobs_buffer_size
=
0
;
{
ptrdiff_t
ptrdiff
=
0
;
int
ret
=
get_ndb_blobs_value
(
table
,
share
->
ndb_value
[
0
],
blobs_buffer
,
blobs_buffer_size
,
ptrdiff
);
if
(
ret
!=
0
)
{
my_free
(
blobs_buffer
,
MYF
(
MY_ALLOW_ZERO_PTR
));
DBUG_PRINT
(
"info"
,
(
"blob read error"
));
DBUG_ASSERT
(
false
);
}
}
/* db varchar 1 length byte */
/* db varchar 1 length byte */
field
=
table
->
field
;
field
=
table
->
field
;
s
->
db_length
=
*
(
uint8
*
)(
*
field
)
->
ptr
;
s
->
db_length
=
*
(
uint8
*
)(
*
field
)
->
ptr
;
...
@@ -847,13 +862,19 @@ static void ndbcluster_get_schema(TABLE *table,
...
@@ -847,13 +862,19 @@ static void ndbcluster_get_schema(TABLE *table,
s
->
slock_length
=
(
*
field
)
->
field_length
;
s
->
slock_length
=
(
*
field
)
->
field_length
;
DBUG_ASSERT
((
*
field
)
->
field_length
==
sizeof
(
s
->
slock
));
DBUG_ASSERT
((
*
field
)
->
field_length
==
sizeof
(
s
->
slock
));
memcpy
(
s
->
slock
,
(
*
field
)
->
ptr
,
s
->
slock_length
);
memcpy
(
s
->
slock
,
(
*
field
)
->
ptr
,
s
->
slock_length
);
/* query
varchar 2 length bytes
*/
/* query
blob
*/
field
++
;
field
++
;
s
->
query_length
=
uint2korr
((
*
field
)
->
ptr
);
{
DBUG_ASSERT
(
s
->
query_length
<=
(
*
field
)
->
field_length
);
Field_blob
*
field_blob
=
(
Field_blob
*
)(
*
field
);
DBUG_ASSERT
((
*
field
)
->
field_length
+
2
==
sizeof
(
s
->
query
));
uint
blob_len
=
field_blob
->
get_length
((
*
field
)
->
ptr
);
memcpy
(
s
->
query
,
(
*
field
)
->
ptr
+
2
,
s
->
query_length
);
char
*
blob_ptr
=
0
;
s
->
query
[
s
->
query_length
]
=
0
;
field_blob
->
get_ptr
(
&
blob_ptr
);
assert
(
blob_len
==
0
||
blob_ptr
!=
0
);
s
->
query_length
=
blob_len
;
s
->
query
=
sql_alloc
(
blob_len
+
1
);
memcpy
(
s
->
query
,
blob_ptr
,
blob_len
);
s
->
query
[
blob_len
]
=
0
;
}
/* node_id */
/* node_id */
field
++
;
field
++
;
s
->
node_id
=
((
Field_long
*
)
*
field
)
->
val_int
();
s
->
node_id
=
((
Field_long
*
)
*
field
)
->
val_int
();
...
@@ -869,6 +890,8 @@ static void ndbcluster_get_schema(TABLE *table,
...
@@ -869,6 +890,8 @@ static void ndbcluster_get_schema(TABLE *table,
/* type */
/* type */
field
++
;
field
++
;
s
->
type
=
((
Field_long
*
)
*
field
)
->
val_int
();
s
->
type
=
((
Field_long
*
)
*
field
)
->
val_int
();
/* free blobs buffer */
my_free
(
blobs_buffer
,
MYF
(
MY_ALLOW_ZERO_PTR
));
}
}
/*
/*
...
@@ -1013,7 +1036,7 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share,
...
@@ -1013,7 +1036,7 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share,
char
save_db
[
FN_REFLEN
];
char
save_db
[
FN_REFLEN
];
strcpy
(
save_db
,
ndb
->
getDatabaseName
());
strcpy
(
save_db
,
ndb
->
getDatabaseName
());
char
tmp_buf
[
SCHEMA_QUERY_SIZE
];
char
tmp_buf
[
FN_REFLEN
];
NDBDICT
*
dict
=
ndb
->
getDictionary
();
NDBDICT
*
dict
=
ndb
->
getDictionary
();
ndb
->
setDatabaseName
(
NDB_REP_DB
);
ndb
->
setDatabaseName
(
NDB_REP_DB
);
const
NDBTAB
*
ndbtab
=
dict
->
getTable
(
NDB_SCHEMA_TABLE
);
const
NDBTAB
*
ndbtab
=
dict
->
getTable
(
NDB_SCHEMA_TABLE
);
...
@@ -1037,10 +1060,13 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share,
...
@@ -1037,10 +1060,13 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share,
for
(
i
=
0
;
i
<
SCHEMA_SIZE
;
i
++
)
for
(
i
=
0
;
i
<
SCHEMA_SIZE
;
i
++
)
{
{
col
[
i
]
=
ndbtab
->
getColumn
(
i
);
col
[
i
]
=
ndbtab
->
getColumn
(
i
);
if
(
i
!=
SCHEMA_QUERY_I
)
{
sz
[
i
]
=
col
[
i
]
->
getLength
();
sz
[
i
]
=
col
[
i
]
->
getLength
();
DBUG_ASSERT
(
sz
[
i
]
<=
sizeof
(
tmp_buf
));
DBUG_ASSERT
(
sz
[
i
]
<=
sizeof
(
tmp_buf
));
}
}
}
}
}
while
(
1
)
while
(
1
)
{
{
...
@@ -1068,9 +1094,14 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share,
...
@@ -1068,9 +1094,14 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share,
r
|=
op
->
setValue
(
SCHEMA_SLOCK_I
,
(
char
*
)
schema_subscribers
.
bitmap
);
r
|=
op
->
setValue
(
SCHEMA_SLOCK_I
,
(
char
*
)
schema_subscribers
.
bitmap
);
DBUG_ASSERT
(
r
==
0
);
DBUG_ASSERT
(
r
==
0
);
/* query */
/* query */
ndb_pack_varchar
(
col
[
SCHEMA_QUERY_I
],
tmp_buf
,
query
,
query_length
);
{
r
|=
op
->
setValue
(
SCHEMA_QUERY_I
,
tmp_buf
);
NdbBlob
*
ndb_blob
=
op
->
getBlobHandle
(
SCHEMA_QUERY_I
);
DBUG_ASSERT
(
ndb_blob
!=
0
);
uint
blob_len
=
query_length
;
const
char
*
blob_ptr
=
query
;
r
|=
ndb_blob
->
setValue
(
blob_ptr
,
blob_len
);
DBUG_ASSERT
(
r
==
0
);
DBUG_ASSERT
(
r
==
0
);
}
/* node_id */
/* node_id */
r
|=
op
->
setValue
(
SCHEMA_NODE_ID_I
,
node_id
);
r
|=
op
->
setValue
(
SCHEMA_NODE_ID_I
,
node_id
);
DBUG_ASSERT
(
r
==
0
);
DBUG_ASSERT
(
r
==
0
);
...
@@ -1203,7 +1234,7 @@ ndbcluster_update_slock(THD *thd,
...
@@ -1203,7 +1234,7 @@ ndbcluster_update_slock(THD *thd,
char
save_db
[
FN_HEADLEN
];
char
save_db
[
FN_HEADLEN
];
strcpy
(
save_db
,
ndb
->
getDatabaseName
());
strcpy
(
save_db
,
ndb
->
getDatabaseName
());
char
tmp_buf
[
SCHEMA_QUERY_SIZE
];
char
tmp_buf
[
FN_REFLEN
];
NDBDICT
*
dict
=
ndb
->
getDictionary
();
NDBDICT
*
dict
=
ndb
->
getDictionary
();
ndb
->
setDatabaseName
(
NDB_REP_DB
);
ndb
->
setDatabaseName
(
NDB_REP_DB
);
const
NDBTAB
*
ndbtab
=
dict
->
getTable
(
NDB_SCHEMA_TABLE
);
const
NDBTAB
*
ndbtab
=
dict
->
getTable
(
NDB_SCHEMA_TABLE
);
...
@@ -1227,10 +1258,13 @@ ndbcluster_update_slock(THD *thd,
...
@@ -1227,10 +1258,13 @@ ndbcluster_update_slock(THD *thd,
for
(
i
=
0
;
i
<
SCHEMA_SIZE
;
i
++
)
for
(
i
=
0
;
i
<
SCHEMA_SIZE
;
i
++
)
{
{
col
[
i
]
=
ndbtab
->
getColumn
(
i
);
col
[
i
]
=
ndbtab
->
getColumn
(
i
);
if
(
i
!=
SCHEMA_QUERY_I
)
{
sz
[
i
]
=
col
[
i
]
->
getLength
();
sz
[
i
]
=
col
[
i
]
->
getLength
();
DBUG_ASSERT
(
sz
[
i
]
<=
sizeof
(
tmp_buf
));
DBUG_ASSERT
(
sz
[
i
]
<=
sizeof
(
tmp_buf
));
}
}
}
}
}
while
(
1
)
while
(
1
)
{
{
...
@@ -1506,7 +1540,7 @@ ndb_binlog_thread_handle_schema_event(THD *thd, Ndb *ndb,
...
@@ -1506,7 +1540,7 @@ ndb_binlog_thread_handle_schema_event(THD *thd, Ndb *ndb,
MY_BITMAP
slock
;
MY_BITMAP
slock
;
bitmap_init
(
&
slock
,
schema
->
slock
,
8
*
SCHEMA_SLOCK_SIZE
,
false
);
bitmap_init
(
&
slock
,
schema
->
slock
,
8
*
SCHEMA_SLOCK_SIZE
,
false
);
uint
node_id
=
g_ndb_cluster_connection
->
node_id
();
uint
node_id
=
g_ndb_cluster_connection
->
node_id
();
ndbcluster_get_schema
(
share
->
table
,
schema
);
ndbcluster_get_schema
(
share
,
schema
);
if
(
schema
->
node_id
!=
node_id
)
if
(
schema
->
node_id
!=
node_id
)
{
{
int
log_query
=
0
,
post_epoch_unlock
=
0
;
int
log_query
=
0
,
post_epoch_unlock
=
0
;
...
@@ -2265,6 +2299,7 @@ ndbcluster_create_event_ops(NDB_SHARE *share, const NDBTAB *ndbtab,
...
@@ -2265,6 +2299,7 @@ ndbcluster_create_event_ops(NDB_SHARE *share, const NDBTAB *ndbtab,
*/
*/
DBUG_ENTER
(
"ndbcluster_create_event_ops"
);
DBUG_ENTER
(
"ndbcluster_create_event_ops"
);
DBUG_PRINT
(
"enter"
,
(
"table: %s event: %s"
,
ndbtab
->
getName
(),
event_name
));
DBUG_ASSERT
(
!
IS_NDB_BLOB_PREFIX
(
ndbtab
->
getName
()));
DBUG_ASSERT
(
!
IS_NDB_BLOB_PREFIX
(
ndbtab
->
getName
()));
DBUG_ASSERT
(
share
!=
0
);
DBUG_ASSERT
(
share
!=
0
);
...
@@ -2374,6 +2409,7 @@ ndbcluster_create_event_ops(NDB_SHARE *share, const NDBTAB *ndbtab,
...
@@ -2374,6 +2409,7 @@ ndbcluster_create_event_ops(NDB_SHARE *share, const NDBTAB *ndbtab,
else
else
{
{
DBUG_PRINT
(
"info"
,
(
"%s blob"
,
col_name
));
DBUG_PRINT
(
"info"
,
(
"%s blob"
,
col_name
));
DBUG_ASSERT
(
share
->
flags
&
NSF_BLOB_FLAG
);
attr0
.
blob
=
op
->
getBlobHandle
(
col_name
);
attr0
.
blob
=
op
->
getBlobHandle
(
col_name
);
attr1
.
blob
=
op
->
getPreBlobHandle
(
col_name
);
attr1
.
blob
=
op
->
getPreBlobHandle
(
col_name
);
if
(
attr0
.
blob
==
NULL
||
attr1
.
blob
==
NULL
)
if
(
attr0
.
blob
==
NULL
||
attr1
.
blob
==
NULL
)
...
...
storage/ndb/include/ndbapi/NdbDictionary.hpp
View file @
bf8dfb30
...
@@ -1164,7 +1164,7 @@ public:
...
@@ -1164,7 +1164,7 @@ public:
*/
*/
enum
EventReport
{
enum
EventReport
{
ER_UPDATED
=
0
,
ER_UPDATED
=
0
,
ER_ALL
=
1
,
ER_ALL
=
1
,
// except not-updated blob inlines
ER_SUBSCRIBE
=
2
ER_SUBSCRIBE
=
2
};
};
...
...
storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
View file @
bf8dfb30
...
@@ -878,6 +878,7 @@ ArrayPool<TupTriggerData> c_triggerPool;
...
@@ -878,6 +878,7 @@ ArrayPool<TupTriggerData> c_triggerPool;
{}
{}
Bitmask
<
MAXNROFATTRIBUTESINWORDS
>
notNullAttributeMask
;
Bitmask
<
MAXNROFATTRIBUTESINWORDS
>
notNullAttributeMask
;
Bitmask
<
MAXNROFATTRIBUTESINWORDS
>
blobAttributeMask
;
ReadFunction
*
readFunctionArray
;
ReadFunction
*
readFunctionArray
;
UpdateFunction
*
updateFunctionArray
;
UpdateFunction
*
updateFunctionArray
;
...
...
storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp
View file @
bf8dfb30
...
@@ -201,6 +201,7 @@ void Dbtup::execTUPFRAGREQ(Signal* signal)
...
@@ -201,6 +201,7 @@ void Dbtup::execTUPFRAGREQ(Signal* signal)
regTabPtr
.
p
->
m_no_of_attributes
=
noOfAttributes
;
regTabPtr
.
p
->
m_no_of_attributes
=
noOfAttributes
;
regTabPtr
.
p
->
notNullAttributeMask
.
clear
();
regTabPtr
.
p
->
notNullAttributeMask
.
clear
();
regTabPtr
.
p
->
blobAttributeMask
.
clear
();
Uint32
offset
[
10
];
Uint32
offset
[
10
];
Uint32
tableDescriptorRef
=
allocTabDescr
(
regTabPtr
.
p
,
offset
);
Uint32
tableDescriptorRef
=
allocTabDescr
(
regTabPtr
.
p
,
offset
);
...
@@ -286,6 +287,7 @@ void Dbtup::execTUP_ADD_ATTRREQ(Signal* signal)
...
@@ -286,6 +287,7 @@ void Dbtup::execTUP_ADD_ATTRREQ(Signal* signal)
ptrCheckGuard
(
fragOperPtr
,
cnoOfFragoprec
,
fragoperrec
);
ptrCheckGuard
(
fragOperPtr
,
cnoOfFragoprec
,
fragoperrec
);
Uint32
attrId
=
signal
->
theData
[
2
];
Uint32
attrId
=
signal
->
theData
[
2
];
Uint32
attrDescriptor
=
signal
->
theData
[
3
];
Uint32
attrDescriptor
=
signal
->
theData
[
3
];
Uint32
extType
=
AttributeDescriptor
::
getType
(
attrDescriptor
);
// DICT sends charset number in upper half
// DICT sends charset number in upper half
Uint32
csNumber
=
(
signal
->
theData
[
4
]
>>
16
);
Uint32
csNumber
=
(
signal
->
theData
[
4
]
>>
16
);
...
@@ -353,6 +355,10 @@ void Dbtup::execTUP_ADD_ATTRREQ(Signal* signal)
...
@@ -353,6 +355,10 @@ void Dbtup::execTUP_ADD_ATTRREQ(Signal* signal)
regTabPtr
.
p
->
notNullAttributeMask
.
set
(
attrId
);
regTabPtr
.
p
->
notNullAttributeMask
.
set
(
attrId
);
}
}
if
(
extType
==
NDB_TYPE_BLOB
||
extType
==
NDB_TYPE_TEXT
)
{
regTabPtr
.
p
->
blobAttributeMask
.
set
(
attrId
);
}
switch
(
AttributeDescriptor
::
getArrayType
(
attrDescriptor
))
{
switch
(
AttributeDescriptor
::
getArrayType
(
attrDescriptor
))
{
case
NDB_ARRAYTYPE_FIXED
:
case
NDB_ARRAYTYPE_FIXED
:
{
{
...
...
storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp
View file @
bf8dfb30
...
@@ -867,10 +867,19 @@ bool Dbtup::readTriggerInfo(TupTriggerData* const trigPtr,
...
@@ -867,10 +867,19 @@ bool Dbtup::readTriggerInfo(TupTriggerData* const trigPtr,
}
else
{
}
else
{
ljam
();
ljam
();
//--------------------------------------------------------------------
//--------------------------------------------------------------------
// All others send all attributes that are monitored
// All others send all attributes that are monitored, except:
// Omit unchanged blob inlines on update i.e.
// attributeMask & ~ (blobAttributeMask & ~ changeMask)
//--------------------------------------------------------------------
//--------------------------------------------------------------------
numAttrsToRead
=
setAttrIds
(
trigPtr
->
attributeMask
,
Bitmask
<
MAXNROFATTRIBUTESINWORDS
>
attributeMask
;
regTabPtr
->
m_no_of_attributes
,
&
readBuffer
[
0
]);
attributeMask
=
trigPtr
->
attributeMask
;
if
(
regOperPtr
->
op_struct
.
op_type
==
ZUPDATE
)
{
Bitmask
<
MAXNROFATTRIBUTESINWORDS
>
tmpMask
=
regTabPtr
->
blobAttributeMask
;
tmpMask
.
bitANDC
(
req_struct
->
changeMask
);
attributeMask
.
bitANDC
(
tmpMask
);
}
numAttrsToRead
=
setAttrIds
(
attributeMask
,
regTabPtr
->
m_no_of_attributes
,
&
readBuffer
[
0
]);
}
}
ndbrequire
(
numAttrsToRead
<
MAX_ATTRIBUTES_IN_TABLE
);
ndbrequire
(
numAttrsToRead
<
MAX_ATTRIBUTES_IN_TABLE
);
//--------------------------------------------------------------------
//--------------------------------------------------------------------
...
...
storage/ndb/src/ndbapi/NdbBlob.cpp
View file @
bf8dfb30
...
@@ -598,6 +598,8 @@ NdbBlob::getHeadFromRecAttr()
...
@@ -598,6 +598,8 @@ NdbBlob::getHeadFromRecAttr()
theNullFlag
=
theHeadInlineRecAttr
->
isNULL
();
theNullFlag
=
theHeadInlineRecAttr
->
isNULL
();
assert
(
theEventBlobVersion
>=
0
||
theNullFlag
!=
-
1
);
assert
(
theEventBlobVersion
>=
0
||
theNullFlag
!=
-
1
);
theLength
=
!
theNullFlag
?
theHead
->
length
:
0
;
theLength
=
!
theNullFlag
?
theHead
->
length
:
0
;
DBUG_PRINT
(
"info"
,
(
"theNullFlag=%d theLength=%llu"
,
theNullFlag
,
theLength
));
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
@@ -1835,10 +1837,13 @@ int
...
@@ -1835,10 +1837,13 @@ int
NdbBlob
::
atNextEvent
()
NdbBlob
::
atNextEvent
()
{
{
DBUG_ENTER
(
"NdbBlob::atNextEvent"
);
DBUG_ENTER
(
"NdbBlob::atNextEvent"
);
DBUG_PRINT
(
"info"
,
(
"this=%p op=%p blob op=%p version=%d"
,
this
,
theEventOp
,
theBlobEventOp
,
theEventBlobVersion
));
Uint32
optype
=
theEventOp
->
m_data_item
->
sdata
->
operation
;
DBUG_PRINT
(
"info"
,
(
"this=%p op=%p blob op=%p version=%d optype=%u"
,
this
,
theEventOp
,
theBlobEventOp
,
theEventBlobVersion
,
optype
));
if
(
theState
==
Invalid
)
if
(
theState
==
Invalid
)
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
-
1
);
assert
(
theEventBlobVersion
>=
0
);
assert
(
theEventBlobVersion
>=
0
);
if
(
optype
>=
NdbDictionary
::
Event
::
_TE_FIRST_NON_DATA_EVENT
)
DBUG_RETURN
(
0
);
getHeadFromRecAttr
();
getHeadFromRecAttr
();
if
(
theNullFlag
==
-
1
)
// value not defined
if
(
theNullFlag
==
-
1
)
// value not defined
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
...
...
storage/ndb/tools/restore/Restore.cpp
View file @
bf8dfb30
...
@@ -26,6 +26,8 @@
...
@@ -26,6 +26,8 @@
#include <signaldata/DictTabInfo.hpp>
#include <signaldata/DictTabInfo.hpp>
#include <ndb_limits.h>
#include <ndb_limits.h>
#include "../../../../sql/ha_ndbcluster_tables.h"
Uint16
Twiddle16
(
Uint16
in
);
// Byte shift 16-bit data
Uint16
Twiddle16
(
Uint16
in
);
// Byte shift 16-bit data
Uint32
Twiddle32
(
Uint32
in
);
// Byte shift 32-bit data
Uint32
Twiddle32
(
Uint32
in
);
// Byte shift 32-bit data
Uint64
Twiddle64
(
Uint64
in
);
// Byte shift 64-bit data
Uint64
Twiddle64
(
Uint64
in
);
// Byte shift 64-bit data
...
@@ -111,6 +113,8 @@ RestoreMetaData::loadContent()
...
@@ -111,6 +113,8 @@ RestoreMetaData::loadContent()
return
0
;
return
0
;
}
}
}
}
if
(
!
markSysTables
())
return
0
;
if
(
!
readGCPEntry
())
if
(
!
readGCPEntry
())
return
0
;
return
0
;
return
1
;
return
1
;
...
@@ -275,6 +279,49 @@ end:
...
@@ -275,6 +279,49 @@ end:
return
true
;
return
true
;
}
}
bool
RestoreMetaData
::
markSysTables
()
{
Uint32
i
;
for
(
i
=
0
;
i
<
getNoOfTables
();
i
++
)
{
TableS
*
table
=
allTables
[
i
];
const
char
*
tableName
=
table
->
getTableName
();
if
(
// XXX should use type
strcmp
(
tableName
,
"SYSTAB_0"
)
==
0
||
strcmp
(
tableName
,
"NDB$EVENTS_0"
)
==
0
||
strcmp
(
tableName
,
"sys/def/SYSTAB_0"
)
==
0
||
strcmp
(
tableName
,
"sys/def/NDB$EVENTS_0"
)
==
0
||
strcmp
(
tableName
,
NDB_REP_DB
"/def/"
NDB_APPLY_TABLE
)
==
0
||
strcmp
(
tableName
,
NDB_REP_DB
"/def/"
NDB_SCHEMA_TABLE
)
==
0
)
table
->
isSysTable
=
true
;
}
for
(
i
=
0
;
i
<
getNoOfTables
();
i
++
)
{
TableS
*
blobTable
=
allTables
[
i
];
const
char
*
blobTableName
=
blobTable
->
getTableName
();
// yet another match blob
int
cnt
,
id1
,
id2
;
char
buf
[
256
];
cnt
=
sscanf
(
blobTableName
,
"%[^/]/%[^/]/NDB$BLOB_%d_%d"
,
buf
,
buf
,
&
id1
,
&
id2
);
if
(
cnt
==
4
)
{
Uint32
j
;
for
(
j
=
0
;
j
<
getNoOfTables
();
j
++
)
{
TableS
*
table
=
allTables
[
j
];
if
(
table
->
getTableId
()
==
id1
)
{
if
(
table
->
isSysTable
)
blobTable
->
isSysTable
=
true
;
break
;
}
}
if
(
j
==
getNoOfTables
())
{
err
<<
"Restore: Bad primary table id in "
<<
blobTableName
<<
endl
;
return
false
;
}
}
}
return
true
;
}
bool
bool
RestoreMetaData
::
readGCPEntry
()
{
RestoreMetaData
::
readGCPEntry
()
{
...
@@ -312,6 +359,7 @@ TableS::TableS(Uint32 version, NdbTableImpl* tableImpl)
...
@@ -312,6 +359,7 @@ TableS::TableS(Uint32 version, NdbTableImpl* tableImpl)
m_auto_val_id
=
~
(
Uint32
)
0
;
m_auto_val_id
=
~
(
Uint32
)
0
;
m_max_auto_val
=
0
;
m_max_auto_val
=
0
;
backupVersion
=
version
;
backupVersion
=
version
;
isSysTable
=
false
;
for
(
int
i
=
0
;
i
<
tableImpl
->
getNoOfColumns
();
i
++
)
for
(
int
i
=
0
;
i
<
tableImpl
->
getNoOfColumns
();
i
++
)
createAttr
(
tableImpl
->
getColumn
(
i
));
createAttr
(
tableImpl
->
getColumn
(
i
));
...
...
storage/ndb/tools/restore/Restore.hpp
View file @
bf8dfb30
...
@@ -134,7 +134,7 @@ class TableS {
...
@@ -134,7 +134,7 @@ class TableS {
Uint32
m_auto_val_id
;
Uint32
m_auto_val_id
;
Uint64
m_max_auto_val
;
Uint64
m_max_auto_val
;
int
pos
;
bool
isSysTable
;
void
createAttr
(
NdbDictionary
::
Column
*
column
);
void
createAttr
(
NdbDictionary
::
Column
*
column
);
...
@@ -222,6 +222,10 @@ public:
...
@@ -222,6 +222,10 @@ public:
return
allAttributesDesc
[
attributeId
];
return
allAttributesDesc
[
attributeId
];
}
}
bool
getSysTable
()
const
{
return
isSysTable
;
}
TableS
&
operator
=
(
TableS
&
org
)
;
TableS
&
operator
=
(
TableS
&
org
)
;
};
// TableS;
};
// TableS;
...
@@ -279,6 +283,7 @@ class RestoreMetaData : public BackupFile {
...
@@ -279,6 +283,7 @@ class RestoreMetaData : public BackupFile {
Vector
<
TableS
*>
allTables
;
Vector
<
TableS
*>
allTables
;
bool
readMetaFileHeader
();
bool
readMetaFileHeader
();
bool
readMetaTableDesc
();
bool
readMetaTableDesc
();
bool
markSysTables
();
bool
readGCPEntry
();
bool
readGCPEntry
();
Uint32
readMetaTableList
();
Uint32
readMetaTableList
();
...
...
storage/ndb/tools/restore/restore_main.cpp
View file @
bf8dfb30
...
@@ -411,16 +411,17 @@ clearConsumers()
...
@@ -411,16 +411,17 @@ clearConsumers()
g_consumers
.
clear
();
g_consumers
.
clear
();
}
}
static
bool
static
inline
bool
checkSysTable
(
const
char
*
tableName
)
checkSysTable
(
const
TableS
*
table
)
{
{
return
ga_dont_ignore_systab_0
||
return
ga_dont_ignore_systab_0
||
!
table
->
getSysTable
();
(
strcmp
(
tableName
,
"SYSTAB_0"
)
!=
0
&&
}
strcmp
(
tableName
,
"NDB$EVENTS_0"
)
!=
0
&&
strcmp
(
tableName
,
"sys/def/SYSTAB_0"
)
!=
0
&&
static
inline
bool
strcmp
(
tableName
,
"sys/def/NDB$EVENTS_0"
)
!=
0
&&
checkSysTable
(
const
RestoreMetaData
&
metaData
,
uint
i
)
strcmp
(
tableName
,
NDB_REP_DB
"/def/"
NDB_APPLY_TABLE
)
!=
0
&&
{
strcmp
(
tableName
,
NDB_REP_DB
"/def/"
NDB_SCHEMA_TABLE
)
!=
0
);
assert
(
i
<
metaData
.
getNoOfTables
());
return
checkSysTable
(
metaData
[
i
]);
}
}
static
void
static
void
...
@@ -534,7 +535,7 @@ main(int argc, char** argv)
...
@@ -534,7 +535,7 @@ main(int argc, char** argv)
debug
<<
"Restoring tables"
<<
endl
;
debug
<<
"Restoring tables"
<<
endl
;
for
(
i
=
0
;
i
<
metaData
.
getNoOfTables
();
i
++
)
for
(
i
=
0
;
i
<
metaData
.
getNoOfTables
();
i
++
)
{
{
if
(
checkSysTable
(
metaData
[
i
]
->
getTableName
()
))
if
(
checkSysTable
(
metaData
,
i
))
{
{
for
(
Uint32
j
=
0
;
j
<
g_consumers
.
size
();
j
++
)
for
(
Uint32
j
=
0
;
j
<
g_consumers
.
size
();
j
++
)
if
(
!
g_consumers
[
j
]
->
table
(
*
metaData
[
i
]))
if
(
!
g_consumers
[
j
]
->
table
(
*
metaData
[
i
]))
...
@@ -572,7 +573,7 @@ main(int argc, char** argv)
...
@@ -572,7 +573,7 @@ main(int argc, char** argv)
const
TupleS
*
tuple
;
const
TupleS
*
tuple
;
while
((
tuple
=
dataIter
.
getNextTuple
(
res
=
1
))
!=
0
)
while
((
tuple
=
dataIter
.
getNextTuple
(
res
=
1
))
!=
0
)
{
{
if
(
checkSysTable
(
tuple
->
getTable
()
->
getTableName
()
))
if
(
checkSysTable
(
tuple
->
getTable
()))
for
(
Uint32
i
=
0
;
i
<
g_consumers
.
size
();
i
++
)
for
(
Uint32
i
=
0
;
i
<
g_consumers
.
size
();
i
++
)
g_consumers
[
i
]
->
tuple
(
*
tuple
,
fragmentId
);
g_consumers
[
i
]
->
tuple
(
*
tuple
,
fragmentId
);
}
// while (tuple != NULL);
}
// while (tuple != NULL);
...
@@ -617,7 +618,7 @@ main(int argc, char** argv)
...
@@ -617,7 +618,7 @@ main(int argc, char** argv)
bool
alloc_flag
=
false
;
bool
alloc_flag
=
false
;
while
((
logEntry
=
logIter
.
getNextLogEntry
(
res
=
0
,
&
alloc_flag
))
!=
0
)
while
((
logEntry
=
logIter
.
getNextLogEntry
(
res
=
0
,
&
alloc_flag
))
!=
0
)
{
{
if
(
checkSysTable
(
logEntry
->
m_table
->
getTableName
()
))
if
(
checkSysTable
(
logEntry
->
m_table
))
for
(
Uint32
i
=
0
;
i
<
g_consumers
.
size
();
i
++
)
for
(
Uint32
i
=
0
;
i
<
g_consumers
.
size
();
i
++
)
g_consumers
[
i
]
->
logEntry
(
*
logEntry
);
g_consumers
[
i
]
->
logEntry
(
*
logEntry
);
if
(
alloc_flag
)
if
(
alloc_flag
)
...
@@ -638,7 +639,7 @@ main(int argc, char** argv)
...
@@ -638,7 +639,7 @@ main(int argc, char** argv)
{
{
for
(
i
=
0
;
i
<
metaData
.
getNoOfTables
();
i
++
)
for
(
i
=
0
;
i
<
metaData
.
getNoOfTables
();
i
++
)
{
{
if
(
checkSysTable
(
metaData
[
i
]
->
getTableName
()
))
if
(
checkSysTable
(
metaData
,
i
))
{
{
for
(
Uint32
j
=
0
;
j
<
g_consumers
.
size
();
j
++
)
for
(
Uint32
j
=
0
;
j
<
g_consumers
.
size
();
j
++
)
if
(
!
g_consumers
[
j
]
->
finalize_table
(
*
metaData
[
i
]))
if
(
!
g_consumers
[
j
]
->
finalize_table
(
*
metaData
[
i
]))
...
...
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