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
89288fac
Commit
89288fac
authored
Nov 06, 2005
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WL #528: Faster free_tmp_table
parent
efe3703a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
43 additions
and
14 deletions
+43
-14
include/heap.h
include/heap.h
+1
-0
sql/ha_heap.cc
sql/ha_heap.cc
+8
-0
sql/ha_heap.h
sql/ha_heap.h
+1
-0
sql/handler.cc
sql/handler.cc
+8
-0
sql/handler.h
sql/handler.h
+1
-0
sql/sql_select.cc
sql/sql_select.cc
+2
-10
storage/heap/hp_create.c
storage/heap/hp_create.c
+22
-4
No files found.
include/heap.h
View file @
89288fac
...
...
@@ -206,6 +206,7 @@ extern int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
uint
reclength
,
ulong
max_records
,
ulong
min_records
,
HP_CREATE_INFO
*
create_info
);
extern
int
heap_delete_table
(
const
char
*
name
);
extern
void
heap_drop_table
(
HP_INFO
*
info
);
extern
int
heap_extra
(
HP_INFO
*
info
,
enum
ha_extra_function
function
);
extern
int
heap_rename
(
const
char
*
old_name
,
const
char
*
new_name
);
extern
int
heap_panic
(
enum
ha_panic_function
flag
);
...
...
sql/ha_heap.cc
View file @
89288fac
...
...
@@ -477,6 +477,14 @@ int ha_heap::delete_table(const char *name)
return
error
==
ENOENT
?
0
:
error
;
}
void
ha_heap
::
drop_table
(
const
char
*
name
)
{
heap_drop_table
(
file
);
close
();
}
int
ha_heap
::
rename_table
(
const
char
*
from
,
const
char
*
to
)
{
return
heap_rename
(
from
,
to
);
...
...
sql/ha_heap.h
View file @
89288fac
...
...
@@ -94,6 +94,7 @@ public:
int
indexes_are_disabled
(
void
);
ha_rows
records_in_range
(
uint
inx
,
key_range
*
min_key
,
key_range
*
max_key
);
int
delete_table
(
const
char
*
from
);
void
drop_table
(
const
char
*
name
);
int
rename_table
(
const
char
*
from
,
const
char
*
to
);
int
create
(
const
char
*
name
,
TABLE
*
form
,
HA_CREATE_INFO
*
create_info
);
void
update_create_info
(
HA_CREATE_INFO
*
create_info
);
...
...
sql/handler.cc
View file @
89288fac
...
...
@@ -2062,6 +2062,14 @@ int handler::rename_table(const char * from, const char * to)
return
error
;
}
void
handler
::
drop_table
(
const
char
*
name
)
{
close
();
delete_table
(
name
);
}
/*
Tell the storage engine that it is allowed to "disable transaction" in the
handler. It is a hint that ACID is not required - it is used in NDB for
...
...
sql/handler.h
View file @
89288fac
...
...
@@ -1288,6 +1288,7 @@ public:
*/
virtual
int
rename_table
(
const
char
*
from
,
const
char
*
to
);
virtual
int
delete_table
(
const
char
*
name
);
virtual
void
drop_table
(
const
char
*
name
);
virtual
int
create
(
const
char
*
name
,
TABLE
*
form
,
HA_CREATE_INFO
*
info
)
=
0
;
virtual
int
create_handler_files
(
const
char
*
name
)
{
return
FALSE
;}
...
...
sql/sql_select.cc
View file @
89288fac
...
...
@@ -8848,16 +8848,8 @@ free_tmp_table(THD *thd, TABLE *entry)
if
(
entry
->
file
)
{
if
(
entry
->
db_stat
)
{
(
void
)
entry
->
file
->
close
();
}
/*
We can't call ha_delete_table here as the table may created in mixed case
here and we have to ensure that delete_table gets the table name in
the original case.
*/
if
(
!
(
test_flags
&
TEST_KEEP_TMP_TABLES
)
||
entry
->
s
->
db_type
==
DB_TYPE_HEAP
)
entry
->
file
->
drop_table
(
entry
->
s
->
table_name
);
else
entry
->
file
->
delete_table
(
entry
->
s
->
table_name
);
delete
entry
->
file
;
}
...
...
storage/heap/hp_create.c
View file @
89288fac
...
...
@@ -234,6 +234,16 @@ static void init_block(HP_BLOCK *block, uint reclength, ulong min_records,
HP_PTRS_IN_NOD
*
block
->
level_info
[
i
-
1
].
records_under_level
);
}
static
inline
void
heap_try_free
(
HP_SHARE
*
share
)
{
if
(
share
->
open_count
==
0
)
hp_free
(
share
);
else
share
->
delete_on_close
=
1
;
}
int
heap_delete_table
(
const
char
*
name
)
{
int
result
;
...
...
@@ -243,10 +253,7 @@ int heap_delete_table(const char *name)
pthread_mutex_lock
(
&
THR_LOCK_heap
);
if
((
share
=
hp_find_named_heap
(
name
)))
{
if
(
share
->
open_count
==
0
)
hp_free
(
share
);
else
share
->
delete_on_close
=
1
;
heap_try_free
(
share
);
result
=
0
;
}
else
...
...
@@ -257,6 +264,17 @@ int heap_delete_table(const char *name)
DBUG_RETURN
(
result
);
}
void
heap_drop_table
(
HP_INFO
*
info
)
{
DBUG_ENTER
(
"heap_drop_table"
);
pthread_mutex_lock
(
&
THR_LOCK_heap
);
heap_try_free
(
info
->
s
);
pthread_mutex_unlock
(
&
THR_LOCK_heap
);
DBUG_VOID_RETURN
;
}
void
hp_free
(
HP_SHARE
*
share
)
{
heap_share_list
=
list_delete
(
heap_share_list
,
&
share
->
open_list
);
...
...
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