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
9aab724d
Commit
9aab724d
authored
Sep 20, 2004
by
magnus@neptunus.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ues buf pointer in get_ndb_value
Merge fixes
parent
47168d12
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
15 deletions
+26
-15
mysql-test/r/ndb_insert.result
mysql-test/r/ndb_insert.result
+2
-3
mysql-test/t/ndb_insert.test
mysql-test/t/ndb_insert.test
+10
-1
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+14
-11
No files found.
mysql-test/r/ndb_insert.result
View file @
9aab724d
...
@@ -432,13 +432,12 @@ INSERT INTO t1 VALUES
...
@@ -432,13 +432,12 @@ INSERT INTO t1 VALUES
SELECT COUNT(*) FROM t1;
SELECT COUNT(*) FROM t1;
COUNT(*)
COUNT(*)
2005
2005
rollback;
begin;
INSERT INTO t1 VALUES
INSERT INTO t1 VALUES
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
ERROR 23000: Duplicate entry '10' for key 1
ERROR 23000: Duplicate entry '10' for key 1
SELECT COUNT(*) FROM t1;
COUNT(*)
2000
commit;
commit;
ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
select * from t1 where pk1=1;
select * from t1 where pk1=1;
...
...
mysql-test/t/ndb_insert.test
View file @
9aab724d
...
@@ -440,6 +440,16 @@ INSERT INTO t1 VALUES
...
@@ -440,6 +440,16 @@ INSERT INTO t1 VALUES
select
count
(
*
)
from
t1
;
select
count
(
*
)
from
t1
;
#
# Test that select count(*) can see inserts made in the same transaction
#
begin
;
SELECT
COUNT
(
*
)
FROM
t1
;
INSERT
INTO
t1
VALUES
(
2001
,
2001
,
2001
),(
2002
,
2002
,
2002
),(
2003
,
2003
,
2003
),(
2004
,
2004
,
2004
),(
2005
,
2005
,
2005
);
SELECT
COUNT
(
*
)
FROM
t1
;
rollback
;
#
#
# Insert duplicate rows, inside transaction
# Insert duplicate rows, inside transaction
# try to commit
# try to commit
...
@@ -519,7 +529,6 @@ SELECT * FROM t1 WHERE pk1=10;
...
@@ -519,7 +529,6 @@ SELECT * FROM t1 WHERE pk1=10;
--
error
1296
--
error
1296
commit
;
commit
;
SELECT
COUNT
(
*
)
FROM
t1
;
select
*
from
t1
where
pk1
=
1
;
select
*
from
t1
where
pk1
=
1
;
select
*
from
t1
where
pk1
=
10
;
select
*
from
t1
where
pk1
=
10
;
...
...
sql/ha_ndbcluster.cc
View file @
9aab724d
...
@@ -282,8 +282,8 @@ bool ha_ndbcluster::get_error_message(int error,
...
@@ -282,8 +282,8 @@ bool ha_ndbcluster::get_error_message(int error,
{
{
DBUG_ENTER
(
"ha_ndbcluster::get_error_message"
);
DBUG_ENTER
(
"ha_ndbcluster::get_error_message"
);
DBUG_PRINT
(
"enter"
,
(
"error: %d"
,
error
));
DBUG_PRINT
(
"enter"
,
(
"error: %d"
,
error
));
Ndb
*
ndb
=
(
Ndb
*
)
current_thd
->
transaction
.
ndb
;
Ndb
*
ndb
=
((
Thd_ndb
*
)
current_thd
->
transaction
.
thd_ndb
)
->
ndb
;
if
(
!
ndb
)
if
(
!
ndb
)
DBUG_RETURN
(
false
);
DBUG_RETURN
(
false
);
...
@@ -517,7 +517,7 @@ int ha_ndbcluster::get_ndb_blobs_value(NdbBlob *last_ndb_blob)
...
@@ -517,7 +517,7 @@ int ha_ndbcluster::get_ndb_blobs_value(NdbBlob *last_ndb_blob)
*/
*/
int
ha_ndbcluster
::
get_ndb_value
(
NdbOperation
*
ndb_op
,
Field
*
field
,
int
ha_ndbcluster
::
get_ndb_value
(
NdbOperation
*
ndb_op
,
Field
*
field
,
uint
fieldnr
)
uint
fieldnr
,
byte
*
buf
)
{
{
DBUG_ENTER
(
"get_ndb_value"
);
DBUG_ENTER
(
"get_ndb_value"
);
DBUG_PRINT
(
"enter"
,
(
"fieldnr: %d flags: %o"
,
fieldnr
,
DBUG_PRINT
(
"enter"
,
(
"fieldnr: %d flags: %o"
,
fieldnr
,
...
@@ -525,12 +525,15 @@ int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field,
...
@@ -525,12 +525,15 @@ int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field,
if
(
field
!=
NULL
)
if
(
field
!=
NULL
)
{
{
DBUG_ASSERT
(
buf
);
if
(
ndb_supported_type
(
field
->
type
()))
if
(
ndb_supported_type
(
field
->
type
()))
{
{
DBUG_ASSERT
(
field
->
ptr
!=
NULL
);
DBUG_ASSERT
(
field
->
ptr
!=
NULL
);
if
(
!
(
field
->
flags
&
BLOB_FLAG
))
if
(
!
(
field
->
flags
&
BLOB_FLAG
))
{
{
m_value
[
fieldnr
].
rec
=
ndb_op
->
getValue
(
fieldnr
,
field
->
ptr
);
byte
*
field_buf
=
buf
+
(
field
->
ptr
-
table
->
record
[
0
]);
m_value
[
fieldnr
].
rec
=
ndb_op
->
getValue
(
fieldnr
,
field_buf
);
DBUG_RETURN
(
m_value
[
fieldnr
].
rec
==
NULL
);
DBUG_RETURN
(
m_value
[
fieldnr
].
rec
==
NULL
);
}
}
...
@@ -948,7 +951,7 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf)
...
@@ -948,7 +951,7 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf)
ERR_RETURN
(
trans
->
getNdbError
());
ERR_RETURN
(
trans
->
getNdbError
());
// Read key at the same time, for future reference
// Read key at the same time, for future reference
if
(
get_ndb_value
(
op
,
NULL
,
no_fields
))
if
(
get_ndb_value
(
op
,
NULL
,
no_fields
,
NULL
))
ERR_RETURN
(
trans
->
getNdbError
());
ERR_RETURN
(
trans
->
getNdbError
());
}
}
else
else
...
@@ -965,7 +968,7 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf)
...
@@ -965,7 +968,7 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf)
if
((
thd
->
query_id
==
field
->
query_id
)
||
if
((
thd
->
query_id
==
field
->
query_id
)
||
retrieve_all_fields
)
retrieve_all_fields
)
{
{
if
(
get_ndb_value
(
op
,
field
,
i
))
if
(
get_ndb_value
(
op
,
field
,
i
,
buf
))
ERR_RETURN
(
trans
->
getNdbError
());
ERR_RETURN
(
trans
->
getNdbError
());
}
}
else
else
...
@@ -1019,7 +1022,7 @@ int ha_ndbcluster::complemented_pk_read(const byte *old_data, byte *new_data)
...
@@ -1019,7 +1022,7 @@ int ha_ndbcluster::complemented_pk_read(const byte *old_data, byte *new_data)
if
(
!
(
field
->
flags
&
PRI_KEY_FLAG
)
&&
if
(
!
(
field
->
flags
&
PRI_KEY_FLAG
)
&&
(
thd
->
query_id
!=
field
->
query_id
))
(
thd
->
query_id
!=
field
->
query_id
))
{
{
if
(
get_ndb_value
(
op
,
field
,
i
))
if
(
get_ndb_value
(
op
,
field
,
i
,
new_data
))
ERR_RETURN
(
trans
->
getNdbError
());
ERR_RETURN
(
trans
->
getNdbError
());
}
}
}
}
...
@@ -1082,7 +1085,7 @@ int ha_ndbcluster::unique_index_read(const byte *key,
...
@@ -1082,7 +1085,7 @@ int ha_ndbcluster::unique_index_read(const byte *key,
if
((
thd
->
query_id
==
field
->
query_id
)
||
if
((
thd
->
query_id
==
field
->
query_id
)
||
(
field
->
flags
&
PRI_KEY_FLAG
))
(
field
->
flags
&
PRI_KEY_FLAG
))
{
{
if
(
get_ndb_value
(
op
,
field
,
i
))
if
(
get_ndb_value
(
op
,
field
,
i
,
buf
))
ERR_RETURN
(
op
->
getNdbError
());
ERR_RETURN
(
op
->
getNdbError
());
}
}
else
else
...
@@ -1481,7 +1484,7 @@ int ha_ndbcluster::define_read_attrs(byte* buf, NdbOperation* op)
...
@@ -1481,7 +1484,7 @@ int ha_ndbcluster::define_read_attrs(byte* buf, NdbOperation* op)
(
field
->
flags
&
PRI_KEY_FLAG
)
||
(
field
->
flags
&
PRI_KEY_FLAG
)
||
retrieve_all_fields
)
retrieve_all_fields
)
{
{
if
(
get_ndb_value
(
op
,
field
,
i
))
if
(
get_ndb_value
(
op
,
field
,
i
,
buf
))
ERR_RETURN
(
op
->
getNdbError
());
ERR_RETURN
(
op
->
getNdbError
());
}
}
else
else
...
@@ -1500,7 +1503,7 @@ int ha_ndbcluster::define_read_attrs(byte* buf, NdbOperation* op)
...
@@ -1500,7 +1503,7 @@ int ha_ndbcluster::define_read_attrs(byte* buf, NdbOperation* op)
if
(
!
tab
->
getColumn
(
hidden_no
))
if
(
!
tab
->
getColumn
(
hidden_no
))
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
#endif
#endif
if
(
get_ndb_value
(
op
,
NULL
,
hidden_no
))
if
(
get_ndb_value
(
op
,
NULL
,
hidden_no
,
NULL
))
ERR_RETURN
(
op
->
getNdbError
());
ERR_RETURN
(
op
->
getNdbError
());
}
}
...
...
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