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
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)
...
@@ -698,11 +698,11 @@ int ha_ndbcluster::get_metadata(const char *path)
int
ha_ndbcluster
::
build_index_list
(
TABLE
*
tab
,
enum
ILBP
phase
)
int
ha_ndbcluster
::
build_index_list
(
TABLE
*
tab
,
enum
ILBP
phase
)
{
{
uint
i
;
int
error
=
0
;
int
error
=
0
;
c
har
*
name
;
c
onst
char
*
name
,
*
index_
name
;
c
onst
char
*
index_name
;
c
har
unique_index_name
[
FN_LEN
]
;
static
const
char
*
unique_suffix
=
"$unique"
;
static
const
char
*
unique_suffix
=
"$unique"
;
uint
i
,
name_len
;
KEY
*
key_info
=
tab
->
key_info
;
KEY
*
key_info
=
tab
->
key_info
;
const
char
**
key_name
=
tab
->
keynames
.
type_names
;
const
char
**
key_name
=
tab
->
keynames
.
type_names
;
NdbDictionary
::
Dictionary
*
dict
=
m_ndb
->
getDictionary
();
NdbDictionary
::
Dictionary
*
dict
=
m_ndb
->
getDictionary
();
...
@@ -716,21 +716,15 @@ int ha_ndbcluster::build_index_list(TABLE *tab, enum ILBP phase)
...
@@ -716,21 +716,15 @@ int ha_ndbcluster::build_index_list(TABLE *tab, enum ILBP phase)
m_index
[
i
].
type
=
idx_type
;
m_index
[
i
].
type
=
idx_type
;
if
(
idx_type
==
UNIQUE_ORDERED_INDEX
||
idx_type
==
UNIQUE_INDEX
)
if
(
idx_type
==
UNIQUE_ORDERED_INDEX
||
idx_type
==
UNIQUE_INDEX
)
{
{
name_len
=
strlen
(
index_name
)
+
strlen
(
unique_suffix
)
+
1
;
strxnmov
(
unique_index_name
,
FN_LEN
,
index_name
,
unique_suffix
,
NullS
);
// Create name for unique index by appending "$unique";
DBUG_PRINT
(
"info"
,
(
"Created unique index name
\'
%s
\'
for index %d"
,
if
(
!
(
name
=
my_malloc
(
name_len
,
MYF
(
MY_WME
))))
unique_index_name
,
i
));
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
));
}
}
// Create secondary indexes if in create phase
// Create secondary indexes if in create phase
if
(
phase
==
ILBP_CREATE
)
if
(
phase
==
ILBP_CREATE
)
{
{
DBUG_PRINT
(
"info"
,
(
"Creating index %u: %s"
,
i
,
index_name
));
DBUG_PRINT
(
"info"
,
(
"Creating index %u: %s"
,
i
,
index_name
));
switch
(
idx_type
){
switch
(
m_index
[
i
].
type
){
case
PRIMARY_KEY_INDEX
:
case
PRIMARY_KEY_INDEX
:
// Do nothing, already created
// Do nothing, already created
...
@@ -740,10 +734,10 @@ int ha_ndbcluster::build_index_list(TABLE *tab, enum ILBP phase)
...
@@ -740,10 +734,10 @@ int ha_ndbcluster::build_index_list(TABLE *tab, enum ILBP phase)
break
;
break
;
case
UNIQUE_ORDERED_INDEX
:
case
UNIQUE_ORDERED_INDEX
:
if
(
!
(
error
=
create_ordered_index
(
index_name
,
key_info
)))
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
;
break
;
case
UNIQUE_INDEX
:
case
UNIQUE_INDEX
:
error
=
create_unique_index
(
get_unique_index_name
(
i
)
,
key_info
);
error
=
create_unique_index
(
unique_index_name
,
key_info
);
break
;
break
;
case
ORDERED_INDEX
:
case
ORDERED_INDEX
:
error
=
create_ordered_index
(
index_name
,
key_info
);
error
=
create_ordered_index
(
index_name
,
key_info
);
...
@@ -760,21 +754,20 @@ int ha_ndbcluster::build_index_list(TABLE *tab, enum ILBP phase)
...
@@ -760,21 +754,20 @@ int ha_ndbcluster::build_index_list(TABLE *tab, enum ILBP phase)
}
}
}
}
// Add handles to index objects
// Add handles to index objects
DBUG_PRINT
(
"info"
,
(
"Trying to add handle to index %s"
,
index_name
));
if
(
idx_type
!=
PRIMARY_KEY_INDEX
&&
idx_type
!=
UNIQUE_INDEX
)
if
((
m_index
[
i
].
type
!=
PRIMARY_KEY_INDEX
)
&&
(
m_index
[
i
].
type
!=
UNIQUE_INDEX
))
{
{
DBUG_PRINT
(
"info"
,
(
"Get handle to index %s"
,
index_name
));
const
NDBINDEX
*
index
=
dict
->
getIndex
(
index_name
,
m_tabname
);
const
NDBINDEX
*
index
=
dict
->
getIndex
(
index_name
,
m_tabname
);
if
(
!
index
)
DBUG_RETURN
(
1
);
if
(
!
index
)
DBUG_RETURN
(
1
);
m_index
[
i
].
index
=
(
void
*
)
index
;
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
);
if
(
!
index
)
DBUG_RETURN
(
1
);
m_index
[
i
].
unique_index
=
(
void
*
)
index
;
m_index
[
i
].
unique_index
=
(
void
*
)
index
;
}
}
DBUG_PRINT
(
"info"
,
(
"Added handle to index %s"
,
index_name
));
}
}
DBUG_RETURN
(
error
);
DBUG_RETURN
(
error
);
...
@@ -810,9 +803,6 @@ void ha_ndbcluster::release_metadata()
...
@@ -810,9 +803,6 @@ void ha_ndbcluster::release_metadata()
// Release index list
// Release index list
for
(
i
=
0
;
i
<
MAX_KEY
;
i
++
)
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
].
unique_index
=
NULL
;
m_index
[
i
].
index
=
NULL
;
m_index
[
i
].
index
=
NULL
;
}
}
...
@@ -868,16 +858,6 @@ static const ulong index_type_flags[]=
...
@@ -868,16 +858,6 @@ static const ulong index_type_flags[]=
static
const
int
index_flags_size
=
sizeof
(
index_type_flags
)
/
sizeof
(
ulong
);
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
inline
NDB_INDEX_TYPE
ha_ndbcluster
::
get_index_type
(
uint
idx_no
)
const
{
{
DBUG_ASSERT
(
idx_no
<
MAX_KEY
);
DBUG_ASSERT
(
idx_no
<
MAX_KEY
);
...
@@ -1094,7 +1074,6 @@ int ha_ndbcluster::unique_index_read(const byte *key,
...
@@ -1094,7 +1074,6 @@ int ha_ndbcluster::unique_index_read(const byte *key,
DBUG_ENTER
(
"unique_index_read"
);
DBUG_ENTER
(
"unique_index_read"
);
DBUG_PRINT
(
"enter"
,
(
"key_len: %u, index: %u"
,
key_len
,
active_index
));
DBUG_PRINT
(
"enter"
,
(
"key_len: %u, index: %u"
,
key_len
,
active_index
));
DBUG_DUMP
(
"key"
,
(
char
*
)
key
,
key_len
);
DBUG_DUMP
(
"key"
,
(
char
*
)
key
,
key_len
);
DBUG_PRINT
(
"enter"
,
(
"name: %s"
,
get_unique_index_name
(
active_index
)));
NdbOperation
::
LockMode
lm
=
NdbOperation
::
LockMode
lm
=
(
NdbOperation
::
LockMode
)
get_ndb_lock_type
(
m_lock
.
type
);
(
NdbOperation
::
LockMode
)
get_ndb_lock_type
(
m_lock
.
type
);
...
@@ -1350,7 +1329,6 @@ int ha_ndbcluster::ordered_index_scan(const key_range *start_key,
...
@@ -1350,7 +1329,6 @@ int ha_ndbcluster::ordered_index_scan(const key_range *start_key,
NdbConnection
*
trans
=
m_active_trans
;
NdbConnection
*
trans
=
m_active_trans
;
NdbResultSet
*
cursor
;
NdbResultSet
*
cursor
;
NdbIndexScanOperation
*
op
;
NdbIndexScanOperation
*
op
;
const
char
*
index_name
;
DBUG_ENTER
(
"ordered_index_scan"
);
DBUG_ENTER
(
"ordered_index_scan"
);
DBUG_PRINT
(
"enter"
,
(
"index: %u, sorted: %d"
,
active_index
,
sorted
));
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,
...
@@ -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
(
start_key
,
"start_key"
););
DBUG_EXECUTE
(
"enter"
,
print_key
(
end_key
,
"end_key"
););
DBUG_EXECUTE
(
"enter"
,
print_key
(
end_key
,
"end_key"
););
index_name
=
get_index_name
(
active_index
);
NdbOperation
::
LockMode
lm
=
NdbOperation
::
LockMode
lm
=
(
NdbOperation
::
LockMode
)
get_ndb_lock_type
(
m_lock
.
type
);
(
NdbOperation
::
LockMode
)
get_ndb_lock_type
(
m_lock
.
type
);
...
@@ -3304,7 +3281,6 @@ int ha_ndbcluster::create_index(const char *name,
...
@@ -3304,7 +3281,6 @@ int ha_ndbcluster::create_index(const char *name,
DBUG_ENTER
(
"create_index"
);
DBUG_ENTER
(
"create_index"
);
DBUG_PRINT
(
"enter"
,
(
"name: %s "
,
name
));
DBUG_PRINT
(
"enter"
,
(
"name: %s "
,
name
));
// NdbDictionary::Index ndb_index(name);
NdbDictionary
::
Index
ndb_index
(
name
);
NdbDictionary
::
Index
ndb_index
(
name
);
if
(
unique
)
if
(
unique
)
ndb_index
.
setType
(
NdbDictionary
::
Index
::
UniqueHashIndex
);
ndb_index
.
setType
(
NdbDictionary
::
Index
::
UniqueHashIndex
);
...
@@ -3502,7 +3478,6 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg):
...
@@ -3502,7 +3478,6 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg):
for
(
i
=
0
;
i
<
MAX_KEY
;
i
++
)
for
(
i
=
0
;
i
<
MAX_KEY
;
i
++
)
{
{
m_index
[
i
].
type
=
UNDEFINED_INDEX
;
m_index
[
i
].
type
=
UNDEFINED_INDEX
;
m_index
[
i
].
unique_name
=
NULL
;
m_index
[
i
].
unique_index
=
NULL
;
m_index
[
i
].
unique_index
=
NULL
;
m_index
[
i
].
index
=
NULL
;
m_index
[
i
].
index
=
NULL
;
}
}
...
...
sql/ha_ndbcluster.h
View file @
673dc109
...
@@ -52,7 +52,6 @@ typedef enum ndb_index_type {
...
@@ -52,7 +52,6 @@ typedef enum ndb_index_type {
typedef
struct
ndb_index_data
{
typedef
struct
ndb_index_data
{
NDB_INDEX_TYPE
type
;
NDB_INDEX_TYPE
type
;
void
*
index
;
void
*
index
;
const
char
*
unique_name
;
void
*
unique_index
;
void
*
unique_index
;
}
NDB_INDEX_DATA
;
}
NDB_INDEX_DATA
;
...
@@ -180,8 +179,6 @@ class ha_ndbcluster: public handler
...
@@ -180,8 +179,6 @@ class ha_ndbcluster: public handler
int
build_index_list
(
TABLE
*
tab
,
enum
ILBP
phase
);
int
build_index_list
(
TABLE
*
tab
,
enum
ILBP
phase
);
int
get_metadata
(
const
char
*
path
);
int
get_metadata
(
const
char
*
path
);
void
release_metadata
();
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
(
uint
idx_no
)
const
;
NDB_INDEX_TYPE
get_index_type_from_table
(
uint
index_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