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
d9ea73d0
Commit
d9ea73d0
authored
Jan 13, 2006
by
mskold@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added new calls for WL#1892 NDB Handler: Add support for CREATE/DROP INDEX
parent
61f62f62
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
0 deletions
+81
-0
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+73
-0
sql/ha_ndbcluster.h
sql/ha_ndbcluster.h
+8
-0
No files found.
sql/ha_ndbcluster.cc
View file @
d9ea73d0
...
...
@@ -4380,6 +4380,40 @@ int ha_ndbcluster::create_ndb_index(const char *name,
DBUG_RETURN
(
0
);
}
/*
Add an index on-line to a table
*/
int
ha_ndbcluster
::
add_index
(
TABLE
*
table_arg
,
KEY
*
key_info
,
uint
num_of_keys
)
{
DBUG_ENTER
(
"ha_ndbcluster::add_index"
);
DBUG_PRINT
(
"info"
,
(
"ha_ndbcluster::add_index to table %s"
,
table_arg
->
s
->
table_name
));
int
error
=
0
;
uint
idx
;
for
(
idx
=
0
;
idx
<
num_of_keys
;
idx
++
)
{
KEY
*
key
=
key_info
+
idx
;
KEY_PART_INFO
*
key_part
=
key
->
key_part
;
KEY_PART_INFO
*
end
=
key_part
+
key
->
key_parts
;
NDB_INDEX_TYPE
idx_type
=
get_index_type_from_key
(
idx
,
key
);
DBUG_PRINT
(
"info"
,
(
"Adding index: '%s'"
,
key_info
[
idx
].
name
));
// Add fields to key_part struct
for
(;
key_part
!=
end
;
key_part
++
)
key_part
->
field
=
table
->
field
[
key_part
->
fieldnr
];
// Check index type
// Create index in ndb
if
((
error
=
create_index
(
key_info
[
idx
].
name
,
key
,
idx_type
,
idx
)))
break
;
}
DBUG_RETURN
(
error
);
}
/*
Drop an index in ndb
*/
int
ha_ndbcluster
::
drop_ndb_index
(
const
char
*
name
)
{
DBUG_ENTER
(
"ha_ndbcluster::drop_index"
);
...
...
@@ -4389,6 +4423,45 @@ int ha_ndbcluster::drop_ndb_index(const char *name)
DBUG_RETURN
(
dict
->
dropIndex
(
name
,
m_tabname
));
}
/*
Mark one or several indexes for deletion. and
renumber the remaining indexes
*/
int
ha_ndbcluster
::
prepare_drop_index
(
TABLE
*
table_arg
,
uint
*
key_num
,
uint
num_of_keys
)
{
DBUG_ENTER
(
"ha_ndbcluster::prepare_drop_index"
);
// Mark indexes for deletion
uint
idx
;
for
(
idx
=
0
;
idx
<
num_of_keys
;
idx
++
)
{
DBUG_PRINT
(
"info"
,
(
"ha_ndbcluster::prepare_drop_index %u"
,
*
key_num
));
m_index
[
*
key_num
++
].
status
=
TO_BE_DROPPED
;
}
// Renumber indexes
THD
*
thd
=
current_thd
;
Thd_ndb
*
thd_ndb
=
get_thd_ndb
(
thd
);
Ndb
*
ndb
=
thd_ndb
->
ndb
;
DBUG_RETURN
(
renumber_indexes
(
ndb
,
table_arg
));
}
/*
Really drop all indexes marked for deletion
*/
int
ha_ndbcluster
::
final_drop_index
(
TABLE
*
table_arg
)
{
DBUG_ENTER
(
"ha_ndbcluster::final_drop_index"
);
DBUG_PRINT
(
"info"
,
(
"ha_ndbcluster::final_drop_index"
));
int
error
=
0
;
// Really drop indexes
THD
*
thd
=
current_thd
;
Thd_ndb
*
thd_ndb
=
get_thd_ndb
(
thd
);
Ndb
*
ndb
=
thd_ndb
->
ndb
;
error
=
drop_indexes
(
ndb
,
table_arg
);
DBUG_RETURN
(
error
);
}
/*
Rename a table in NDB Cluster
*/
...
...
sql/ha_ndbcluster.h
View file @
d9ea73d0
...
...
@@ -564,6 +564,14 @@ class ha_ndbcluster: public handler
const
char
*
table_type
()
const
;
const
char
**
bas_ext
()
const
;
ulong
table_flags
(
void
)
const
;
ulong
alter_table_flags
(
void
)
const
{
return
(
HA_ONLINE_ADD_INDEX
|
HA_ONLINE_DROP_INDEX
|
HA_ONLINE_ADD_UNIQUE_INDEX
|
HA_ONLINE_DROP_UNIQUE_INDEX
);
}
int
add_index
(
TABLE
*
table_arg
,
KEY
*
key_info
,
uint
num_of_keys
);
int
prepare_drop_index
(
TABLE
*
table_arg
,
uint
*
key_num
,
uint
num_of_keys
);
int
final_drop_index
(
TABLE
*
table_arg
);
ulong
partition_flags
(
void
)
const
{
return
(
HA_CAN_PARTITION
|
HA_CAN_UPDATE_PARTITION_KEY
|
...
...
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