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
89017ca5
Commit
89017ca5
authored
Aug 10, 2004
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fix for bug#3912
parent
04cc2cc4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
32 deletions
+58
-32
mysql-test/r/ndb_alter_table.result
mysql-test/r/ndb_alter_table.result
+31
-15
mysql-test/t/ndb_alter_table.test
mysql-test/t/ndb_alter_table.test
+3
-2
ndb/src/ndbapi/Ndb.cpp
ndb/src/ndbapi/Ndb.cpp
+14
-9
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+10
-6
No files found.
mysql-test/r/ndb_alter_table.result
View file @
89017ca5
...
...
@@ -15,14 +15,20 @@ col2 varchar(30) not null,
col3 varchar (20) not null,
col4 varchar(4) not null,
col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
col6 int not null, to_be_deleted int) ENGINE=ndbcluster;
insert into t1 values (2,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (25, 4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7);
col6 int not null, to_be_deleted int) ENGINE=ndbcluster;
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);
select * from t1 order by col1;
col1 col2 col3 col4 col5 col6 to_be_deleted
2 4 3 5 PENDING 1 7
3 4 3 5 PENDING 1 7
25 4 3 5 PENDING 1 7
26 4 3 5 PENDING 1 7
0 4 3 5 PENDING 1 7
1 4 3 5 PENDING 1 7
7 4 3 5 PENDING 1 7
8 4 3 5 PENDING 1 7
31 4 3 5 PENDING 1 7
32 4 3 5 PENDING 1 7
99 4 3 5 PENDING 1 7
100 4 3 5 PENDING 1 7
101 4 3 5 PENDING 1 7
alter table t1
add column col4_5 varchar(20) not null after col4,
add column col7 varchar(30) not null after col5,
...
...
@@ -31,16 +37,26 @@ change column col2 fourth varchar(30) not null after col3,
modify column col6 int not null first;
select * from t1 order by col1;
col6 col1 col3 fourth col4 col4_5 col5 col7 col8
1 2 3 4 5 PENDING 0000-00-00 00:00:00
1 3 3 4 5 PENDING 0000-00-00 00:00:00
1 25 3 4 5 PENDING 0000-00-00 00:00:00
1 26 3 4 5 PENDING 0000-00-00 00:00:00
1 0 3 4 5 PENDING 0000-00-00 00:00:00
1 1 3 4 5 PENDING 0000-00-00 00:00:00
1 7 3 4 5 PENDING 0000-00-00 00:00:00
1 8 3 4 5 PENDING 0000-00-00 00:00:00
1 31 3 4 5 PENDING 0000-00-00 00:00:00
1 32 3 4 5 PENDING 0000-00-00 00:00:00
1 99 3 4 5 PENDING 0000-00-00 00:00:00
1 100 3 4 5 PENDING 0000-00-00 00:00:00
1 101 3 4 5 PENDING 0000-00-00 00:00:00
insert into t1 values (2, NULL,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
select * from t1 order by col1;
col6 col1 col3 fourth col4 col4_5 col5 col7 col8
1 2 3 4 5 PENDING 0000-00-00 00:00:00
1 3 3 4 5 PENDING 0000-00-00 00:00:00
1 25 3 4 5 PENDING 0000-00-00 00:00:00
1 26 3 4 5 PENDING 0000-00-00 00:00:00
2 27 4 3 5 99 PENDING EXTRA 2004-01-01 00:00:00
1 0 3 4 5 PENDING 0000-00-00 00:00:00
1 1 3 4 5 PENDING 0000-00-00 00:00:00
1 7 3 4 5 PENDING 0000-00-00 00:00:00
1 8 3 4 5 PENDING 0000-00-00 00:00:00
1 31 3 4 5 PENDING 0000-00-00 00:00:00
1 32 3 4 5 PENDING 0000-00-00 00:00:00
1 99 3 4 5 PENDING 0000-00-00 00:00:00
1 100 3 4 5 PENDING 0000-00-00 00:00:00
1 101 3 4 5 PENDING 0000-00-00 00:00:00
2 102 4 3 5 99 PENDING EXTRA 2004-01-01 00:00:00
drop table t1;
mysql-test/t/ndb_alter_table.test
View file @
89017ca5
...
...
@@ -29,8 +29,9 @@ col2 varchar(30) not null,
col3
varchar
(
20
)
not
null
,
col4
varchar
(
4
)
not
null
,
col5
enum
(
'PENDING'
,
'ACTIVE'
,
'DISABLED'
)
not
null
,
col6
int
not
null
,
to_be_deleted
int
)
ENGINE
=
ndbcluster
;
insert
into
t1
values
(
2
,
4
,
3
,
5
,
"PENDING"
,
1
,
7
),
(
NULL
,
4
,
3
,
5
,
"PENDING"
,
1
,
7
),
(
25
,
4
,
3
,
5
,
"PENDING"
,
1
,
7
),
(
NULL
,
4
,
3
,
5
,
"PENDING"
,
1
,
7
);
col6
int
not
null
,
to_be_deleted
int
)
ENGINE
=
ndbcluster
;
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
);
select
*
from
t1
order
by
col1
;
alter
table
t1
add
column
col4_5
varchar
(
20
)
not
null
after
col4
,
...
...
ndb/src/ndbapi/Ndb.cpp
View file @
89017ca5
...
...
@@ -788,7 +788,7 @@ Ndb::setTupleIdInNdb(Uint32 aTableId, Uint64 val, bool increase )
{
// We have a cache sequence
if
(
val
<=
theFirstTupleId
[
aTableId
]
+
1
)
return
tru
e
;
return
fals
e
;
if
(
val
<=
theLastTupleId
[
aTableId
])
{
theFirstTupleId
[
aTableId
]
=
val
-
1
;
...
...
@@ -811,7 +811,7 @@ Ndb::opTupleIdOnNdb(Uint32 aTableId, Uint64 opValue, Uint32 op)
NdbOperation
*
tOperation
;
Uint64
tValue
;
NdbRecAttr
*
tRecAttrResult
;
int
result
;
Uint64
ret
;
CHECK_STATUS_MACRO_ZERO
;
...
...
@@ -865,8 +865,8 @@ Ndb::opTupleIdOnNdb(Uint32 aTableId, Uint64 opValue, Uint32 op)
if
(
tConnection
->
execute
(
Commit
)
==
-
1
)
goto
error_handler
;
theFirstTupleId
[
aTableId
]
=
~
0
;
theLastTupleId
[
aTableId
]
=
~
0
;
theFirstTupleId
[
aTableId
]
=
~
(
Uint64
)
0
;
theLastTupleId
[
aTableId
]
=
~
(
Uint64
)
0
;
ret
=
opValue
;
break
;
case
2
:
...
...
@@ -876,15 +876,20 @@ Ndb::opTupleIdOnNdb(Uint32 aTableId, Uint64 opValue, Uint32 op)
tOperation
->
read_attr
(
"NEXTID"
,
2
);
tOperation
->
branch_le
(
2
,
1
,
0
);
tOperation
->
write_attr
(
"NEXTID"
,
1
);
tOperation
->
def_label
(
0
);
tOperation
->
interpret_exit_ok
();
tOperation
->
def_label
(
0
);
tOperation
->
interpret_exit_nok
(
9999
);
if
(
tConnection
->
execute
(
Commit
)
==
-
1
)
goto
error_handler
;
theFirstTupleId
[
aTableId
]
=
~
0
;
theLastTupleId
[
aTableId
]
=
~
0
;
ret
=
opValue
;
if
(
result
==
9999
)
ret
=
~
(
Uint64
)
0
;
else
{
theFirstTupleId
[
aTableId
]
=
theLastTupleId
[
aTableId
]
=
opValue
-
1
;
ret
=
opValue
;
}
break
;
default:
goto
error_handler
;
...
...
sql/ha_ndbcluster.cc
View file @
89017ca5
...
...
@@ -1281,7 +1281,7 @@ int ha_ndbcluster::define_read_attrs(byte* buf, NdbOperation* op)
int
ha_ndbcluster
::
write_row
(
byte
*
record
)
{
bool
has_auto_increment
;
bool
has_auto_increment
,
auto_increment_field_not_null
;
uint
i
;
NdbConnection
*
trans
=
m_active_trans
;
NdbOperation
*
op
;
...
...
@@ -1292,7 +1292,8 @@ int ha_ndbcluster::write_row(byte *record)
if
(
table
->
timestamp_default_now
)
update_timestamp
(
record
+
table
->
timestamp_default_now
-
1
);
has_auto_increment
=
(
table
->
next_number_field
&&
record
==
table
->
record
[
0
]);
if
(
has_auto_increment
)
auto_increment_field_not_null
=
table
->
auto_increment_field_not_null
;
if
((
has_auto_increment
)
&&
(
!
auto_increment_field_not_null
))
update_auto_increment
();
if
(
!
(
op
=
trans
->
getNdbOperation
(
m_tabname
)))
...
...
@@ -1346,11 +1347,14 @@ int ha_ndbcluster::write_row(byte *record)
if
(
trans
->
execute
(
NoCommit
)
!=
0
)
DBUG_RETURN
(
ndb_err
(
trans
));
}
if
(
(
has_auto_increment
)
&&
(
!
auto_increment_column_changed
)
)
{
if
(
(
has_auto_increment
)
&&
(
auto_increment_field_not_null
)
)
{
Uint64
next_val
=
(
Uint64
)
table
->
next_number_field
->
val_int
()
+
1
;
DBUG_PRINT
(
"info"
,
(
"Setting next auto increment value to %u"
,
next_val
));
m_ndb
->
setAutoIncrementValue
(
m_tabname
,
next_val
,
true
);
DBUG_PRINT
(
"info"
,
(
"Trying to set next auto increment value to %u"
,
next_val
));
if
(
m_ndb
->
setAutoIncrementValue
(
m_tabname
,
next_val
,
true
))
DBUG_PRINT
(
"info"
,
(
"Setting next auto increment value to %u"
,
next_val
));
}
DBUG_RETURN
(
0
);
...
...
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