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
2481db06
Commit
2481db06
authored
Apr 09, 2013
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move writing of the frm into init_from_binary_frm_image()
parent
07b25239
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
20 deletions
+32
-20
sql/table.cc
sql/table.cc
+16
-7
sql/table.h
sql/table.h
+2
-1
storage/archive/ha_archive.cc
storage/archive/ha_archive.cc
+14
-12
No files found.
sql/table.cc
View file @
2481db06
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
#include "sql_select.h"
#include "sql_select.h"
#include "sql_derived.h"
#include "sql_derived.h"
#include "sql_statistics.h"
#include "sql_statistics.h"
#include "discover.h"
#include "mdl.h" // MDL_wait_for_graph_visitor
#include "mdl.h" // MDL_wait_for_graph_visitor
/* INFORMATION_SCHEMA name */
/* INFORMATION_SCHEMA name */
...
@@ -613,7 +614,6 @@ enum open_frm_error open_table_def(THD *thd, TABLE_SHARE *share, uint flags)
...
@@ -613,7 +614,6 @@ enum open_frm_error open_table_def(THD *thd, TABLE_SHARE *share, uint flags)
uchar
*
buf
;
uchar
*
buf
;
uchar
head
[
64
];
uchar
head
[
64
];
char
path
[
FN_REFLEN
];
char
path
[
FN_REFLEN
];
MEM_ROOT
**
root_ptr
,
*
old_root
;
DBUG_ENTER
(
"open_table_def"
);
DBUG_ENTER
(
"open_table_def"
);
DBUG_PRINT
(
"enter"
,
(
"table: '%s'.'%s' path: '%s'"
,
share
->
db
.
str
,
DBUG_PRINT
(
"enter"
,
(
"table: '%s'.'%s' path: '%s'"
,
share
->
db
.
str
,
share
->
table_name
.
str
,
share
->
normalized_path
.
str
));
share
->
table_name
.
str
,
share
->
normalized_path
.
str
));
...
@@ -708,12 +708,8 @@ enum open_frm_error open_table_def(THD *thd, TABLE_SHARE *share, uint flags)
...
@@ -708,12 +708,8 @@ enum open_frm_error open_table_def(THD *thd, TABLE_SHARE *share, uint flags)
}
}
mysql_file_close
(
file
,
MYF
(
MY_WME
));
mysql_file_close
(
file
,
MYF
(
MY_WME
));
root_ptr
=
my_pthread_getspecific_ptr
(
MEM_ROOT
**
,
THR_MALLOC
);
share
->
init_from_binary_frm_image
(
thd
,
NULL
,
buf
,
stats
.
st_size
);
old_root
=
*
root_ptr
;
*
root_ptr
=
&
share
->
mem_root
;
share
->
init_from_binary_frm_image
(
thd
,
buf
);
error_given
=
true
;
error_given
=
true
;
*
root_ptr
=
old_root
;
my_free
(
buf
);
my_free
(
buf
);
if
(
!
share
->
error
)
if
(
!
share
->
error
)
...
@@ -745,9 +741,12 @@ err_not_open:
...
@@ -745,9 +741,12 @@ err_not_open:
28..29 (used to be key_info_length)
28..29 (used to be key_info_length)
They're still set, for compatibility reasons, but never read.
They're still set, for compatibility reasons, but never read.
TODO verify that we never read data from beyond frm_length!
*/
*/
bool
TABLE_SHARE
::
init_from_binary_frm_image
(
THD
*
thd
,
const
uchar
*
frm_image
)
bool
TABLE_SHARE
::
init_from_binary_frm_image
(
THD
*
thd
,
const
char
*
path
,
const
uchar
*
frm_image
,
size_t
frm_length
)
{
{
TABLE_SHARE
*
share
=
this
;
TABLE_SHARE
*
share
=
this
;
uint
new_frm_ver
,
field_pack_length
,
new_field_pack_flag
;
uint
new_frm_ver
,
field_pack_length
,
new_field_pack_flag
;
...
@@ -782,8 +781,16 @@ bool TABLE_SHARE::init_from_binary_frm_image(THD *thd, const uchar *frm_image)
...
@@ -782,8 +781,16 @@ bool TABLE_SHARE::init_from_binary_frm_image(THD *thd, const uchar *frm_image)
uint
first_key_parts
=
0
;
uint
first_key_parts
=
0
;
keyinfo
=
&
first_keyinfo
;
keyinfo
=
&
first_keyinfo
;
share
->
ext_key_parts
=
0
;
share
->
ext_key_parts
=
0
;
MEM_ROOT
**
root_ptr
,
*
old_root
;
DBUG_ENTER
(
"open_binary_frm"
);
DBUG_ENTER
(
"open_binary_frm"
);
root_ptr
=
my_pthread_getspecific_ptr
(
MEM_ROOT
**
,
THR_MALLOC
);
old_root
=
*
root_ptr
;
*
root_ptr
=
&
share
->
mem_root
;
if
(
path
&&
writefrm
(
path
,
frm_image
,
frm_length
))
goto
err
;
new_field_pack_flag
=
frm_image
[
27
];
new_field_pack_flag
=
frm_image
[
27
];
new_frm_ver
=
(
frm_image
[
2
]
-
FRM_VER
);
new_frm_ver
=
(
frm_image
[
2
]
-
FRM_VER
);
field_pack_length
=
new_frm_ver
<
2
?
11
:
17
;
field_pack_length
=
new_frm_ver
<
2
?
11
:
17
;
...
@@ -1922,6 +1929,7 @@ bool TABLE_SHARE::init_from_binary_frm_image(THD *thd, const uchar *frm_image)
...
@@ -1922,6 +1929,7 @@ bool TABLE_SHARE::init_from_binary_frm_image(THD *thd, const uchar *frm_image)
#endif
#endif
share
->
error
=
OPEN_FRM_OK
;
share
->
error
=
OPEN_FRM_OK
;
*
root_ptr
=
old_root
;
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
err:
err:
...
@@ -1945,6 +1953,7 @@ bool TABLE_SHARE::init_from_binary_frm_image(THD *thd, const uchar *frm_image)
...
@@ -1945,6 +1953,7 @@ bool TABLE_SHARE::init_from_binary_frm_image(THD *thd, const uchar *frm_image)
if
(
!
thd
->
is_error
())
if
(
!
thd
->
is_error
())
open_table_error
(
share
,
OPEN_FRM_CORRUPTED
,
share
->
open_errno
);
open_table_error
(
share
,
OPEN_FRM_CORRUPTED
,
share
->
open_errno
);
*
root_ptr
=
old_root
;
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
}
/* open_binary_frm */
}
/* open_binary_frm */
...
...
sql/table.h
View file @
2481db06
...
@@ -988,7 +988,8 @@ struct TABLE_SHARE
...
@@ -988,7 +988,8 @@ struct TABLE_SHARE
uint
actual_n_key_parts
(
THD
*
thd
);
uint
actual_n_key_parts
(
THD
*
thd
);
bool
init_from_binary_frm_image
(
THD
*
thd
,
const
uchar
*
frm_image
);
bool
init_from_binary_frm_image
(
THD
*
thd
,
const
char
*
path
,
const
uchar
*
frm_image
,
size_t
frm_length
);
};
};
...
...
storage/archive/ha_archive.cc
View file @
2481db06
...
@@ -281,7 +281,7 @@ int archive_discover(handlerton *hton, THD* thd, TABLE_SHARE *share)
...
@@ -281,7 +281,7 @@ int archive_discover(handlerton *hton, THD* thd, TABLE_SHARE *share)
strxmov
(
az_file
,
share
->
normalized_path
.
str
,
ARZ
,
NullS
);
strxmov
(
az_file
,
share
->
normalized_path
.
str
,
ARZ
,
NullS
);
if
(
!
(
mysql_file_stat
(
/* arch_key_file_data */
0
,
az_file
,
&
file_stat
,
MYF
(
0
))))
if
(
!
(
mysql_file_stat
(
/* arch_key_file_data */
0
,
az_file
,
&
file_stat
,
MYF
(
0
))))
goto
err
;
DBUG_RETURN
(
HA_ERR_NO_SUCH_TABLE
)
;
if
(
!
(
azopen
(
&
frm_stream
,
az_file
,
O_RDONLY
|
O_BINARY
)))
if
(
!
(
azopen
(
&
frm_stream
,
az_file
,
O_RDONLY
|
O_BINARY
)))
{
{
...
@@ -293,21 +293,23 @@ int archive_discover(handlerton *hton, THD* thd, TABLE_SHARE *share)
...
@@ -293,21 +293,23 @@ int archive_discover(handlerton *hton, THD* thd, TABLE_SHARE *share)
if
(
frm_stream
.
frm_length
==
0
)
if
(
frm_stream
.
frm_length
==
0
)
DBUG_RETURN
(
HA_ERR_CRASHED_ON_USAGE
);
DBUG_RETURN
(
HA_ERR_CRASHED_ON_USAGE
);
frm_ptr
=
(
uchar
*
)
my_malloc
(
sizeof
(
char
)
*
frm_stream
.
frm_length
,
MYF
(
0
));
frm_ptr
=
(
uchar
*
)
my_malloc
(
sizeof
(
char
)
*
frm_stream
.
frm_length
,
azread_frm
(
&
frm_stream
,
frm_ptr
);
MYF
(
MY_THREAD_SPECIFIC
|
MY_WME
));
azclose
(
&
frm_stream
);
if
(
!
frm_ptr
)
DBUG_RETURN
(
HA_ERR_OUT_OF_MEM
);
// don't go through the discovery again
if
(
azread_frm
(
&
frm_stream
,
frm_ptr
))
if
(
writefrm
(
share
->
normalized_path
.
str
,
frm_ptr
,
frm_stream
.
frm_length
))
goto
ret
;
DBUG_RETURN
(
my_errno
);
share
->
init_from_binary_frm_image
(
thd
,
frm_ptr
);
azclose
(
&
frm_stream
);
my_free
(
frm_ptr
);
if
(
!
share
->
init_from_binary_frm_image
(
thd
,
share
->
normalized_path
.
str
,
frm_ptr
,
frm_stream
.
frm_length
))
my_errno
=
0
;
DBUG_RETURN
(
0
);
ret:
err:
my_free
(
frm_ptr
);
DBUG_RETURN
(
HA_ERR_NO_SUCH_TABLE
);
DBUG_RETURN
(
my_errno
);
}
}
/*
/*
...
...
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