Commit 2893e209 authored by serg@serg.mylan's avatar serg@serg.mylan

Merge bk-internal.mysql.com:/home/bk/mysql-5.1

into serg.mylan:/usr/home/serg/Abk/m51
parents c4dd4a39 1327ca01
......@@ -880,7 +880,7 @@ int sendData(SSL& ssl, const void* buffer, int sz)
ssl.SetError(no_error);
ssl.verfiyHandShakeComplete();
if (ssl.GetError()) return 0;
if (ssl.GetError()) return -1;
int sent = 0;
for (;;) {
......@@ -891,7 +891,7 @@ int sendData(SSL& ssl, const void* buffer, int sz)
buildMessage(ssl, out, data);
ssl.Send(out.get_buffer(), out.get_size());
if (ssl.GetError()) return 0;
if (ssl.GetError()) return -1;
sent += len;
if (sent == sz) break;
}
......@@ -918,14 +918,14 @@ int receiveData(SSL& ssl, Data& data)
ssl.SetError(no_error);
ssl.verfiyHandShakeComplete();
if (ssl.GetError()) return 0;
if (ssl.GetError()) return -1;
if (!ssl.bufferedData())
processReply(ssl);
ssl.fillData(data);
ssl.useLog().ShowData(data.get_length());
if (ssl.GetError()) return 0;
if (ssl.GetError()) return -1;
if (data.get_length() == 0 && ssl.getSocket().WouldBlock()) {
ssl.SetError(YasslError(SSL_ERROR_WANT_READ));
......
......@@ -113,13 +113,22 @@ uint Socket::get_ready() const
uint Socket::send(const byte* buf, unsigned int sz, int flags) const
{
const byte* pos = buf;
const byte* end = pos + sz;
assert(socket_ != INVALID_SOCKET);
int sent = ::send(socket_, reinterpret_cast<const char *>(buf), sz, flags);
while (pos != end) {
int sent = ::send(socket_, reinterpret_cast<const char *>(pos),
static_cast<int>(end - pos), flags);
if (sent == -1)
return 0;
return sent;
pos += sent;
}
return sz;
}
......
......@@ -1842,5 +1842,29 @@ a b
select * from t1 where b like 'abc' or b like 'abc';
a b
3 abc
drop table t1;
create table t1 ( fname varchar(255), lname varchar(255) )
engine=ndbcluster;
insert into t1 values ("Young","Foo");
set engine_condition_pushdown = 0;
SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
fname lname
Young Foo
set engine_condition_pushdown = 1;
SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
fname lname
Young Foo
insert into t1 values ("aaa", "aaa");
insert into t1 values ("bbb", "bbb");
insert into t1 values ("ccc", "ccc");
insert into t1 values ("ddd", "ddd");
set engine_condition_pushdown = 0;
SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
fname lname
Young Foo
set engine_condition_pushdown = 1;
SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
fname lname
Young Foo
set engine_condition_pushdown = @old_ecpd;
DROP TABLE t1,t2,t3,t4,t5;
......@@ -1397,3 +1397,14 @@ c1
9999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999
drop table t1;
create table t1 (i int, j int);
insert into t1 values (1,1), (1,2), (2,3), (2,4);
select i, count(distinct j) from t1 group by i;
i count(distinct j)
1 2
2 2
select i+0.0 as i2, count(distinct j) from t1 group by i2;
i2 count(distinct j)
1.0 2
2.0 2
drop table t1;
......@@ -620,3 +620,32 @@ ERROR HY000: There is no 'no-such-user'@'localhost' registered
DROP VIEW v;
DROP TABLE t1;
USE test;
CREATE USER mysqltest_db1@localhost identified by 'PWD';
GRANT ALL ON mysqltest_db1.* TO mysqltest_db1@localhost WITH GRANT OPTION;
CREATE SCHEMA mysqltest_db1 ;
USE mysqltest_db1 ;
CREATE TABLE t1 (f1 INTEGER);
CREATE VIEW view1 AS
SELECT * FROM t1;
SHOW CREATE VIEW view1;
View Create View
view1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_db1`@`localhost` SQL SECURITY DEFINER VIEW `view1` AS select `t1`.`f1` AS `f1` from `t1`
CREATE VIEW view2 AS
SELECT * FROM view1;
# Here comes a suspicious warning
SHOW CREATE VIEW view2;
View Create View
view2 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_db1`@`localhost` SQL SECURITY DEFINER VIEW `view2` AS select `view1`.`f1` AS `f1` from `view1`
# But the view view2 is usable
SELECT * FROM view2;
f1
CREATE VIEW view3 AS
SELECT * FROM view2;
SELECT * from view3;
f1
DROP VIEW mysqltest_db1.view3;
DROP VIEW mysqltest_db1.view2;
DROP VIEW mysqltest_db1.view1;
DROP TABLE mysqltest_db1.t1;
DROP SCHEMA mysqltest_db1;
DROP USER mysqltest_db1@localhost;
......@@ -1686,5 +1686,27 @@ select * from t1 where b like 'ab' or b like 'ab';
select * from t1 where b like 'abc';
select * from t1 where b like 'abc' or b like 'abc';
# bug#20406 (maybe same as bug#17421 -1, not seen on 32-bit x86)
drop table t1;
create table t1 ( fname varchar(255), lname varchar(255) )
engine=ndbcluster;
insert into t1 values ("Young","Foo");
set engine_condition_pushdown = 0;
SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
set engine_condition_pushdown = 1;
SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
# make sure optimizer does not do some crazy shortcut
insert into t1 values ("aaa", "aaa");
insert into t1 values ("bbb", "bbb");
insert into t1 values ("ccc", "ccc");
insert into t1 values ("ddd", "ddd");
set engine_condition_pushdown = 0;
SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
set engine_condition_pushdown = 1;
SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
set engine_condition_pushdown = @old_ecpd;
DROP TABLE t1,t2,t3,t4,t5;
......@@ -1095,3 +1095,12 @@ insert into t1 values(
insert into t1 values(1e100);
select * from t1;
drop table t1;
#
# Bug#19667 group by a decimal expression yields wrong result
#
create table t1 (i int, j int);
insert into t1 values (1,1), (1,2), (2,3), (2,4);
select i, count(distinct j) from t1 group by i;
select i+0.0 as i2, count(distinct j) from t1 group by i2;
drop table t1;
......@@ -813,3 +813,42 @@ SELECT * FROM v;
DROP VIEW v;
DROP TABLE t1;
USE test;
#
# Bug#20363: Create view on just created view is now denied
#
eval CREATE USER mysqltest_db1@localhost identified by 'PWD';
eval GRANT ALL ON mysqltest_db1.* TO mysqltest_db1@localhost WITH GRANT OPTION;
# The session with the non root user is needed.
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (session1,localhost,mysqltest_db1,PWD,test);
CREATE SCHEMA mysqltest_db1 ;
USE mysqltest_db1 ;
CREATE TABLE t1 (f1 INTEGER);
CREATE VIEW view1 AS
SELECT * FROM t1;
SHOW CREATE VIEW view1;
CREATE VIEW view2 AS
SELECT * FROM view1;
--echo # Here comes a suspicious warning
SHOW CREATE VIEW view2;
--echo # But the view view2 is usable
SELECT * FROM view2;
CREATE VIEW view3 AS
SELECT * FROM view2;
SELECT * from view3;
connection default;
DROP VIEW mysqltest_db1.view3;
DROP VIEW mysqltest_db1.view2;
DROP VIEW mysqltest_db1.view1;
DROP TABLE mysqltest_db1.t1;
DROP SCHEMA mysqltest_db1;
DROP USER mysqltest_db1@localhost;
......@@ -408,6 +408,19 @@
}
#
# BUG#19940: NDB sends uninitialized parts of field buffers across the wire.
# This is "works as designed"; the uninitialized part is not used at the
# other end (but Valgrind cannot see this).
#
{
bug19940
Memcheck:Param
socketcall.sendto(msg)
fun:send
fun:_ZN15TCP_Transporter6doSendEv
fun:_ZN19TransporterRegistry11performSendEv
fun:_ZN19TransporterRegistry14forceSendCheckEi
}
# Warning when printing stack trace (to suppress some not needed warnings)
#
......
......@@ -132,7 +132,7 @@ bool Cached_item_decimal::cmp()
{
my_decimal tmp;
my_decimal *ptmp= item->val_decimal(&tmp);
if (null_value != item->null_value || my_decimal_cmp(&value, ptmp) == 0)
if (null_value != item->null_value || my_decimal_cmp(&value, ptmp))
{
null_value= item->null_value;
my_decimal2decimal(ptmp, &value);
......
......@@ -5201,7 +5201,14 @@ bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *all_tables)
if (all_tables->security_ctx)
thd->security_ctx= all_tables->security_ctx;
if (check_access(thd, privilege, all_tables->db,
const char *db_name;
if ((all_tables->view || all_tables->field_translation) &&
!all_tables->schema_table)
db_name= all_tables->view_db.str;
else
db_name= all_tables->db;
if (check_access(thd, privilege, db_name,
&all_tables->grant.privilege, 0, 0,
test(all_tables->schema_table)))
goto deny;
......
......@@ -5009,6 +5009,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
old_db_type= table->s->db_type;
if (!create_info->db_type)
{
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (table->part_info &&
create_info->used_fields & HA_CREATE_USED_ENGINE)
{
......@@ -5022,6 +5023,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
create_info->db_type= table->part_info->default_engine_type;
}
else
#endif
create_info->db_type= old_db_type;
}
......
......@@ -699,6 +699,28 @@ extern "C" {
int ndb_mgm_stop2(NdbMgmHandle handle, int no_of_nodes,
const int * node_list, int abort);
/**
* Stops cluster nodes
*
* @param handle Management handle.
* @param no_of_nodes Number of database nodes to stop<br>
* -1: All database and management nodes<br>
* 0: All database nodes in cluster<br>
* n: Stop the <var>n</var> node(s) specified in
* the array node_list
* @param node_list List of node IDs of database nodes to be stopped
* @param abort Don't perform graceful stop,
* but rather stop immediately
* @param disconnect Returns true if you need to disconnect to apply
* the stop command (e.g. stopping the mgm server
* that handle is connected to)
*
* @return Number of nodes stopped (-1 on error).
*/
int ndb_mgm_stop3(NdbMgmHandle handle, int no_of_nodes,
const int * node_list, int abort, int *disconnect);
/**
* Restart database nodes
*
......@@ -738,6 +760,31 @@ extern "C" {
const int * node_list, int initial,
int nostart, int abort);
/**
* Restart nodes
*
* @param handle Management handle.
* @param no_of_nodes Number of database nodes to be restarted:<br>
* 0: Restart all database nodes in the cluster<br>
* n: Restart the <var>n</var> node(s) specified in the
* array node_list
* @param node_list List of node IDs of database nodes to be restarted
* @param initial Remove filesystem from restarting node(s)
* @param nostart Don't actually start node(s) but leave them
* waiting for start command
* @param abort Don't perform graceful restart,
* but rather restart immediately
* @param disconnect Returns true if mgmapi client must disconnect from
* server to apply the requested operation. (e.g.
* restart the management server)
*
*
* @return Number of nodes stopped (-1 on error).
*/
int ndb_mgm_restart3(NdbMgmHandle handle, int no_of_nodes,
const int * node_list, int initial,
int nostart, int abort, int *disconnect);
/**
* Start database nodes
*
......@@ -1018,6 +1065,16 @@ extern "C" {
*/
Uint32 ndb_mgm_get_mgmd_nodeid(NdbMgmHandle handle);
/**
* Get the version of the mgm server we're talking to.
* Designed to allow switching of protocol depending on version
* so that new clients can speak to old servers in a compat mode
*/
int ndb_mgm_get_version(NdbMgmHandle handle,
int *major, int *minor, int* build,
int len, char* str);
/**
* Config iterator
*/
......
This diff is collapsed.
......@@ -60,9 +60,6 @@
#include <SignalSender.hpp>
extern bool g_StopServer;
extern bool g_RestartServer;
//#define MGM_SRV_DEBUG
#ifdef MGM_SRV_DEBUG
#define DEBUG(x) do ndbout << x << endl; while(0)
......@@ -937,6 +934,13 @@ int MgmtSrvr::sendStopMgmd(NodeId nodeId,
* client connection to that mgmd and stop it that way.
* This allows us to stop mgm servers when there isn't any real
* distributed communication up.
*
* node_ids.size()==0 means to stop all DB nodes.
* MGM nodes will *NOT* be stopped.
*
* If we work out we should be stopping or restarting ourselves,
* we return <0 in stopSelf for restart, >0 for stop
* and 0 for do nothing.
*/
int MgmtSrvr::sendSTOP_REQ(const Vector<NodeId> &node_ids,
......@@ -946,7 +950,8 @@ int MgmtSrvr::sendSTOP_REQ(const Vector<NodeId> &node_ids,
bool stop,
bool restart,
bool nostart,
bool initialStart)
bool initialStart,
int* stopSelf)
{
int error = 0;
DBUG_ENTER("MgmtSrvr::sendSTOP_REQ");
......@@ -995,12 +1000,13 @@ int MgmtSrvr::sendSTOP_REQ(const Vector<NodeId> &node_ids,
NodeId nodeId= 0;
int use_master_node= 0;
int do_send= 0;
int do_stop_self= 0;
*stopSelf= 0;
NdbNodeBitmask nodes_to_stop;
{
for (unsigned i= 0; i < node_ids.size(); i++)
{
nodeId= node_ids[i];
ndbout << "asked to stop " << nodeId << endl;
if (getNodeType(nodeId) != NDB_MGM_NODE_TYPE_MGM)
nodes_to_stop.set(nodeId);
else if (nodeId != getOwnNodeId())
......@@ -1011,7 +1017,11 @@ int MgmtSrvr::sendSTOP_REQ(const Vector<NodeId> &node_ids,
stoppedNodes.set(nodeId);
}
else
do_stop_self= 1;;
{
ndbout << "which is me" << endl;
*stopSelf= (restart)? -1 : 1;
stoppedNodes.set(nodeId);
}
}
}
int no_of_nodes_to_stop= nodes_to_stop.count();
......@@ -1044,14 +1054,6 @@ int MgmtSrvr::sendSTOP_REQ(const Vector<NodeId> &node_ids,
nodes.set(nodeId);
}
}
nodeId= 0;
while(getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_MGM))
{
if(nodeId==getOwnNodeId())
continue;
if(sendStopMgmd(nodeId, abort, stop, restart, nostart, initialStart)==0)
stoppedNodes.set(nodeId);
}
}
// now wait for the replies
......@@ -1143,11 +1145,9 @@ int MgmtSrvr::sendSTOP_REQ(const Vector<NodeId> &node_ids,
DBUG_RETURN(SEND_OR_RECEIVE_FAILED);
}
}
if (!error && do_stop_self)
if (error && *stopSelf)
{
if (restart)
g_RestartServer= true;
g_StopServer= true;
*stopSelf= 0;
}
DBUG_RETURN(error);
}
......@@ -1157,7 +1157,7 @@ int MgmtSrvr::sendSTOP_REQ(const Vector<NodeId> &node_ids,
*/
int MgmtSrvr::stopNodes(const Vector<NodeId> &node_ids,
int *stopCount, bool abort)
int *stopCount, bool abort, int* stopSelf)
{
if (!abort)
{
......@@ -1179,20 +1179,46 @@ int MgmtSrvr::stopNodes(const Vector<NodeId> &node_ids,
false,
false,
false,
false);
false,
stopSelf);
if (stopCount)
*stopCount= nodes.count();
return ret;
}
int MgmtSrvr::shutdownMGM(int *stopCount, bool abort, int *stopSelf)
{
NodeId nodeId = 0;
int error;
while(getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_MGM))
{
if(nodeId==getOwnNodeId())
continue;
error= sendStopMgmd(nodeId, abort, true, false,
false, false);
if (error == 0)
*stopCount++;
}
*stopSelf= 1;
*stopCount++;
return 0;
}
/*
* Perform system shutdown
* Perform DB nodes shutdown.
* MGM servers are left in their current state
*/
int MgmtSrvr::stop(int * stopCount, bool abort)
int MgmtSrvr::shutdownDB(int * stopCount, bool abort)
{
NodeBitmask nodes;
Vector<NodeId> node_ids;
int tmp;
int ret = sendSTOP_REQ(node_ids,
nodes,
0,
......@@ -1200,7 +1226,8 @@ int MgmtSrvr::stop(int * stopCount, bool abort)
true,
false,
false,
false);
false,
&tmp);
if (stopCount)
*stopCount = nodes.count();
return ret;
......@@ -1225,6 +1252,7 @@ int MgmtSrvr::enterSingleUser(int * stopCount, Uint32 singleUserNodeId)
}
NodeBitmask nodes;
Vector<NodeId> node_ids;
int stopSelf;
int ret = sendSTOP_REQ(node_ids,
nodes,
singleUserNodeId,
......@@ -1232,7 +1260,8 @@ int MgmtSrvr::enterSingleUser(int * stopCount, Uint32 singleUserNodeId)
false,
false,
false,
false);
false,
&stopSelf);
if (stopCount)
*stopCount = nodes.count();
return ret;
......@@ -1244,7 +1273,8 @@ int MgmtSrvr::enterSingleUser(int * stopCount, Uint32 singleUserNodeId)
int MgmtSrvr::restartNodes(const Vector<NodeId> &node_ids,
int * stopCount, bool nostart,
bool initialStart, bool abort)
bool initialStart, bool abort,
int *stopSelf)
{
NodeBitmask nodes;
int ret= sendSTOP_REQ(node_ids,
......@@ -1254,7 +1284,8 @@ int MgmtSrvr::restartNodes(const Vector<NodeId> &node_ids,
false,
true,
true,
initialStart);
initialStart,
stopSelf);
if (ret)
return ret;
......@@ -1297,14 +1328,16 @@ int MgmtSrvr::restartNodes(const Vector<NodeId> &node_ids,
}
/*
* Perform system restart
* Perform restart of all DB nodes
*/
int MgmtSrvr::restart(bool nostart, bool initialStart,
bool abort, int * stopCount )
int MgmtSrvr::restartDB(bool nostart, bool initialStart,
bool abort, int * stopCount)
{
NodeBitmask nodes;
Vector<NodeId> node_ids;
int tmp;
int ret = sendSTOP_REQ(node_ids,
nodes,
0,
......@@ -1312,7 +1345,8 @@ int MgmtSrvr::restart(bool nostart, bool initialStart,
true,
true,
true,
initialStart);
initialStart,
&tmp);
if (ret)
return ret;
......
......@@ -255,12 +255,15 @@ public:
* @param processId: Id of the DB process to stop
* @return 0 if succeeded, otherwise: as stated above, plus:
*/
int stopNodes(const Vector<NodeId> &node_ids, int *stopCount, bool abort);
int stopNodes(const Vector<NodeId> &node_ids, int *stopCount, bool abort,
int *stopSelf);
int shutdownMGM(int *stopCount, bool abort, int *stopSelf);
/**
* Stop the system
* shutdown the DB nodes
*/
int stop(int * cnt = 0, bool abort = false);
int shutdownDB(int * cnt = 0, bool abort = false);
/**
* print version info about a node
......@@ -294,14 +297,14 @@ public:
*/
int restartNodes(const Vector<NodeId> &node_ids,
int *stopCount, bool nostart,
bool initialStart, bool abort);
bool initialStart, bool abort, int *stopSelf);
/**
* Restart the system
* Restart all DB nodes
*/
int restart(bool nostart, bool initialStart,
bool abort = false,
int * stopCount = 0);
int restartDB(bool nostart, bool initialStart,
bool abort = false,
int * stopCount = 0);
struct BackupEvent {
enum Event {
......@@ -500,7 +503,8 @@ private:
bool stop,
bool restart,
bool nostart,
bool initialStart);
bool initialStart,
int *stopSelf);
/**
* Check if it is possible to send a signal to a (DB) process
......
......@@ -35,6 +35,7 @@
#include <base64.h>
extern bool g_StopServer;
extern bool g_RestartServer;
extern EventLogger g_eventLogger;
static const unsigned int MAX_READ_TIMEOUT = 1000 ;
......@@ -144,7 +145,13 @@ ParserRow<MgmApiSession> commands[] = {
MGM_CMD("get info clusterlog", &MgmApiSession::getInfoClusterLog, ""),
MGM_CMD("restart node", &MgmApiSession::restart, ""),
MGM_CMD("restart node", &MgmApiSession::restart_v1, ""),
MGM_ARG("node", String, Mandatory, "Nodes to restart"),
MGM_ARG("initialstart", Int, Optional, "Initial start"),
MGM_ARG("nostart", Int, Optional, "No start"),
MGM_ARG("abort", Int, Optional, "Abort"),
MGM_CMD("restart node v2", &MgmApiSession::restart_v2, ""),
MGM_ARG("node", String, Mandatory, "Nodes to restart"),
MGM_ARG("initialstart", Int, Optional, "Initial start"),
MGM_ARG("nostart", Int, Optional, "No start"),
......@@ -185,13 +192,18 @@ ParserRow<MgmApiSession> commands[] = {
MGM_CMD("abort backup", &MgmApiSession::abortBackup, ""),
MGM_ARG("id", Int, Mandatory, "Backup id"),
MGM_CMD("stop", &MgmApiSession::stop, ""),
MGM_CMD("stop", &MgmApiSession::stop_v1, ""),
MGM_ARG("node", String, Mandatory, "Node"),
MGM_ARG("abort", Int, Mandatory, "Node"),
MGM_CMD("stop v2", &MgmApiSession::stop_v2, ""),
MGM_ARG("node", String, Mandatory, "Node"),
MGM_ARG("abort", Int, Mandatory, "Node"),
MGM_CMD("stop all", &MgmApiSession::stopAll, ""),
MGM_ARG("abort", Int, Mandatory, "Node"),
MGM_ARG("stop", String, Optional, "MGM/DB or both"),
MGM_CMD("enter single user", &MgmApiSession::enterSingleUser, ""),
MGM_ARG("nodeId", Int, Mandatory, "Node"),
......@@ -276,6 +288,7 @@ MgmApiSession::MgmApiSession(class MgmtSrvr & mgm, NDB_SOCKET_TYPE sock)
m_output = new SocketOutputStream(sock);
m_parser = new Parser_t(commands, *m_input, true, true, true);
m_allocated_resources= new MgmtSrvr::Allocated_resources(m_mgmsrv);
m_stopSelf= 0;
DBUG_VOID_RETURN;
}
......@@ -295,6 +308,10 @@ MgmApiSession::~MgmApiSession()
NDB_CLOSE_SOCKET(m_socket);
m_socket= NDB_INVALID_SOCKET;
}
if(m_stopSelf < 0)
g_RestartServer= true;
if(m_stopSelf)
g_StopServer= true;
DBUG_VOID_RETURN;
}
......@@ -875,8 +892,19 @@ MgmApiSession::stopSignalLog(Parser<MgmApiSession>::Context &,
}
void
MgmApiSession::restart(Parser<MgmApiSession>::Context &,
MgmApiSession::restart_v1(Parser<MgmApiSession>::Context &,
Properties const &args) {
restart(args,1);
}
void
MgmApiSession::restart_v2(Parser<MgmApiSession>::Context &,
Properties const &args) {
restart(args,2);
}
void
MgmApiSession::restart(Properties const &args, int version) {
Uint32
nostart = 0,
initialstart = 0,
......@@ -901,7 +929,8 @@ MgmApiSession::restart(Parser<MgmApiSession>::Context &,
&restarted,
nostart != 0,
initialstart != 0,
abort != 0);
abort != 0,
&m_stopSelf);
m_output->println("restart reply");
if(result != 0){
......@@ -909,6 +938,8 @@ MgmApiSession::restart(Parser<MgmApiSession>::Context &,
} else
m_output->println("result: Ok");
m_output->println("restarted: %d", restarted);
if(version>1)
m_output->println("disconnect: %d", (m_stopSelf)?1:0);
m_output->println("");
}
......@@ -925,7 +956,7 @@ MgmApiSession::restartAll(Parser<MgmApiSession>::Context &,
args.get("nostart", &nostart);
int count = 0;
int result = m_mgmsrv.restart(nostart, initialstart, abort, &count);
int result = m_mgmsrv.restartDB(nostart, initialstart, abort, &count);
m_output->println("restart reply");
if(result != 0)
......@@ -1018,8 +1049,19 @@ MgmApiSession::getInfoClusterLog(Parser<MgmApiSession>::Context &,
}
void
MgmApiSession::stop(Parser<MgmApiSession>::Context &,
Properties const &args) {
MgmApiSession::stop_v1(Parser<MgmApiSession>::Context &,
Properties const &args) {
stop(args,1);
}
void
MgmApiSession::stop_v2(Parser<MgmApiSession>::Context &,
Properties const &args) {
stop(args,2);
}
void
MgmApiSession::stop(Properties const &args, int version) {
Uint32 abort;
char *nodes_str;
Vector<NodeId> nodes;
......@@ -1044,7 +1086,7 @@ MgmApiSession::stop(Parser<MgmApiSession>::Context &,
int stopped= 0;
int result= 0;
if (nodes.size())
result= m_mgmsrv.stopNodes(nodes, &stopped, abort != 0);
result= m_mgmsrv.stopNodes(nodes, &stopped, abort != 0, &m_stopSelf);
m_output->println("stop reply");
if(result != 0)
......@@ -1052,25 +1094,41 @@ MgmApiSession::stop(Parser<MgmApiSession>::Context &,
else
m_output->println("result: Ok");
m_output->println("stopped: %d", stopped);
if(version>1)
m_output->println("disconnect: %d", (m_stopSelf)?1:0);
m_output->println("");
}
void
MgmApiSession::stopAll(Parser<MgmApiSession>::Context &,
Properties const &args) {
int stopped = 0;
Properties const &args) {
int stopped[2] = {0,0};
Uint32 abort;
args.get("abort", &abort);
int result = m_mgmsrv.stop(&stopped, abort != 0);
BaseString stop;
const char* tostop= "db";
int ver=1;
if (args.get("stop", stop))
{
tostop= stop.c_str();
ver= 2;
}
int result= 0;
if(strstr(tostop,"db"))
result= m_mgmsrv.shutdownDB(&stopped[0], abort != 0);
if(!result && strstr(tostop,"mgm"))
result= m_mgmsrv.shutdownMGM(&stopped[1], abort!=0, &m_stopSelf);
m_output->println("stop reply");
if(result != 0)
m_output->println("result: %s", get_error_text(result));
else
m_output->println("result: Ok");
m_output->println("stopped: %d", stopped);
m_output->println("stopped: %d", stopped[0]+stopped[1]);
if(ver >1)
m_output->println("disconnect: %d", (m_stopSelf)?1:0);
m_output->println("");
}
......
......@@ -41,6 +41,7 @@ private:
Parser_t *m_parser;
MgmtSrvr::Allocated_resources *m_allocated_resources;
char m_err_str[1024];
int m_stopSelf; // -1 is restart, 0 do nothing, 1 stop
void getConfig_common(Parser_t::Context &ctx,
const class Properties &args,
......@@ -62,7 +63,9 @@ public:
void getVersion(Parser_t::Context &ctx, const class Properties &args);
void getStatus(Parser_t::Context &ctx, const class Properties &args);
void getInfoClusterLog(Parser_t::Context &ctx, const class Properties &args);
void restart(Parser_t::Context &ctx, const class Properties &args);
void restart(const class Properties &args, int version);
void restart_v1(Parser_t::Context &ctx, const class Properties &args);
void restart_v2(Parser_t::Context &ctx, const class Properties &args);
void restartAll(Parser_t::Context &ctx, const class Properties &args);
void insertError(Parser_t::Context &ctx, const class Properties &args);
void setTrace(Parser_t::Context &ctx, const class Properties &args);
......@@ -74,7 +77,9 @@ public:
void abortBackup(Parser_t::Context &ctx, const class Properties &args);
void enterSingleUser(Parser_t::Context &ctx, const class Properties &args);
void exitSingleUser(Parser_t::Context &ctx, const class Properties &args);
void stop(Parser_t::Context &ctx, const class Properties &args);
void stop_v1(Parser_t::Context &ctx, const class Properties &args);
void stop_v2(Parser_t::Context &ctx, const class Properties &args);
void stop(const class Properties &args, int version);
void stopAll(Parser_t::Context &ctx, const class Properties &args);
void start(Parser_t::Context &ctx, const class Properties &args);
void startAll(Parser_t::Context &ctx, const class Properties &args);
......
@echo off
del cmakecache.txt
if exist cmakecache.txt del cmakecache.txt
copy win\vs71cache.txt cmakecache.txt
cmake -G "Visual Studio 7 .NET 2003"
copy cmakecache.txt win\vs71cache.txt
......
@echo off
del cmakecache.txt
if exist cmakecache.txt del cmakecache.txt
copy win\vs8cache.txt cmakecache.txt
cmake -G "Visual Studio 8 2005"
copy cmakecache.txt win\vs8cache.txt
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment