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
7e32a4b8
Commit
7e32a4b8
authored
Mar 09, 2007
by
tomas@poseidon.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge poseidon.mysql.com:/home/tomas/mysql-5.1-telco-gca
into poseidon.mysql.com:/home/tomas/mysql-5.1
parents
965ca425
5a6952b8
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
168 additions
and
18 deletions
+168
-18
mysql-test/r/ndb_single_user.result
mysql-test/r/ndb_single_user.result
+46
-0
mysql-test/t/ndb_single_user.test
mysql-test/t/ndb_single_user.test
+84
-0
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
+20
-15
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp
+2
-0
storage/ndb/src/kernel/vm/Pool.hpp
storage/ndb/src/kernel/vm/Pool.hpp
+5
-2
storage/ndb/tools/waiter.cpp
storage/ndb/tools/waiter.cpp
+11
-1
No files found.
mysql-test/r/ndb_single_user.result
0 → 100644
View file @
7e32a4b8
use test;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
create table t1 (a int key, b int unique, c int) engine ndb;
ERROR HY000: Can't create table './test/t1.frm' (errno: 155)
create table t1 (a int key, b int unique, c int) engine ndb;
insert into t1 values (1,1,0),(2,2,0),(3,3,0),(4,4,0),(5,5,0),(6,6,0),(7,7,0),(8,8,0),(9,9,0),(10,10,0);
create table t2 as select * from t1;
select * from t1 where a = 1;
a b c
1 1 0
select * from t1 where b = 4;
a b c
4 4 0
select * from t1 where a > 4 order by a;
a b c
5 5 0
6 6 0
7 7 0
8 8 0
9 9 0
10 10 0
update t1 set b=102 where a = 2;
update t1 set b=103 where b = 3;
update t1 set b=b+100;
update t1 set b=b+100 where a > 7;
delete from t1;
insert into t1 select * from t2;
drop table t1;
ERROR 42S02: Unknown table 't1'
create index new_index on t1 (c);
ERROR 42S02: Table 'test.t1' doesn't exist
insert into t1 values (1,1,0),(2,2,0),(3,3,0),(4,4,0),(5,5,0),(6,6,0),(7,7,0),(8,8,0),(9,9,0),(10,10,0);
ERROR 42S02: Table 'test.t1' doesn't exist
select * from t1 where a = 1;
ERROR 42S02: Table 'test.t1' doesn't exist
select * from t1 where b = 4;
ERROR 42S02: Table 'test.t1' doesn't exist
update t1 set b=102 where a = 2;
ERROR 42S02: Table 'test.t1' doesn't exist
update t1 set b=103 where b = 3;
ERROR 42S02: Table 'test.t1' doesn't exist
update t1 set b=b+100;
ERROR 42S02: Table 'test.t1' doesn't exist
update t1 set b=b+100 where a > 7;
ERROR 42S02: Table 'test.t1' doesn't exist
drop table t1;
mysql-test/t/ndb_single_user.test
0 → 100644
View file @
7e32a4b8
--
source
include
/
have_ndb
.
inc
--
source
include
/
have_multi_ndb
.
inc
--
source
include
/
ndb_default_cluster
.
inc
--
source
include
/
not_embedded
.
inc
--
disable_warnings
use
test
;
drop
table
if
exists
t1
,
t2
,
t3
,
t4
,
t5
,
t6
,
t7
,
t8
,
t9
,
t10
;
--
enable_warnings
# operations allowed while cluster is in single user mode
--
connection
server1
--
let
$node_id
=
`SHOW STATUS LIKE 'Ndb_cluster_node_id'`
--
disable_query_log
--
eval
set
@
node_id
=
SUBSTRING
(
'$node_id'
,
20
)
+
0
--
enable_query_log
--
let
$node_id
=
`SELECT @node_id`
--
exec
$NDB_MGM
--
no
-
defaults
--
ndb
-
connectstring
=
"localhost:
$NDBCLUSTER_PORT
"
-
e
"enter single user mode
$node_id
"
>>
$NDB_TOOLS_OUTPUT
--
exec
$NDB_TOOLS_DIR
/
ndb_waiter
--
no
-
defaults
--
ndb
-
connectstring
=
"localhost:
$NDBCLUSTER_PORT
"
--
single
-
user
>>
$NDB_TOOLS_OUTPUT
# verify that we are indeed in single user mode
--
connection
server2
--
error
1005
create
table
t1
(
a
int
key
,
b
int
unique
,
c
int
)
engine
ndb
;
# test some sql on first mysqld
--
connection
server1
create
table
t1
(
a
int
key
,
b
int
unique
,
c
int
)
engine
ndb
;
insert
into
t1
values
(
1
,
1
,
0
),(
2
,
2
,
0
),(
3
,
3
,
0
),(
4
,
4
,
0
),(
5
,
5
,
0
),(
6
,
6
,
0
),(
7
,
7
,
0
),(
8
,
8
,
0
),(
9
,
9
,
0
),(
10
,
10
,
0
);
create
table
t2
as
select
*
from
t1
;
# read with pk
select
*
from
t1
where
a
=
1
;
# read with unique index
select
*
from
t1
where
b
=
4
;
# read with ordered index
select
*
from
t1
where
a
>
4
order
by
a
;
# update with pk
update
t1
set
b
=
102
where
a
=
2
;
# update with unique index
update
t1
set
b
=
103
where
b
=
3
;
# update with full table scan
update
t1
set
b
=
b
+
100
;
# update with ordered insex scan
update
t1
set
b
=
b
+
100
where
a
>
7
;
# delete with full table scan
delete
from
t1
;
insert
into
t1
select
*
from
t2
;
# test some sql on other mysqld
--
connection
server2
--
error
1051
drop
table
t1
;
--
error
1146
#--error 1296
create
index
new_index
on
t1
(
c
);
--
error
1146
#--error 1296
insert
into
t1
values
(
1
,
1
,
0
),(
2
,
2
,
0
),(
3
,
3
,
0
),(
4
,
4
,
0
),(
5
,
5
,
0
),(
6
,
6
,
0
),(
7
,
7
,
0
),(
8
,
8
,
0
),(
9
,
9
,
0
),(
10
,
10
,
0
);
--
error
1146
#--error 1296
select
*
from
t1
where
a
=
1
;
--
error
1146
#--error 1296
select
*
from
t1
where
b
=
4
;
--
error
1146
#--error 1296
update
t1
set
b
=
102
where
a
=
2
;
--
error
1146
#--error 1296
update
t1
set
b
=
103
where
b
=
3
;
--
error
1146
#--error 1296
update
t1
set
b
=
b
+
100
;
--
error
1146
#--error 1296
update
t1
set
b
=
b
+
100
where
a
>
7
;
--
exec
$NDB_MGM
--
no
-
defaults
--
ndb
-
connectstring
=
"localhost:
$NDBCLUSTER_PORT
"
-
e
"exit single user mode"
>>
$NDB_TOOLS_OUTPUT
--
exec
$NDB_TOOLS_DIR
/
ndb_waiter
--
no
-
defaults
>>
$NDB_TOOLS_OUTPUT
# cleanup
--
connection
server1
drop
table
t1
;
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
View file @
7e32a4b8
...
@@ -3758,9 +3758,7 @@ Dbdict::execCREATE_TABLE_REQ(Signal* signal){
...
@@ -3758,9 +3758,7 @@ Dbdict::execCREATE_TABLE_REQ(Signal* signal){
break
;
break
;
}
}
if
(
getNodeState
().
getSingleUserMode
()
&&
if
(
checkSingleUserMode
(
signal
->
getSendersBlockRef
()))
(
refToNode
(
signal
->
getSendersBlockRef
())
!=
getNodeState
().
getSingleUserApi
()))
{
{
jam
();
jam
();
parseRecord
.
errorCode
=
CreateTableRef
::
SingleUser
;
parseRecord
.
errorCode
=
CreateTableRef
::
SingleUser
;
...
@@ -3959,9 +3957,7 @@ Dbdict::execALTER_TABLE_REQ(Signal* signal)
...
@@ -3959,9 +3957,7 @@ Dbdict::execALTER_TABLE_REQ(Signal* signal)
return
;
return
;
}
}
if
(
getNodeState
().
getSingleUserMode
()
&&
if
(
checkSingleUserMode
(
signal
->
getSendersBlockRef
()))
(
refToNode
(
signal
->
getSendersBlockRef
())
!=
getNodeState
().
getSingleUserApi
()))
{
{
jam
();
jam
();
alterTableRef
(
signal
,
req
,
AlterTableRef
::
SingleUser
);
alterTableRef
(
signal
,
req
,
AlterTableRef
::
SingleUser
);
...
@@ -6560,9 +6556,7 @@ Dbdict::execDROP_TABLE_REQ(Signal* signal){
...
@@ -6560,9 +6556,7 @@ Dbdict::execDROP_TABLE_REQ(Signal* signal){
return
;
return
;
}
}
if
(
getNodeState
().
getSingleUserMode
()
&&
if
(
checkSingleUserMode
(
signal
->
getSendersBlockRef
()))
(
refToNode
(
signal
->
getSendersBlockRef
())
!=
getNodeState
().
getSingleUserApi
()))
{
{
jam
();
jam
();
dropTableRef
(
signal
,
req
,
DropTableRef
::
SingleUser
);
dropTableRef
(
signal
,
req
,
DropTableRef
::
SingleUser
);
...
@@ -7776,9 +7770,7 @@ Dbdict::execCREATE_INDX_REQ(Signal* signal)
...
@@ -7776,9 +7770,7 @@ Dbdict::execCREATE_INDX_REQ(Signal* signal)
jam
();
jam
();
tmperr
=
CreateIndxRef
::
Busy
;
tmperr
=
CreateIndxRef
::
Busy
;
}
}
else
if
(
getNodeState
().
getSingleUserMode
()
&&
else
if
(
checkSingleUserMode
(
senderRef
))
(
refToNode
(
senderRef
)
!=
getNodeState
().
getSingleUserApi
()))
{
{
jam
();
jam
();
tmperr
=
CreateIndxRef
::
SingleUser
;
tmperr
=
CreateIndxRef
::
SingleUser
;
...
@@ -8426,9 +8418,7 @@ Dbdict::execDROP_INDX_REQ(Signal* signal)
...
@@ -8426,9 +8418,7 @@ Dbdict::execDROP_INDX_REQ(Signal* signal)
jam
();
jam
();
tmperr
=
DropIndxRef
::
Busy
;
tmperr
=
DropIndxRef
::
Busy
;
}
}
else
if
(
getNodeState
().
getSingleUserMode
()
&&
else
if
(
checkSingleUserMode
(
senderRef
))
(
refToNode
(
senderRef
)
!=
getNodeState
().
getSingleUserApi
()))
{
{
jam
();
jam
();
tmperr
=
DropIndxRef
::
SingleUser
;
tmperr
=
DropIndxRef
::
SingleUser
;
...
@@ -16348,3 +16338,18 @@ Dbdict::send_drop_fg(Signal* signal, SchemaOp* op,
...
@@ -16348,3 +16338,18 @@ Dbdict::send_drop_fg(Signal* signal, SchemaOp* op,
DropFilegroupImplReq
::
SignalLength
,
JBB
);
DropFilegroupImplReq
::
SignalLength
,
JBB
);
}
}
/*
return 1 if all of the below is true
a) node in single user mode
b) senderRef is not a db node
c) senderRef nodeid is not the singleUserApi
*/
int
Dbdict
::
checkSingleUserMode
(
Uint32
senderRef
)
{
Uint32
nodeId
=
refToNode
(
senderRef
);
return
getNodeState
().
getSingleUserMode
()
&&
(
getNodeInfo
(
nodeId
).
m_type
!=
NodeInfo
::
DB
)
&&
(
nodeId
!=
getNodeState
().
getSingleUserApi
());
}
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp
View file @
7e32a4b8
...
@@ -2649,6 +2649,8 @@ public:
...
@@ -2649,6 +2649,8 @@ public:
void
send_drop_fg
(
Signal
*
,
SchemaOp
*
,
DropFilegroupImplReq
::
RequestInfo
);
void
send_drop_fg
(
Signal
*
,
SchemaOp
*
,
DropFilegroupImplReq
::
RequestInfo
);
void
drop_undofile_prepare_start
(
Signal
*
signal
,
SchemaOp
*
);
void
drop_undofile_prepare_start
(
Signal
*
signal
,
SchemaOp
*
);
int
checkSingleUserMode
(
Uint32
senderRef
);
}
;
}
;
inline
bool
inline
bool
...
...
storage/ndb/src/kernel/vm/Pool.hpp
View file @
7e32a4b8
...
@@ -307,8 +307,11 @@ RecordPool<T, P>::seize(Ptr<T> & ptr)
...
@@ -307,8 +307,11 @@ RecordPool<T, P>::seize(Ptr<T> & ptr)
{
{
Ptr
<
void
>
tmp
;
Ptr
<
void
>
tmp
;
bool
ret
=
m_pool
.
seize
(
tmp
);
bool
ret
=
m_pool
.
seize
(
tmp
);
if
(
likely
(
ret
))
{
ptr
.
i
=
tmp
.
i
;
ptr
.
i
=
tmp
.
i
;
ptr
.
p
=
static_cast
<
T
*>
(
tmp
.
p
);
ptr
.
p
=
static_cast
<
T
*>
(
tmp
.
p
);
}
return
ret
;
return
ret
;
}
}
...
...
storage/ndb/tools/waiter.cpp
View file @
7e32a4b8
...
@@ -30,12 +30,14 @@ waitClusterStatus(const char* _addr, ndb_mgm_node_status _status,
...
@@ -30,12 +30,14 @@ waitClusterStatus(const char* _addr, ndb_mgm_node_status _status,
unsigned
int
_timeout
);
unsigned
int
_timeout
);
enum
ndb_waiter_options
{
enum
ndb_waiter_options
{
OPT_WAIT_STATUS_NOT_STARTED
=
NDB_STD_OPTIONS_LAST
OPT_WAIT_STATUS_NOT_STARTED
=
NDB_STD_OPTIONS_LAST
,
OPT_WAIT_STATUS_SINGLE_USER
};
};
NDB_STD_OPTS_VARS
;
NDB_STD_OPTS_VARS
;
static
int
_no_contact
=
0
;
static
int
_no_contact
=
0
;
static
int
_not_started
=
0
;
static
int
_not_started
=
0
;
static
int
_single_user
=
0
;
static
int
_timeout
=
120
;
static
int
_timeout
=
120
;
const
char
*
load_default_groups
[]
=
{
"mysql_cluster"
,
0
};
const
char
*
load_default_groups
[]
=
{
"mysql_cluster"
,
0
};
...
@@ -49,6 +51,10 @@ static struct my_option my_long_options[] =
...
@@ -49,6 +51,10 @@ static struct my_option my_long_options[] =
{
"not-started"
,
OPT_WAIT_STATUS_NOT_STARTED
,
"Wait for cluster not started"
,
{
"not-started"
,
OPT_WAIT_STATUS_NOT_STARTED
,
"Wait for cluster not started"
,
(
gptr
*
)
&
_not_started
,
(
gptr
*
)
&
_not_started
,
0
,
(
gptr
*
)
&
_not_started
,
(
gptr
*
)
&
_not_started
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"single-user"
,
OPT_WAIT_STATUS_SINGLE_USER
,
"Wait for cluster to enter single user mode"
,
(
gptr
*
)
&
_single_user
,
(
gptr
*
)
&
_single_user
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"timeout"
,
't'
,
"Timeout to wait"
,
{
"timeout"
,
't'
,
"Timeout to wait"
,
(
gptr
*
)
&
_timeout
,
(
gptr
*
)
&
_timeout
,
0
,
(
gptr
*
)
&
_timeout
,
(
gptr
*
)
&
_timeout
,
0
,
GET_INT
,
REQUIRED_ARG
,
120
,
0
,
0
,
0
,
0
,
0
},
GET_INT
,
REQUIRED_ARG
,
120
,
0
,
0
,
0
,
0
,
0
},
...
@@ -90,6 +96,10 @@ int main(int argc, char** argv){
...
@@ -90,6 +96,10 @@ int main(int argc, char** argv){
{
{
wait_status
=
NDB_MGM_NODE_STATUS_NOT_STARTED
;
wait_status
=
NDB_MGM_NODE_STATUS_NOT_STARTED
;
}
}
else
if
(
_single_user
)
{
wait_status
=
NDB_MGM_NODE_STATUS_SINGLEUSER
;
}
else
else
{
{
wait_status
=
NDB_MGM_NODE_STATUS_STARTED
;
wait_status
=
NDB_MGM_NODE_STATUS_STARTED
;
...
...
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