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
533b3f0a
Commit
533b3f0a
authored
Apr 08, 2005
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge from fix of Bug #9675 Auto-increment not working with INSERT..SELECT and NDB storage
parent
d13a7b53
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
101 additions
and
2 deletions
+101
-2
mysql-test/r/ndb_alter_table.result
mysql-test/r/ndb_alter_table.result
+1
-1
mysql-test/r/ndb_basic.result
mysql-test/r/ndb_basic.result
+60
-0
mysql-test/t/ndb_basic.test
mysql-test/t/ndb_basic.test
+27
-0
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+13
-1
No files found.
mysql-test/r/ndb_alter_table.result
View file @
533b3f0a
...
...
@@ -40,7 +40,7 @@ insert into t1 values
(0,4,3,5,"PENDING",1,7),(NULL,4,3,5,"PENDING",1,7),(31,4,3,5,"PENDING",1,7), (7,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (100,4,3,5,"PENDING",1,7), (99,4,3,5,"PENDING",1,7), (8,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 ndbcluster 10 Dynamic 9 96 # # 0 # 10
1
# # # latin1_swedish_ci NULL #
t1 ndbcluster 10 Dynamic 9 96 # # 0 # 10
2
# # # latin1_swedish_ci NULL #
select * from t1 order by col1;
col1 col2 col3 col4 col5 col6 to_be_deleted
0 4 3 5 PENDING 1 7
...
...
mysql-test/r/ndb_basic.result
View file @
533b3f0a
...
...
@@ -607,3 +607,63 @@ primary key (a))
engine=ndb
max_rows=1;
drop table t1;
create table t1
(counter int(64) NOT NULL auto_increment,
datavalue char(40) default 'XXXX',
primary key (counter)
) ENGINE=ndbcluster;
insert into t1 (datavalue) values ('newval');
insert into t1 (datavalue) values ('newval');
select * from t1 order by counter;
counter datavalue
1 newval
2 newval
insert into t1 (datavalue) select datavalue from t1 where counter < 100;
insert into t1 (datavalue) select datavalue from t1 where counter < 100;
select * from t1 order by counter;
counter datavalue
1 newval
2 newval
3 newval
4 newval
5 newval
6 newval
7 newval
8 newval
insert into t1 (datavalue) select datavalue from t1 where counter < 100;
insert into t1 (datavalue) select datavalue from t1 where counter < 100;
select * from t1 order by counter;
counter datavalue
1 newval
2 newval
3 newval
4 newval
5 newval
6 newval
7 newval
8 newval
35 newval
36 newval
37 newval
38 newval
39 newval
40 newval
41 newval
42 newval
43 newval
44 newval
45 newval
46 newval
47 newval
48 newval
49 newval
50 newval
51 newval
52 newval
53 newval
54 newval
55 newval
56 newval
57 newval
58 newval
drop table t1;
mysql-test/t/ndb_basic.test
View file @
533b3f0a
...
...
@@ -577,3 +577,30 @@ create table t1
engine
=
ndb
max_rows
=
1
;
drop
table
t1
;
#
# Test auto_increment
#
connect
(
con1
,
localhost
,,,
test
);
connect
(
con2
,
localhost
,,,
test
);
create
table
t1
(
counter
int
(
64
)
NOT
NULL
auto_increment
,
datavalue
char
(
40
)
default
'XXXX'
,
primary
key
(
counter
)
)
ENGINE
=
ndbcluster
;
connection
con1
;
insert
into
t1
(
datavalue
)
values
(
'newval'
);
insert
into
t1
(
datavalue
)
values
(
'newval'
);
select
*
from
t1
order
by
counter
;
insert
into
t1
(
datavalue
)
select
datavalue
from
t1
where
counter
<
100
;
insert
into
t1
(
datavalue
)
select
datavalue
from
t1
where
counter
<
100
;
select
*
from
t1
order
by
counter
;
connection
con2
;
insert
into
t1
(
datavalue
)
select
datavalue
from
t1
where
counter
<
100
;
insert
into
t1
(
datavalue
)
select
datavalue
from
t1
where
counter
<
100
;
select
*
from
t1
order
by
counter
;
drop
table
t1
;
sql/ha_ndbcluster.cc
View file @
533b3f0a
...
...
@@ -1919,8 +1919,12 @@ int ha_ndbcluster::write_row(byte *record)
if
(
has_auto_increment
)
{
THD
*
thd
=
table
->
in_use
;
m_skip_auto_increment
=
FALSE
;
update_auto_increment
();
/* Ensure that handler is always called for auto_increment values */
thd
->
next_insert_id
=
0
;
m_skip_auto_increment
=
!
auto_increment_column_changed
;
}
...
...
@@ -2970,7 +2974,11 @@ void ha_ndbcluster::start_bulk_insert(ha_rows rows)
DBUG_PRINT
(
"enter"
,
(
"rows: %d"
,
(
int
)
rows
));
m_rows_inserted
=
0
;
m_rows_to_insert
=
rows
;
if
(
rows
==
0
)
/* We don't know how many will be inserted, guess */
m_rows_to_insert
=
m_autoincrement_prefetch
;
else
m_rows_to_insert
=
rows
;
/*
Calculate how many rows that should be inserted
...
...
@@ -4080,6 +4088,10 @@ ulonglong ha_ndbcluster::get_auto_increment()
DBUG_ENTER
(
"get_auto_increment"
);
DBUG_PRINT
(
"enter"
,
(
"m_tabname: %s"
,
m_tabname
));
Ndb
*
ndb
=
get_ndb
();
if
(
m_rows_inserted
>
m_rows_to_insert
)
/* We guessed too low */
m_rows_to_insert
+=
m_autoincrement_prefetch
;
cache_size
=
(
m_rows_to_insert
-
m_rows_inserted
<
m_autoincrement_prefetch
)
?
m_rows_to_insert
-
m_rows_inserted
...
...
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