minor changes
This commit is contained in:
parent
a326b29021
commit
f4bb5d06c8
|
@ -463,7 +463,7 @@ static int32_t mndProcessCreateDbReq(SMnodeMsg *pReq) {
|
|||
pCreate->commitTime = htonl(pCreate->commitTime);
|
||||
pCreate->fsyncPeriod = htonl(pCreate->fsyncPeriod);
|
||||
|
||||
mDebug("db:%s, start to create", pCreate->db);
|
||||
mDebug("db:%s, start to create, vgroups:%d", pCreate->db, pCreate->numOfVgroups);
|
||||
|
||||
SDbObj *pDb = mndAcquireDb(pMnode, pCreate->db);
|
||||
if (pDb != NULL) {
|
||||
|
@ -476,6 +476,9 @@ static int32_t mndProcessCreateDbReq(SMnodeMsg *pReq) {
|
|||
mError("db:%s, failed to create since %s", pCreate->db, terrstr());
|
||||
return -1;
|
||||
}
|
||||
} else if (terrno != TSDB_CODE_MND_DB_NOT_EXIST) {
|
||||
mError("db:%s, failed to create since %s", pCreate->db, terrstr());
|
||||
return -1;
|
||||
}
|
||||
|
||||
SUserObj *pOperUser = mndAcquireUser(pMnode, pReq->user);
|
||||
|
|
|
@ -809,7 +809,7 @@ static bool mndTransPerformUndoLogStage(SMnode *pMnode, STrans *pTrans) {
|
|||
mDebug("trans:%d, stage from undoLog to rollback", pTrans->id);
|
||||
continueExec = true;
|
||||
} else {
|
||||
mDebug("trans:%d, stage keep on undoLog since %s", pTrans->id, terrstr());
|
||||
mError("trans:%d, stage keep on undoLog since %s", pTrans->id, terrstr());
|
||||
continueExec = false;
|
||||
}
|
||||
|
||||
|
@ -825,7 +825,7 @@ static bool mndTransPerformUndoActionStage(SMnode *pMnode, STrans *pTrans) {
|
|||
mDebug("trans:%d, stage from undoAction to undoLog", pTrans->id);
|
||||
continueExec = true;
|
||||
} else if (code == TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||
mDebug("trans:%d, stage keep on undoAction since %s", pTrans->id, tstrerror(code));
|
||||
mError("trans:%d, stage keep on undoAction since %s", pTrans->id, tstrerror(code));
|
||||
continueExec = false;
|
||||
} else {
|
||||
pTrans->failedTimes++;
|
||||
|
|
|
@ -273,15 +273,10 @@ static bool mndBuildDnodesArrayFp(SMnode *pMnode, void *pObj, void *p1, void *p2
|
|||
SDnodeObj *pDnode = pObj;
|
||||
SArray *pArray = p1;
|
||||
|
||||
pDnode->numOfVnodes = mndGetVnodesNum(pMnode, pDnode->id);
|
||||
|
||||
int64_t curMs = taosGetTimestampMs();
|
||||
bool online = mndIsDnodeOnline(pMnode, pDnode, curMs);
|
||||
if (online && pDnode->numOfSupportVnodes > 0) {
|
||||
taosArrayPush(pArray, pDnode);
|
||||
}
|
||||
|
||||
bool isMnode = mndIsMnode(pMnode, pDnode->id);
|
||||
bool isMnode = mndIsMnode(pMnode, pDnode->id);
|
||||
pDnode->numOfVnodes = mndGetVnodesNum(pMnode, pDnode->id);
|
||||
|
||||
mDebug("dnode:%d, vnodes:%d supportVnodes:%d isMnode:%d online:%d", pDnode->id, pDnode->numOfVnodes,
|
||||
pDnode->numOfSupportVnodes, isMnode, online);
|
||||
|
@ -290,6 +285,9 @@ static bool mndBuildDnodesArrayFp(SMnode *pMnode, void *pObj, void *p1, void *p2
|
|||
pDnode->numOfVnodes++;
|
||||
}
|
||||
|
||||
if (online && pDnode->numOfSupportVnodes > 0) {
|
||||
taosArrayPush(pArray, pDnode);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -311,7 +309,7 @@ static SArray *mndBuildDnodesArray(SMnode *pMnode) {
|
|||
static int32_t mndCompareDnodeVnodes(SDnodeObj *pDnode1, SDnodeObj *pDnode2) {
|
||||
float d1Score = (float)pDnode1->numOfVnodes / pDnode1->numOfSupportVnodes;
|
||||
float d2Score = (float)pDnode2->numOfVnodes / pDnode2->numOfSupportVnodes;
|
||||
return d1Score > d2Score ? 1 : 0;
|
||||
return d1Score >= d2Score ? 1 : 0;
|
||||
}
|
||||
|
||||
static int32_t mndGetAvailableDnode(SMnode *pMnode, SVgObj *pVgroup, SArray *pArray) {
|
||||
|
|
|
@ -13,28 +13,17 @@
|
|||
|
||||
class MndTestDb : public ::testing::Test {
|
||||
protected:
|
||||
static void SetUpTestSuite() {
|
||||
test.Init("/tmp/mnode_test_db", 9030);
|
||||
const char* fqdn = "localhost";
|
||||
const char* firstEp = "localhost:9030";
|
||||
static void SetUpTestSuite() { test.Init("/tmp/mnode_test_db", 9030); }
|
||||
static void TearDownTestSuite() { test.Cleanup(); }
|
||||
|
||||
server2.Start("/tmp/mnode_test_db2", fqdn, 9031, firstEp);
|
||||
}
|
||||
static void TearDownTestSuite() {
|
||||
server2.Stop();
|
||||
test.Cleanup();
|
||||
}
|
||||
|
||||
static Testbase test;
|
||||
static TestServer server2;
|
||||
static Testbase test;
|
||||
|
||||
public:
|
||||
void SetUp() override {}
|
||||
void TearDown() override {}
|
||||
};
|
||||
|
||||
Testbase MndTestDb::test;
|
||||
TestServer MndTestDb::server2;
|
||||
Testbase MndTestDb::test;
|
||||
|
||||
TEST_F(MndTestDb, 01_ShowDb) {
|
||||
test.SendShowMetaReq(TSDB_MGMT_TABLE_DB, "");
|
||||
|
|
|
@ -2,15 +2,16 @@
|
|||
#======================b1-start===============
|
||||
|
||||
# ---- user
|
||||
./test.sh -f general/user/basic1.sim
|
||||
./test.sh -f sim/user/basic1.sim
|
||||
|
||||
# ---- db
|
||||
./test.sh -f general/db/basic1.sim
|
||||
./test.sh -f sim/db/basic1.sim
|
||||
./test.sh -f sim/db/error1.sim
|
||||
|
||||
# ---- table
|
||||
./test.sh -f general/table/basic1.sim
|
||||
./test.sh -f sim/table/basic1.sim
|
||||
|
||||
# ---- dnode
|
||||
./test.sh -f unique/dnode/basic1.sim
|
||||
./test.sh -f sim/dnode/basic1.sim
|
||||
|
||||
#======================b1-end===============
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
system sh/deploy.sh -n dnode2 -i 2
|
||||
system sh/exec.sh -n dnode2 -s start
|
||||
sql connect
|
||||
|
||||
print ========== create dnodes
|
||||
sql create dnode $hostname port 7200
|
||||
|
||||
$x = 0
|
||||
create1:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 10 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql show dnodes
|
||||
if $data4_2 != ready then
|
||||
goto create1
|
||||
endi
|
||||
|
||||
print ========== stop dnode2
|
||||
system sh/exec.sh -n dnode2 -s stop -x SIGKILL
|
||||
|
||||
print =============== create database
|
||||
sql_error create database d1 vgroups 4
|
||||
|
||||
print ========== start dnode2
|
||||
system sh/exec.sh -n dnode2 -s start
|
||||
|
||||
print =============== re-create database
|
||||
$x = 0
|
||||
re-create1:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 10 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql create database d1 vgroups 2 -x re-create1
|
||||
|
||||
sql show databases
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data00 != d1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data02 != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data03 != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
Loading…
Reference in New Issue