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
06274e30
Commit
06274e30
authored
Apr 25, 2014
by
Rich Prohaska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#209 add variable to control table empty algorithm
parent
25f13fda
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
11 deletions
+41
-11
storage/tokudb/ha_tokudb.cc
storage/tokudb/ha_tokudb.cc
+15
-9
storage/tokudb/hatoku_hton.cc
storage/tokudb/hatoku_hton.cc
+1
-1
storage/tokudb/hatoku_hton.h
storage/tokudb/hatoku_hton.h
+25
-1
No files found.
storage/tokudb/ha_tokudb.cc
View file @
06274e30
...
...
@@ -1732,7 +1732,7 @@ int ha_tokudb::initialize_share(
init_auto_increment
();
}
if
(
THDVAR
(
thd
,
open_table_check_empty
)
&&
may_table_be_empty
(
txn
))
{
if
(
may_table_be_empty
(
txn
))
{
share
->
try_table_lock
=
true
;
}
else
{
...
...
@@ -3215,6 +3215,10 @@ bool ha_tokudb::may_table_be_empty(DB_TXN *txn) {
DBC
*
tmp_cursor
=
NULL
;
DB_TXN
*
tmp_txn
=
NULL
;
const
int
empty_scan
=
THDVAR
(
ha_thd
(),
empty_scan
);
if
(
empty_scan
==
TOKUDB_EMPTY_SCAN_DISABLED
)
goto
cleanup
;
if
(
txn
==
NULL
)
{
error
=
txn_begin
(
db_env
,
0
,
&
tmp_txn
,
0
,
ha_thd
());
if
(
error
)
{
...
...
@@ -3224,21 +3228,23 @@ bool ha_tokudb::may_table_be_empty(DB_TXN *txn) {
}
error
=
share
->
file
->
cursor
(
share
->
file
,
txn
,
&
tmp_cursor
,
0
);
if
(
error
)
{
if
(
error
)
goto
cleanup
;
}
error
=
tmp_cursor
->
c_getf_next
(
tmp_cursor
,
0
,
smart_dbt_do_nothing
,
NULL
);
if
(
error
==
DB_NOTFOUND
)
{
if
(
empty_scan
==
TOKUDB_EMPTY_SCAN_LR
)
error
=
tmp_cursor
->
c_getf_next
(
tmp_cursor
,
0
,
smart_dbt_do_nothing
,
NULL
);
else
error
=
tmp_cursor
->
c_getf_prev
(
tmp_cursor
,
0
,
smart_dbt_do_nothing
,
NULL
);
if
(
error
==
DB_NOTFOUND
)
ret_val
=
true
;
}
else
{
else
ret_val
=
false
;
}
error
=
0
;
cleanup:
if
(
tmp_cursor
)
{
int
r
=
tmp_cursor
->
c_close
(
tmp_cursor
);
assert
(
r
==
0
);
assert
(
r
==
0
);
tmp_cursor
=
NULL
;
}
if
(
tmp_txn
)
{
...
...
storage/tokudb/hatoku_hton.cc
View file @
06274e30
...
...
@@ -1390,7 +1390,7 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = {
MYSQL_SYSVAR
(
loader_memory_size
),
MYSQL_SYSVAR
(
hide_default_row_format
),
MYSQL_SYSVAR
(
killed_time
),
MYSQL_SYSVAR
(
open_table_check_empty
),
MYSQL_SYSVAR
(
empty_scan
),
NULL
};
...
...
storage/tokudb/hatoku_hton.h
View file @
06274e30
...
...
@@ -484,7 +484,31 @@ static int tokudb_killed_callback(void) {
return
thd
->
killed
;
}
static
MYSQL_THDVAR_BOOL
(
open_table_check_empty
,
0
,
"Check if table is empty at first open"
,
NULL
/*check*/
,
NULL
/*update*/
,
true
/*default*/
);
enum
{
TOKUDB_EMPTY_SCAN_DISABLED
=
0
,
TOKUDB_EMPTY_SCAN_LR
=
1
,
TOKUDB_EMPTY_SCAN_RL
=
2
,
};
static
const
char
*
tokudb_empty_scan_names
[]
=
{
"disabled"
,
"lr"
,
"rl"
,
NullS
};
static
TYPELIB
tokudb_empty_scan_typelib
=
{
array_elements
(
tokudb_empty_scan_names
)
-
1
,
"tokudb_empty_scan_typelib"
,
tokudb_empty_scan_names
,
NULL
};
static
MYSQL_THDVAR_ENUM
(
empty_scan
,
PLUGIN_VAR_OPCMDARG
,
"TokuDB algorithm to check if the table is empty when opened. "
,
NULL
,
NULL
,
TOKUDB_EMPTY_SCAN_RL
,
&
tokudb_empty_scan_typelib
);
extern
HASH
tokudb_open_tables
;
extern
pthread_mutex_t
tokudb_mutex
;
...
...
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