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
d46b4cfc
Commit
d46b4cfc
authored
Aug 21, 2013
by
Rich Prohaska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#69 run create unique index with MDL shared no write (not hot WRT writes)
parent
3b339f31
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
2 deletions
+27
-2
mysql-test/suite/tokudb.add_index/r/hot_create_unique_index.result
...t/suite/tokudb.add_index/r/hot_create_unique_index.result
+4
-0
mysql-test/suite/tokudb.add_index/t/hot_create_unique_index.test
...est/suite/tokudb.add_index/t/hot_create_unique_index.test
+15
-0
storage/tokudb/ha_tokudb.cc
storage/tokudb/ha_tokudb.cc
+4
-0
storage/tokudb/ha_tokudb_alter_56.cc
storage/tokudb/ha_tokudb_alter_56.cc
+4
-2
No files found.
mysql-test/suite/tokudb.add_index/r/hot_create_unique_index.result
0 → 100644
View file @
d46b4cfc
drop table if exists t;
create table t (id int auto_increment primary key, x int);
create unique index x on t (x);
drop table t;
mysql-test/suite/tokudb.add_index/t/hot_create_unique_index.test
0 → 100644
View file @
d46b4cfc
# verify that create unique index is not a hot operation.
# in tokudb_add_index assert that the table MDL >= shared no write.
source
include
/
have_tokudb
.
inc
;
source
include
/
have_debug
.
inc
;
disable_warnings
;
drop
table
if
exists
t
;
enable_warnings
;
create
table
t
(
id
int
auto_increment
primary
key
,
x
int
);
create
unique
index
x
on
t
(
x
);
drop
table
t
;
storage/tokudb/ha_tokudb.cc
View file @
d46b4cfc
...
...
@@ -3470,6 +3470,8 @@ int ha_tokudb::end_bulk_insert() {
return
end_bulk_insert
(
false
);
}
volatile
int
ha_tokudb_is_index_unique_wait
=
0
;
// debug
int
ha_tokudb
::
is_index_unique
(
bool
*
is_unique
,
DB_TXN
*
txn
,
DB
*
db
,
KEY
*
key_info
)
{
int
error
;
DBC
*
tmp_cursor1
=
NULL
;
...
...
@@ -3614,6 +3616,7 @@ int ha_tokudb::is_index_unique(bool* is_unique, DB_TXN* txn, DB* db, KEY* key_in
error
=
0
;
cleanup:
while
(
ha_tokudb_is_index_unique_wait
)
sleep
(
1
);
// debug
if
(
tmp_cursor1
)
{
tmp_cursor1
->
c_close
(
tmp_cursor1
);
tmp_cursor1
=
NULL
;
...
...
@@ -7813,6 +7816,7 @@ int ha_tokudb::tokudb_add_index(
indexer
=
NULL
;
}
else
{
DBUG_ASSERT
(
table
->
mdl_ticket
->
get_type
()
>=
MDL_SHARED_NO_WRITE
);
rw_unlock
(
&
share
->
num_DBs_lock
);
rw_lock_taken
=
false
;
prelocked_right_range_size
=
0
;
...
...
storage/tokudb/ha_tokudb_alter_56.cc
View file @
d46b4cfc
...
...
@@ -312,8 +312,10 @@ enum_alter_inplace_result ha_tokudb::check_if_supported_inplace_alter(TABLE *alt
// someday, allow multiple hot indexes via alter table add key. don't forget to change the store_lock function.
// for now, hot indexing is only supported via session variable with the create index sql command
if
(
ha_alter_info
->
index_add_count
==
1
&&
ha_alter_info
->
index_drop_count
==
0
&&
get_create_index_online
(
thd
)
&&
thd_sql_command
(
thd
)
==
SQLCOM_CREATE_INDEX
)
{
if
(
ha_alter_info
->
index_add_count
==
1
&&
ha_alter_info
->
index_drop_count
==
0
&&
// only one add or drop
ctx
->
handler_flags
==
Alter_inplace_info
::
ADD_INDEX
&&
// must be add index not add unique index
thd_sql_command
(
thd
)
==
SQLCOM_CREATE_INDEX
&&
// must be a create index command
get_create_index_online
(
thd
))
{
// must be enabled
// external_lock set WRITE_ALLOW_WRITE which allows writes concurrent with the index creation
result
=
HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE
;
}
...
...
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