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
08099bc0
Commit
08099bc0
authored
Nov 11, 2017
by
Eugene Kosov
Committed by
Aleksey Midenkov
Nov 15, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Daemon: check TRT schema [closes #309]
parent
0b2c3088
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
0 deletions
+78
-0
sql/mysqld.cc
sql/mysqld.cc
+22
-0
sql/table.cc
sql/table.cc
+55
-0
sql/table.h
sql/table.h
+1
-0
No files found.
sql/mysqld.cc
View file @
08099bc0
...
...
@@ -100,6 +100,8 @@
#include "rpl_handler.h"
#include "transaction.h"
#ifdef HAVE_SYS_PRCTL_H
#include <sys/prctl.h>
#endif
...
...
@@ -6024,6 +6026,26 @@ int mysqld_main(int argc, char **argv)
if
(
Events
::
init
((
THD
*
)
0
,
opt_noacl
||
opt_bootstrap
))
unireg_abort
(
1
);
if
(
!
opt_bootstrap
)
{
THD
*
thd
=
new
THD
(
0
);
thd
->
thread_stack
=
(
char
*
)
&
thd
;
thd
->
store_globals
();
{
TR_table
trt
(
thd
);
if
(
trt
.
check
())
{
sql_print_error
(
"%s schema is incorrect"
,
trt
.
table_name
);
delete
thd
;
unireg_abort
(
1
);
}
}
trans_commit_stmt
(
thd
);
delete
thd
;
}
if
(
WSREP_ON
)
{
if
(
opt_bootstrap
)
...
...
sql/table.cc
View file @
08099bc0
...
...
@@ -8684,6 +8684,61 @@ bool TR_table::query_sees(bool &result, ulonglong trx_id1, ulonglong trx_id0,
return
false
;
}
bool
TR_table
::
check
()
const
{
// InnoDB may not be loaded
if
(
!
ha_resolve_by_legacy_type
(
thd
,
DB_TYPE_INNODB
))
return
false
;
if
(
!
table
)
return
true
;
if
(
table
->
file
->
ht
->
db_type
!=
DB_TYPE_INNODB
)
return
true
;
if
(
table
->
s
->
fields
!=
5
)
return
true
;
if
(
table
->
field
[
FLD_TRX_ID
]
->
type
()
!=
MYSQL_TYPE_LONGLONG
)
return
true
;
if
(
table
->
field
[
FLD_COMMIT_ID
]
->
type
()
!=
MYSQL_TYPE_LONGLONG
)
return
true
;
if
(
table
->
field
[
FLD_BEGIN_TS
]
->
type
()
!=
MYSQL_TYPE_TIMESTAMP
)
return
true
;
if
(
table
->
field
[
FLD_COMMIT_TS
]
->
type
()
!=
MYSQL_TYPE_TIMESTAMP
)
return
true
;
if
(
table
->
field
[
FLD_ISO_LEVEL
]
->
type
()
!=
MYSQL_TYPE_STRING
||
!
(
table
->
field
[
FLD_ISO_LEVEL
]
->
flags
&
ENUM_FLAG
))
return
true
;
Field_enum
*
iso_level
=
static_cast
<
Field_enum
*>
(
table
->
field
[
FLD_ISO_LEVEL
]);
st_typelib
*
typelib
=
iso_level
->
typelib
;
if
(
typelib
->
count
!=
4
)
return
true
;
if
(
strcmp
(
typelib
->
type_names
[
0
],
"READ-UNCOMMITTED"
)
||
strcmp
(
typelib
->
type_names
[
1
],
"READ-COMMITTED"
)
||
strcmp
(
typelib
->
type_names
[
2
],
"REPEATABLE-READ"
)
||
strcmp
(
typelib
->
type_names
[
3
],
"SERIALIZABLE"
))
{
return
true
;
}
if
(
!
table
->
key_info
||
!
table
->
key_info
->
key_part
)
return
true
;
if
(
strcmp
(
table
->
key_info
->
key_part
->
field
->
field_name
.
str
,
"transaction_id"
))
return
true
;
return
false
;
}
void
vers_select_conds_t
::
resolve_units
(
bool
timestamps_only
)
{
DBUG_ASSERT
(
type
!=
FOR_SYSTEM_TIME_UNSPECIFIED
);
...
...
sql/table.h
View file @
08099bc0
...
...
@@ -2979,6 +2979,7 @@ class TR_table: public TABLE_LIST
DBUG_ASSERT
(
iso_level
<=
ISO_SERIALIZABLE
);
store
(
FLD_ISO_LEVEL
,
iso_level
+
1
);
}
bool
check
()
const
;
};
#endif
/* MYSQL_CLIENT */
...
...
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