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
fd2efc88
Commit
fd2efc88
authored
Jul 06, 2005
by
joreland@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge joreland@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/jonas/src/mysql-5.0
parents
dc571a55
9ef31a28
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
43 deletions
+23
-43
configure.in
configure.in
+2
-2
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+19
-38
sql/ha_ndbcluster.h
sql/ha_ndbcluster.h
+2
-3
No files found.
configure.in
View file @
fd2efc88
...
@@ -6,7 +6,7 @@ AC_PREREQ(2.58)dnl Minimum Autoconf version required.
...
@@ -6,7 +6,7 @@ AC_PREREQ(2.58)dnl Minimum Autoconf version required.
AC_INIT
(
sql/mysqld.cc
)
AC_INIT
(
sql/mysqld.cc
)
AC_CANONICAL_SYSTEM
AC_CANONICAL_SYSTEM
# Don't forget to also update the NDB lines below.
# Don't forget to also update the NDB lines below.
AM_INIT_AUTOMAKE
(
mysql, 5.0.
9
-beta
)
AM_INIT_AUTOMAKE
(
mysql, 5.0.
10
-beta
)
AM_CONFIG_HEADER
(
config.h
)
AM_CONFIG_HEADER
(
config.h
)
PROTOCOL_VERSION
=
10
PROTOCOL_VERSION
=
10
...
@@ -17,7 +17,7 @@ SHARED_LIB_VERSION=14:0:0
...
@@ -17,7 +17,7 @@ SHARED_LIB_VERSION=14:0:0
# ndb version
# ndb version
NDB_VERSION_MAJOR
=
5
NDB_VERSION_MAJOR
=
5
NDB_VERSION_MINOR
=
0
NDB_VERSION_MINOR
=
0
NDB_VERSION_BUILD
=
9
NDB_VERSION_BUILD
=
10
NDB_VERSION_STATUS
=
"beta"
NDB_VERSION_STATUS
=
"beta"
# Set all version vars based on $VERSION. How do we do this more elegant ?
# Set all version vars based on $VERSION. How do we do this more elegant ?
...
...
sql/ha_ndbcluster.cc
View file @
fd2efc88
...
@@ -1249,36 +1249,18 @@ int ha_ndbcluster::set_primary_key(NdbOperation *op, const byte *key)
...
@@ -1249,36 +1249,18 @@ int ha_ndbcluster::set_primary_key(NdbOperation *op, const byte *key)
}
}
int
ha_ndbcluster
::
set_primary_key_from_
old_data
(
NdbOperation
*
op
,
const
byte
*
old_data
)
int
ha_ndbcluster
::
set_primary_key_from_
record
(
NdbOperation
*
op
,
const
byte
*
record
)
{
{
KEY
*
key_info
=
table
->
key_info
+
table
->
s
->
primary_key
;
KEY
*
key_info
=
table
->
key_info
+
table
->
s
->
primary_key
;
KEY_PART_INFO
*
key_part
=
key_info
->
key_part
;
KEY_PART_INFO
*
key_part
=
key_info
->
key_part
;
KEY_PART_INFO
*
end
=
key_part
+
key_info
->
key_parts
;
KEY_PART_INFO
*
end
=
key_part
+
key_info
->
key_parts
;
DBUG_ENTER
(
"set_primary_key_from_
old_data
"
);
DBUG_ENTER
(
"set_primary_key_from_
record
"
);
for
(;
key_part
!=
end
;
key_part
++
)
for
(;
key_part
!=
end
;
key_part
++
)
{
{
Field
*
field
=
key_part
->
field
;
Field
*
field
=
key_part
->
field
;
if
(
set_ndb_key
(
op
,
field
,
if
(
set_ndb_key
(
op
,
field
,
key_part
->
fieldnr
-
1
,
old_data
+
key_part
->
offset
))
key_part
->
fieldnr
-
1
,
record
+
key_part
->
offset
))
ERR_RETURN
(
op
->
getNdbError
());
}
DBUG_RETURN
(
0
);
}
int
ha_ndbcluster
::
set_primary_key
(
NdbOperation
*
op
)
{
DBUG_ENTER
(
"set_primary_key"
);
KEY
*
key_info
=
table
->
key_info
+
table
->
s
->
primary_key
;
KEY_PART_INFO
*
key_part
=
key_info
->
key_part
;
KEY_PART_INFO
*
end
=
key_part
+
key_info
->
key_parts
;
for
(;
key_part
!=
end
;
key_part
++
)
{
Field
*
field
=
key_part
->
field
;
if
(
set_ndb_key
(
op
,
field
,
key_part
->
fieldnr
-
1
,
field
->
ptr
))
ERR_RETURN
(
op
->
getNdbError
());
ERR_RETURN
(
op
->
getNdbError
());
}
}
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
...
@@ -1423,11 +1405,9 @@ int ha_ndbcluster::complemented_pk_read(const byte *old_data, byte *new_data)
...
@@ -1423,11 +1405,9 @@ int ha_ndbcluster::complemented_pk_read(const byte *old_data, byte *new_data)
if
(
!
(
op
=
trans
->
getNdbOperation
((
const
NDBTAB
*
)
m_table
))
||
if
(
!
(
op
=
trans
->
getNdbOperation
((
const
NDBTAB
*
)
m_table
))
||
op
->
readTuple
(
lm
)
!=
0
)
op
->
readTuple
(
lm
)
!=
0
)
ERR_RETURN
(
trans
->
getNdbError
());
ERR_RETURN
(
trans
->
getNdbError
());
int
res
;
int
res
;
if
((
res
=
set_primary_key_from_
old_data
(
op
,
old_data
)))
if
((
res
=
set_primary_key_from_
record
(
op
,
old_data
)))
ERR_RETURN
(
trans
->
getNdbError
());
ERR_RETURN
(
trans
->
getNdbError
());
// Read all unreferenced non-key field(s)
// Read all unreferenced non-key field(s)
for
(
i
=
0
;
i
<
no_fields
;
i
++
)
for
(
i
=
0
;
i
<
no_fields
;
i
++
)
{
{
...
@@ -1470,7 +1450,7 @@ int ha_ndbcluster::complemented_pk_read(const byte *old_data, byte *new_data)
...
@@ -1470,7 +1450,7 @@ int ha_ndbcluster::complemented_pk_read(const byte *old_data, byte *new_data)
Peek to check if a particular row already exists
Peek to check if a particular row already exists
*/
*/
int
ha_ndbcluster
::
peek_row
()
int
ha_ndbcluster
::
peek_row
(
const
byte
*
record
)
{
{
NdbTransaction
*
trans
=
m_active_trans
;
NdbTransaction
*
trans
=
m_active_trans
;
NdbOperation
*
op
;
NdbOperation
*
op
;
...
@@ -1483,7 +1463,7 @@ int ha_ndbcluster::peek_row()
...
@@ -1483,7 +1463,7 @@ int ha_ndbcluster::peek_row()
ERR_RETURN
(
trans
->
getNdbError
());
ERR_RETURN
(
trans
->
getNdbError
());
int
res
;
int
res
;
if
((
res
=
set_primary_key
(
op
)))
if
((
res
=
set_primary_key
_from_record
(
op
,
record
)))
ERR_RETURN
(
trans
->
getNdbError
());
ERR_RETURN
(
trans
->
getNdbError
());
if
(
execute_no_commit_ie
(
this
,
trans
)
!=
0
)
if
(
execute_no_commit_ie
(
this
,
trans
)
!=
0
)
...
@@ -1928,7 +1908,7 @@ int ha_ndbcluster::write_row(byte *record)
...
@@ -1928,7 +1908,7 @@ int ha_ndbcluster::write_row(byte *record)
if
(
m_ignore_dup_key
&&
table
->
s
->
primary_key
!=
MAX_KEY
)
if
(
m_ignore_dup_key
&&
table
->
s
->
primary_key
!=
MAX_KEY
)
{
{
int
peek_res
=
peek_row
();
int
peek_res
=
peek_row
(
record
);
if
(
!
peek_res
)
if
(
!
peek_res
)
{
{
...
@@ -1982,9 +1962,7 @@ int ha_ndbcluster::write_row(byte *record)
...
@@ -1982,9 +1962,7 @@ int ha_ndbcluster::write_row(byte *record)
m_skip_auto_increment
=
!
auto_increment_column_changed
;
m_skip_auto_increment
=
!
auto_increment_column_changed
;
}
}
if
((
res
=
(
m_primary_key_update
?
if
((
res
=
set_primary_key_from_record
(
op
,
record
)))
set_primary_key_from_old_data
(
op
,
record
)
:
set_primary_key
(
op
))))
return
res
;
return
res
;
}
}
...
@@ -2124,7 +2102,7 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
...
@@ -2124,7 +2102,7 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
if
((
table
->
s
->
primary_key
!=
MAX_KEY
)
&&
if
((
table
->
s
->
primary_key
!=
MAX_KEY
)
&&
(
key_cmp
(
table
->
s
->
primary_key
,
old_data
,
new_data
)))
(
key_cmp
(
table
->
s
->
primary_key
,
old_data
,
new_data
)))
{
{
int
read_res
,
insert_res
,
delete_res
;
int
read_res
,
insert_res
,
delete_res
,
undo_res
;
DBUG_PRINT
(
"info"
,
(
"primary key update, doing pk read+delete+insert"
));
DBUG_PRINT
(
"info"
,
(
"primary key update, doing pk read+delete+insert"
));
// Get all old fields, since we optimize away fields not in query
// Get all old fields, since we optimize away fields not in query
...
@@ -2153,9 +2131,14 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
...
@@ -2153,9 +2131,14 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
DBUG_PRINT
(
"info"
,
(
"insert failed"
));
DBUG_PRINT
(
"info"
,
(
"insert failed"
));
if
(
trans
->
commitStatus
()
==
NdbConnection
::
Started
)
if
(
trans
->
commitStatus
()
==
NdbConnection
::
Started
)
{
{
// Undo write_row(new
_data)
// Undo delete_row(old
_data)
m_primary_key_update
=
TRUE
;
m_primary_key_update
=
TRUE
;
insert_res
=
write_row
((
byte
*
)
old_data
);
undo_res
=
write_row
((
byte
*
)
old_data
);
if
(
undo_res
)
push_warning
(
current_thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
undo_res
,
"NDB failed undoing delete at primary key update"
);
m_primary_key_update
=
FALSE
;
m_primary_key_update
=
FALSE
;
}
}
DBUG_RETURN
(
insert_res
);
DBUG_RETURN
(
insert_res
);
...
@@ -2204,7 +2187,7 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
...
@@ -2204,7 +2187,7 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
else
else
{
{
int
res
;
int
res
;
if
((
res
=
set_primary_key_from_
old_data
(
op
,
old_data
)))
if
((
res
=
set_primary_key_from_
record
(
op
,
old_data
)))
DBUG_RETURN
(
res
);
DBUG_RETURN
(
res
);
}
}
}
}
...
@@ -2289,10 +2272,8 @@ int ha_ndbcluster::delete_row(const byte *record)
...
@@ -2289,10 +2272,8 @@ int ha_ndbcluster::delete_row(const byte *record)
else
else
{
{
int
res
;
int
res
;
if
((
res
=
(
m_primary_key_update
?
if
((
res
=
set_primary_key_from_record
(
op
,
record
)))
set_primary_key_from_old_data
(
op
,
record
)
return
res
;
:
set_primary_key
(
op
))))
return
res
;
}
}
}
}
...
...
sql/ha_ndbcluster.h
View file @
fd2efc88
...
@@ -551,7 +551,7 @@ private:
...
@@ -551,7 +551,7 @@ private:
int
pk_read
(
const
byte
*
key
,
uint
key_len
,
byte
*
buf
);
int
pk_read
(
const
byte
*
key
,
uint
key_len
,
byte
*
buf
);
int
complemented_pk_read
(
const
byte
*
old_data
,
byte
*
new_data
);
int
complemented_pk_read
(
const
byte
*
old_data
,
byte
*
new_data
);
int
peek_row
();
int
peek_row
(
const
byte
*
record
);
int
unique_index_read
(
const
byte
*
key
,
uint
key_len
,
int
unique_index_read
(
const
byte
*
key
,
uint
key_len
,
byte
*
buf
);
byte
*
buf
);
int
ordered_index_scan
(
const
key_range
*
start_key
,
int
ordered_index_scan
(
const
key_range
*
start_key
,
...
@@ -580,8 +580,7 @@ private:
...
@@ -580,8 +580,7 @@ private:
friend
int
g_get_ndb_blobs_value
(
NdbBlob
*
ndb_blob
,
void
*
arg
);
friend
int
g_get_ndb_blobs_value
(
NdbBlob
*
ndb_blob
,
void
*
arg
);
int
get_ndb_blobs_value
(
NdbBlob
*
last_ndb_blob
);
int
get_ndb_blobs_value
(
NdbBlob
*
last_ndb_blob
);
int
set_primary_key
(
NdbOperation
*
op
,
const
byte
*
key
);
int
set_primary_key
(
NdbOperation
*
op
,
const
byte
*
key
);
int
set_primary_key
(
NdbOperation
*
op
);
int
set_primary_key_from_record
(
NdbOperation
*
op
,
const
byte
*
record
);
int
set_primary_key_from_old_data
(
NdbOperation
*
op
,
const
byte
*
old_data
);
int
set_bounds
(
NdbIndexScanOperation
*
,
const
key_range
*
keys
[
2
],
uint
=
0
);
int
set_bounds
(
NdbIndexScanOperation
*
,
const
key_range
*
keys
[
2
],
uint
=
0
);
int
key_cmp
(
uint
keynr
,
const
byte
*
old_row
,
const
byte
*
new_row
);
int
key_cmp
(
uint
keynr
,
const
byte
*
old_row
,
const
byte
*
new_row
);
int
set_index_key
(
NdbOperation
*
,
const
KEY
*
key_info
,
const
byte
*
key_ptr
);
int
set_index_key
(
NdbOperation
*
,
const
KEY
*
key_info
,
const
byte
*
key_ptr
);
...
...
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