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
0d699601
Commit
0d699601
authored
Aug 09, 2006
by
evgen@sunlight.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge sunlight.local:/local_work/leak_fix_orig
into sunlight.local:/local_work/leak_fix-5.1-mysql
parents
21f7f347
1250b06a
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
18 deletions
+38
-18
sql/sql_base.cc
sql/sql_base.cc
+22
-12
sql/sql_lex.h
sql/sql_lex.h
+1
-1
sql/sql_view.cc
sql/sql_view.cc
+8
-3
sql/sql_view.h
sql/sql_view.h
+2
-1
sql/table.cc
sql/table.cc
+3
-0
sql/unireg.h
sql/unireg.h
+2
-1
No files found.
sql/sql_base.cc
View file @
0d699601
...
@@ -39,7 +39,7 @@ static bool table_def_inited= 0;
...
@@ -39,7 +39,7 @@ static bool table_def_inited= 0;
static
int
open_unireg_entry
(
THD
*
thd
,
TABLE
*
entry
,
TABLE_LIST
*
table_list
,
static
int
open_unireg_entry
(
THD
*
thd
,
TABLE
*
entry
,
TABLE_LIST
*
table_list
,
const
char
*
alias
,
const
char
*
alias
,
char
*
cache_key
,
uint
cache_key_length
,
char
*
cache_key
,
uint
cache_key_length
,
MEM_ROOT
*
mem_root
);
MEM_ROOT
*
mem_root
,
uint
flags
);
static
void
free_cache_entry
(
TABLE
*
entry
);
static
void
free_cache_entry
(
TABLE
*
entry
);
static
void
mysql_rm_tmp_tables
(
void
);
static
void
mysql_rm_tmp_tables
(
void
);
static
bool
open_new_frm
(
THD
*
thd
,
TABLE_SHARE
*
share
,
const
char
*
alias
,
static
bool
open_new_frm
(
THD
*
thd
,
TABLE_SHARE
*
share
,
const
char
*
alias
,
...
@@ -1763,7 +1763,7 @@ bool reopen_name_locked_table(THD* thd, TABLE_LIST* table_list)
...
@@ -1763,7 +1763,7 @@ bool reopen_name_locked_table(THD* thd, TABLE_LIST* table_list)
if
(
open_unireg_entry
(
thd
,
table
,
table_list
,
table_name
,
if
(
open_unireg_entry
(
thd
,
table
,
table_list
,
table_name
,
table
->
s
->
table_cache_key
.
str
,
table
->
s
->
table_cache_key
.
str
,
table
->
s
->
table_cache_key
.
length
,
thd
->
mem_root
))
table
->
s
->
table_cache_key
.
length
,
thd
->
mem_root
,
0
))
{
{
intern_close_table
(
table
);
intern_close_table
(
table
);
/*
/*
...
@@ -1960,7 +1960,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
...
@@ -1960,7 +1960,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
table
=
&
tab
;
table
=
&
tab
;
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
if
(
!
open_unireg_entry
(
thd
,
table
,
table_list
,
alias
,
if
(
!
open_unireg_entry
(
thd
,
table
,
table_list
,
alias
,
key
,
key_length
,
mem_root
))
key
,
key_length
,
mem_root
,
0
))
{
{
DBUG_ASSERT
(
table_list
->
view
!=
0
);
DBUG_ASSERT
(
table_list
->
view
!=
0
);
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
...
@@ -2044,6 +2044,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
...
@@ -2044,6 +2044,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
}
}
else
else
{
{
int
error
;
/* Free cache if too big */
/* Free cache if too big */
while
(
open_cache
.
records
>
table_cache_size
&&
unused_tables
)
while
(
open_cache
.
records
>
table_cache_size
&&
unused_tables
)
VOID
(
hash_delete
(
&
open_cache
,(
byte
*
)
unused_tables
));
/* purecov: tested */
VOID
(
hash_delete
(
&
open_cache
,(
byte
*
)
unused_tables
));
/* purecov: tested */
...
@@ -2055,15 +2056,23 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
...
@@ -2055,15 +2056,23 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
DBUG_RETURN
(
NULL
);
DBUG_RETURN
(
NULL
);
}
}
if
(
open_unireg_entry
(
thd
,
table
,
table_list
,
alias
,
key
,
key_length
,
error
=
open_unireg_entry
(
thd
,
table
,
table_list
,
alias
,
key
,
key_length
,
mem_root
))
mem_root
,
(
flags
&
OPEN_VIEW_NO_PARSE
));
if
(
error
>
0
)
{
{
my_free
((
gptr
)
table
,
MYF
(
0
));
my_free
((
gptr
)
table
,
MYF
(
0
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
DBUG_RETURN
(
NULL
);
DBUG_RETURN
(
NULL
);
}
}
if
(
table_list
->
view
)
if
(
table_list
->
view
||
error
<
0
)
{
{
/*
VIEW not really opened, only frm were read.
Set 1 as a flag here
*/
if
(
error
<
0
)
table_list
->
view
=
(
st_lex
*
)
1
;
my_free
((
gptr
)
table
,
MYF
(
0
));
my_free
((
gptr
)
table
,
MYF
(
0
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
DBUG_RETURN
(
0
);
// VIEW
DBUG_RETURN
(
0
);
// VIEW
...
@@ -2165,7 +2174,6 @@ static bool reopen_table(TABLE *table)
...
@@ -2165,7 +2174,6 @@ static bool reopen_table(TABLE *table)
sql_print_error
(
"Table %s had a open data handler in reopen_table"
,
sql_print_error
(
"Table %s had a open data handler in reopen_table"
,
table
->
alias
);
table
->
alias
);
#endif
#endif
table_list
.
db
=
table
->
s
->
db
.
str
;
table_list
.
db
=
table
->
s
->
db
.
str
;
table_list
.
table_name
=
table
->
s
->
table_name
.
str
;
table_list
.
table_name
=
table
->
s
->
table_name
.
str
;
table_list
.
table
=
table
;
table_list
.
table
=
table
;
...
@@ -2179,7 +2187,7 @@ static bool reopen_table(TABLE *table)
...
@@ -2179,7 +2187,7 @@ static bool reopen_table(TABLE *table)
table
->
alias
,
table
->
alias
,
table
->
s
->
table_cache_key
.
str
,
table
->
s
->
table_cache_key
.
str
,
table
->
s
->
table_cache_key
.
length
,
table
->
s
->
table_cache_key
.
length
,
thd
->
mem_root
))
thd
->
mem_root
,
0
))
goto
end
;
goto
end
;
/* This list copies variables set by open_table */
/* This list copies variables set by open_table */
...
@@ -2613,6 +2621,8 @@ void assign_new_table_id(TABLE_SHARE *share)
...
@@ -2613,6 +2621,8 @@ void assign_new_table_id(TABLE_SHARE *share)
cache_key Key for share_cache
cache_key Key for share_cache
cache_key_length length of cache_key
cache_key_length length of cache_key
mem_root temporary mem_root for parsing
mem_root temporary mem_root for parsing
flags the OPEN_VIEW_NO_PARSE flag to be passed to
openfrm()/open_new_frm()
NOTES
NOTES
Extra argument for open is taken from thd->open_options
Extra argument for open is taken from thd->open_options
...
@@ -2626,7 +2636,7 @@ void assign_new_table_id(TABLE_SHARE *share)
...
@@ -2626,7 +2636,7 @@ void assign_new_table_id(TABLE_SHARE *share)
static
int
open_unireg_entry
(
THD
*
thd
,
TABLE
*
entry
,
TABLE_LIST
*
table_list
,
static
int
open_unireg_entry
(
THD
*
thd
,
TABLE
*
entry
,
TABLE_LIST
*
table_list
,
const
char
*
alias
,
const
char
*
alias
,
char
*
cache_key
,
uint
cache_key_length
,
char
*
cache_key
,
uint
cache_key_length
,
MEM_ROOT
*
mem_root
)
MEM_ROOT
*
mem_root
,
uint
flags
)
{
{
int
error
;
int
error
;
TABLE_SHARE
*
share
;
TABLE_SHARE
*
share
;
...
@@ -2649,7 +2659,7 @@ static int open_unireg_entry(THD *thd, TABLE *entry, TABLE_LIST *table_list,
...
@@ -2649,7 +2659,7 @@ static int open_unireg_entry(THD *thd, TABLE *entry, TABLE_LIST *table_list,
HA_GET_INDEX
|
HA_TRY_READ_ONLY
),
HA_GET_INDEX
|
HA_TRY_READ_ONLY
),
READ_KEYINFO
|
COMPUTE_TYPES
|
EXTRA_RECORD
,
READ_KEYINFO
|
COMPUTE_TYPES
|
EXTRA_RECORD
,
thd
->
open_options
,
entry
,
table_list
,
thd
->
open_options
,
entry
,
table_list
,
mem_root
);
mem_root
,
(
flags
&
OPEN_VIEW_NO_PARSE
))
);
if
(
error
)
if
(
error
)
goto
err
;
goto
err
;
/* TODO: Don't free this */
/* TODO: Don't free this */
...
@@ -2707,7 +2717,6 @@ static int open_unireg_entry(THD *thd, TABLE *entry, TABLE_LIST *table_list,
...
@@ -2707,7 +2717,6 @@ static int open_unireg_entry(THD *thd, TABLE *entry, TABLE_LIST *table_list,
}
}
if
(
!
entry
->
s
||
!
entry
->
s
->
crashed
)
if
(
!
entry
->
s
||
!
entry
->
s
->
crashed
)
goto
err
;
goto
err
;
// Code below is for repairing a crashed file
// Code below is for repairing a crashed file
if
((
error
=
lock_table_name
(
thd
,
table_list
,
TRUE
)))
if
((
error
=
lock_table_name
(
thd
,
table_list
,
TRUE
)))
{
{
...
@@ -6339,7 +6348,8 @@ open_new_frm(THD *thd, TABLE_SHARE *share, const char *alias,
...
@@ -6339,7 +6348,8 @@ open_new_frm(THD *thd, TABLE_SHARE *share, const char *alias,
"BASE TABLE"
);
"BASE TABLE"
);
goto
err
;
goto
err
;
}
}
if
(
mysql_make_view
(
thd
,
parser
,
table_desc
))
if
(
mysql_make_view
(
thd
,
parser
,
table_desc
,
(
prgflag
&
OPEN_VIEW_NO_PARSE
)))
goto
err
;
goto
err
;
}
}
else
else
...
...
sql/sql_lex.h
View file @
0d699601
...
@@ -402,7 +402,7 @@ class st_select_lex_node {
...
@@ -402,7 +402,7 @@ class st_select_lex_node {
friend
class
st_select_lex_unit
;
friend
class
st_select_lex_unit
;
friend
bool
mysql_new_select
(
struct
st_lex
*
lex
,
bool
move_down
);
friend
bool
mysql_new_select
(
struct
st_lex
*
lex
,
bool
move_down
);
friend
bool
mysql_make_view
(
THD
*
thd
,
File_parser
*
parser
,
friend
bool
mysql_make_view
(
THD
*
thd
,
File_parser
*
parser
,
TABLE_LIST
*
table
);
TABLE_LIST
*
table
,
uint
flags
);
private:
private:
void
fast_exclude
();
void
fast_exclude
();
};
};
...
...
sql/sql_view.cc
View file @
0d699601
...
@@ -183,7 +183,7 @@ fill_defined_view_parts (THD *thd, TABLE_LIST *view)
...
@@ -183,7 +183,7 @@ fill_defined_view_parts (THD *thd, TABLE_LIST *view)
TABLE_LIST
decoy
;
TABLE_LIST
decoy
;
memcpy
(
&
decoy
,
view
,
sizeof
(
TABLE_LIST
));
memcpy
(
&
decoy
,
view
,
sizeof
(
TABLE_LIST
));
if
(
!
open_table
(
thd
,
&
decoy
,
thd
->
mem_root
,
&
not_used
,
0
)
&&
if
(
!
open_table
(
thd
,
&
decoy
,
thd
->
mem_root
,
&
not_used
,
OPEN_VIEW_NO_PARSE
)
&&
!
decoy
.
view
)
!
decoy
.
view
)
{
{
return
TRUE
;
return
TRUE
;
...
@@ -817,13 +817,14 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
...
@@ -817,13 +817,14 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
thd Thread handler
thd Thread handler
parser parser object
parser parser object
table TABLE_LIST structure for filling
table TABLE_LIST structure for filling
flags flags
RETURN
RETURN
0 ok
0 ok
1 error
1 error
*/
*/
bool
mysql_make_view
(
THD
*
thd
,
File_parser
*
parser
,
TABLE_LIST
*
table
)
bool
mysql_make_view
(
THD
*
thd
,
File_parser
*
parser
,
TABLE_LIST
*
table
,
uint
flags
)
{
{
SELECT_LEX
*
end
,
*
view_select
;
SELECT_LEX
*
end
,
*
view_select
;
LEX
*
old_lex
,
*
lex
;
LEX
*
old_lex
,
*
lex
;
...
@@ -914,6 +915,10 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table)
...
@@ -914,6 +915,10 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table)
table
->
db
,
table
->
table_name
);
table
->
db
,
table
->
table_name
);
get_default_definer
(
thd
,
&
table
->
definer
);
get_default_definer
(
thd
,
&
table
->
definer
);
}
}
if
(
flags
&
OPEN_VIEW_NO_PARSE
)
{
DBUG_RETURN
(
FALSE
);
}
/*
/*
Save VIEW parameters, which will be wiped out by derived table
Save VIEW parameters, which will be wiped out by derived table
...
...
sql/sql_view.h
View file @
0d699601
...
@@ -19,7 +19,8 @@
...
@@ -19,7 +19,8 @@
bool
mysql_create_view
(
THD
*
thd
,
bool
mysql_create_view
(
THD
*
thd
,
enum_view_create_mode
mode
);
enum_view_create_mode
mode
);
bool
mysql_make_view
(
THD
*
thd
,
File_parser
*
parser
,
TABLE_LIST
*
table
);
bool
mysql_make_view
(
THD
*
thd
,
File_parser
*
parser
,
TABLE_LIST
*
table
,
uint
flags
);
bool
mysql_drop_view
(
THD
*
thd
,
TABLE_LIST
*
view
,
enum_drop_mode
drop_mode
);
bool
mysql_drop_view
(
THD
*
thd
,
TABLE_LIST
*
view
,
enum_drop_mode
drop_mode
);
...
...
sql/table.cc
View file @
0d699601
...
@@ -353,6 +353,9 @@ int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags)
...
@@ -353,6 +353,9 @@ int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags)
else
else
goto
err
;
goto
err
;
if
(
prgflag
&
OPEN_VIEW_NO_PARSE
)
goto
err
;
/* No handling of text based files yet */
/* No handling of text based files yet */
if
(
table_type
==
1
)
if
(
table_type
==
1
)
{
{
...
...
sql/unireg.h
View file @
0d699601
...
@@ -151,7 +151,8 @@
...
@@ -151,7 +151,8 @@
#define READ_SCREENS 1024
/* Read screens, info and helpfile */
#define READ_SCREENS 1024
/* Read screens, info and helpfile */
#define DELAYED_OPEN 4096
/* Open table later */
#define DELAYED_OPEN 4096
/* Open table later */
#define OPEN_VIEW 8192
/* Allow open on view */
#define OPEN_VIEW 8192
/* Allow open on view */
#define OPEN_VIEW_NO_PARSE 16384
/* Open frm only if it's a view,
but do not parse view itself */
#define SC_INFO_LENGTH 4
/* Form format constant */
#define SC_INFO_LENGTH 4
/* Form format constant */
#define TE_INFO_LENGTH 3
#define TE_INFO_LENGTH 3
#define MTYP_NOEMPTY_BIT 128
#define MTYP_NOEMPTY_BIT 128
...
...
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