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
673dc109
Commit
673dc109
authored
Sep 30, 2004
by
magnus@neptunus.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge msvensson@bk-internal.mysql.com:/home/bk/mysql-4.1-ndb
into neptunus.(none):/home/magnus/mysql/mysql-4.1-ndb
parents
4faaed98
6469a109
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
43 deletions
+15
-43
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+15
-40
sql/ha_ndbcluster.h
sql/ha_ndbcluster.h
+0
-3
No files found.
sql/ha_ndbcluster.cc
View file @
673dc109
...
...
@@ -698,11 +698,11 @@ int ha_ndbcluster::get_metadata(const char *path)
int
ha_ndbcluster
::
build_index_list
(
TABLE
*
tab
,
enum
ILBP
phase
)
{
uint
i
;
int
error
=
0
;
c
har
*
name
;
c
onst
char
*
index_name
;
c
onst
char
*
name
,
*
index_
name
;
c
har
unique_index_name
[
FN_LEN
]
;
static
const
char
*
unique_suffix
=
"$unique"
;
uint
i
,
name_len
;
KEY
*
key_info
=
tab
->
key_info
;
const
char
**
key_name
=
tab
->
keynames
.
type_names
;
NdbDictionary
::
Dictionary
*
dict
=
m_ndb
->
getDictionary
();
...
...
@@ -716,21 +716,15 @@ int ha_ndbcluster::build_index_list(TABLE *tab, enum ILBP phase)
m_index
[
i
].
type
=
idx_type
;
if
(
idx_type
==
UNIQUE_ORDERED_INDEX
||
idx_type
==
UNIQUE_INDEX
)
{
name_len
=
strlen
(
index_name
)
+
strlen
(
unique_suffix
)
+
1
;
// Create name for unique index by appending "$unique";
if
(
!
(
name
=
my_malloc
(
name_len
,
MYF
(
MY_WME
))))
DBUG_RETURN
(
2
);
strxnmov
(
name
,
name_len
,
index_name
,
unique_suffix
,
NullS
);
m_index
[
i
].
unique_name
=
name
;
DBUG_PRINT
(
"info"
,
(
"Created unique index name: %s for index %d"
,
name
,
i
));
strxnmov
(
unique_index_name
,
FN_LEN
,
index_name
,
unique_suffix
,
NullS
);
DBUG_PRINT
(
"info"
,
(
"Created unique index name
\'
%s
\'
for index %d"
,
unique_index_name
,
i
));
}
// Create secondary indexes if in create phase
if
(
phase
==
ILBP_CREATE
)
{
DBUG_PRINT
(
"info"
,
(
"Creating index %u: %s"
,
i
,
index_name
));
switch
(
m_index
[
i
].
type
){
DBUG_PRINT
(
"info"
,
(
"Creating index %u: %s"
,
i
,
index_name
));
switch
(
idx_type
){
case
PRIMARY_KEY_INDEX
:
// Do nothing, already created
...
...
@@ -740,10 +734,10 @@ int ha_ndbcluster::build_index_list(TABLE *tab, enum ILBP phase)
break
;
case
UNIQUE_ORDERED_INDEX
:
if
(
!
(
error
=
create_ordered_index
(
index_name
,
key_info
)))
error
=
create_unique_index
(
get_unique_index_name
(
i
)
,
key_info
);
error
=
create_unique_index
(
unique_index_name
,
key_info
);
break
;
case
UNIQUE_INDEX
:
error
=
create_unique_index
(
get_unique_index_name
(
i
)
,
key_info
);
error
=
create_unique_index
(
unique_index_name
,
key_info
);
break
;
case
ORDERED_INDEX
:
error
=
create_ordered_index
(
index_name
,
key_info
);
...
...
@@ -760,21 +754,20 @@ int ha_ndbcluster::build_index_list(TABLE *tab, enum ILBP phase)
}
}
// Add handles to index objects
DBUG_PRINT
(
"info"
,
(
"Trying to add handle to index %s"
,
index_name
));
if
((
m_index
[
i
].
type
!=
PRIMARY_KEY_INDEX
)
&&
(
m_index
[
i
].
type
!=
UNIQUE_INDEX
))
if
(
idx_type
!=
PRIMARY_KEY_INDEX
&&
idx_type
!=
UNIQUE_INDEX
)
{
DBUG_PRINT
(
"info"
,
(
"Get handle to index %s"
,
index_name
));
const
NDBINDEX
*
index
=
dict
->
getIndex
(
index_name
,
m_tabname
);
if
(
!
index
)
DBUG_RETURN
(
1
);
m_index
[
i
].
index
=
(
void
*
)
index
;
}
if
(
m_index
[
i
].
unique_name
)
if
(
idx_type
==
UNIQUE_ORDERED_INDEX
||
idx_type
==
UNIQUE_INDEX
)
{
const
NDBINDEX
*
index
=
dict
->
getIndex
(
m_index
[
i
].
unique_name
,
m_tabname
);
DBUG_PRINT
(
"info"
,
(
"Get handle to unique_index %s"
,
unique_index_name
));
const
NDBINDEX
*
index
=
dict
->
getIndex
(
unique_index_name
,
m_tabname
);
if
(
!
index
)
DBUG_RETURN
(
1
);
m_index
[
i
].
unique_index
=
(
void
*
)
index
;
}
DBUG_PRINT
(
"info"
,
(
"Added handle to index %s"
,
index_name
));
}
DBUG_RETURN
(
error
);
...
...
@@ -810,9 +803,6 @@ void ha_ndbcluster::release_metadata()
// Release index list
for
(
i
=
0
;
i
<
MAX_KEY
;
i
++
)
{
if
(
m_index
[
i
].
unique_name
)
my_free
((
char
*
)
m_index
[
i
].
unique_name
,
MYF
(
0
));
m_index
[
i
].
unique_name
=
NULL
;
m_index
[
i
].
unique_index
=
NULL
;
m_index
[
i
].
index
=
NULL
;
}
...
...
@@ -868,16 +858,6 @@ static const ulong index_type_flags[]=
static
const
int
index_flags_size
=
sizeof
(
index_type_flags
)
/
sizeof
(
ulong
);
inline
const
char
*
ha_ndbcluster
::
get_index_name
(
uint
idx_no
)
const
{
return
table
->
keynames
.
type_names
[
idx_no
];
}
inline
const
char
*
ha_ndbcluster
::
get_unique_index_name
(
uint
idx_no
)
const
{
return
m_index
[
idx_no
].
unique_name
;
}
inline
NDB_INDEX_TYPE
ha_ndbcluster
::
get_index_type
(
uint
idx_no
)
const
{
DBUG_ASSERT
(
idx_no
<
MAX_KEY
);
...
...
@@ -1094,7 +1074,6 @@ int ha_ndbcluster::unique_index_read(const byte *key,
DBUG_ENTER
(
"unique_index_read"
);
DBUG_PRINT
(
"enter"
,
(
"key_len: %u, index: %u"
,
key_len
,
active_index
));
DBUG_DUMP
(
"key"
,
(
char
*
)
key
,
key_len
);
DBUG_PRINT
(
"enter"
,
(
"name: %s"
,
get_unique_index_name
(
active_index
)));
NdbOperation
::
LockMode
lm
=
(
NdbOperation
::
LockMode
)
get_ndb_lock_type
(
m_lock
.
type
);
...
...
@@ -1350,7 +1329,6 @@ int ha_ndbcluster::ordered_index_scan(const key_range *start_key,
NdbConnection
*
trans
=
m_active_trans
;
NdbResultSet
*
cursor
;
NdbIndexScanOperation
*
op
;
const
char
*
index_name
;
DBUG_ENTER
(
"ordered_index_scan"
);
DBUG_PRINT
(
"enter"
,
(
"index: %u, sorted: %d"
,
active_index
,
sorted
));
...
...
@@ -1359,7 +1337,6 @@ int ha_ndbcluster::ordered_index_scan(const key_range *start_key,
DBUG_EXECUTE
(
"enter"
,
print_key
(
start_key
,
"start_key"
););
DBUG_EXECUTE
(
"enter"
,
print_key
(
end_key
,
"end_key"
););
index_name
=
get_index_name
(
active_index
);
NdbOperation
::
LockMode
lm
=
(
NdbOperation
::
LockMode
)
get_ndb_lock_type
(
m_lock
.
type
);
...
...
@@ -3304,7 +3281,6 @@ int ha_ndbcluster::create_index(const char *name,
DBUG_ENTER
(
"create_index"
);
DBUG_PRINT
(
"enter"
,
(
"name: %s "
,
name
));
// NdbDictionary::Index ndb_index(name);
NdbDictionary
::
Index
ndb_index
(
name
);
if
(
unique
)
ndb_index
.
setType
(
NdbDictionary
::
Index
::
UniqueHashIndex
);
...
...
@@ -3502,7 +3478,6 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg):
for
(
i
=
0
;
i
<
MAX_KEY
;
i
++
)
{
m_index
[
i
].
type
=
UNDEFINED_INDEX
;
m_index
[
i
].
unique_name
=
NULL
;
m_index
[
i
].
unique_index
=
NULL
;
m_index
[
i
].
index
=
NULL
;
}
...
...
sql/ha_ndbcluster.h
View file @
673dc109
...
...
@@ -52,7 +52,6 @@ typedef enum ndb_index_type {
typedef
struct
ndb_index_data
{
NDB_INDEX_TYPE
type
;
void
*
index
;
const
char
*
unique_name
;
void
*
unique_index
;
}
NDB_INDEX_DATA
;
...
...
@@ -180,8 +179,6 @@ class ha_ndbcluster: public handler
int
build_index_list
(
TABLE
*
tab
,
enum
ILBP
phase
);
int
get_metadata
(
const
char
*
path
);
void
release_metadata
();
const
char
*
get_index_name
(
uint
idx_no
)
const
;
const
char
*
get_unique_index_name
(
uint
idx_no
)
const
;
NDB_INDEX_TYPE
get_index_type
(
uint
idx_no
)
const
;
NDB_INDEX_TYPE
get_index_type_from_table
(
uint
index_no
)
const
;
...
...
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