Merge pull request #14016 from taosdata/fix/mnode
refactor: save sdb file on needed
This commit is contained in:
commit
74ba55aec9
|
@ -185,7 +185,7 @@ char tsCompressor[32] = "ZSTD_COMPRESSOR"; // ZSTD_COMPRESSOR or GZIP_COMPR
|
||||||
bool tsStartUdfd = true;
|
bool tsStartUdfd = true;
|
||||||
|
|
||||||
// internal
|
// internal
|
||||||
int32_t tsTransPullupInterval = 6;
|
int32_t tsTransPullupInterval = 2;
|
||||||
int32_t tsMqRebalanceInterval = 2;
|
int32_t tsMqRebalanceInterval = 2;
|
||||||
|
|
||||||
void taosAddDataDir(int32_t index, char *v1, int32_t level, int32_t primary) {
|
void taosAddDataDir(int32_t index, char *v1, int32_t level, int32_t primary) {
|
||||||
|
|
|
@ -68,8 +68,9 @@ void mndSyncCommitMsg(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbM
|
||||||
mndTransExecute(pMnode, pTrans);
|
mndTransExecute(pMnode, pTrans);
|
||||||
mndReleaseTrans(pMnode, pTrans);
|
mndReleaseTrans(pMnode, pTrans);
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
sdbWriteFile(pMnode->pSdb, SDB_WRITE_DELTA);
|
sdbWriteFile(pMnode->pSdb, SDB_WRITE_DELTA);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -804,7 +804,7 @@ static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans) {
|
||||||
sendRsp = true;
|
sendRsp = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (pTrans->stage == TRN_STAGE_REDO_ACTION && pTrans->failedTimes > 2) {
|
if (pTrans->stage == TRN_STAGE_REDO_ACTION && pTrans->failedTimes > 3) {
|
||||||
if (code == 0) code = TSDB_CODE_MND_TRANS_UNKNOW_ERROR;
|
if (code == 0) code = TSDB_CODE_MND_TRANS_UNKNOW_ERROR;
|
||||||
sendRsp = true;
|
sendRsp = true;
|
||||||
}
|
}
|
||||||
|
@ -1127,6 +1127,7 @@ static int32_t mndTransExecuteRedoActionsSerial(SMnode *pMnode, STrans *pTrans)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
|
pTrans->failedTimes = 0;
|
||||||
pTrans->lastAction = action;
|
pTrans->lastAction = action;
|
||||||
pTrans->lastMsgType = 0;
|
pTrans->lastMsgType = 0;
|
||||||
pTrans->lastErrorNo = 0;
|
pTrans->lastErrorNo = 0;
|
||||||
|
@ -1430,8 +1431,7 @@ void mndTransPullup(SMnode *pMnode) {
|
||||||
mndReleaseTrans(pMnode, pTrans);
|
mndReleaseTrans(pMnode, pTrans);
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo, set to SDB_WRITE_DELTA
|
sdbWriteFile(pMnode->pSdb, SDB_WRITE_DELTA);
|
||||||
sdbWriteFile(pMnode->pSdb, 0);
|
|
||||||
taosArrayDestroy(pArray);
|
taosArrayDestroy(pArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ extern "C" {
|
||||||
#define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", DEBUG_TRACE, mDebugFlag, __VA_ARGS__); }}
|
#define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", DEBUG_TRACE, mDebugFlag, __VA_ARGS__); }}
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
#define SDB_WRITE_DELTA 100
|
#define SDB_WRITE_DELTA 20
|
||||||
|
|
||||||
#define SDB_GET_VAL(pData, dataPos, val, pos, func, type) \
|
#define SDB_GET_VAL(pData, dataPos, val, pos, func, type) \
|
||||||
{ \
|
{ \
|
||||||
|
|
|
@ -161,9 +161,11 @@ static int32_t sdbCreateDir(SSdb *pSdb) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void sdbSetApplyInfo(SSdb *pSdb, int64_t index, int64_t term, int64_t config) {
|
void sdbSetApplyInfo(SSdb *pSdb, int64_t index, int64_t term, int64_t config) {
|
||||||
mTrace("mnode apply info changed, from index:%" PRId64 " term:%" PRId64 " config:%" PRId64 ", to index:%" PRId64
|
#if 1
|
||||||
|
mTrace("mnode apply info changed from index:%" PRId64 " term:%" PRId64 " config:%" PRId64 " to index:%" PRId64
|
||||||
" term:%" PRId64 " config:%" PRId64,
|
" term:%" PRId64 " config:%" PRId64,
|
||||||
pSdb->applyIndex, pSdb->applyTerm, pSdb->applyConfig, index, term, config);
|
pSdb->applyIndex, pSdb->applyTerm, pSdb->applyConfig, index, term, config);
|
||||||
|
#endif
|
||||||
pSdb->applyIndex = index;
|
pSdb->applyIndex = index;
|
||||||
pSdb->applyTerm = term;
|
pSdb->applyTerm = term;
|
||||||
pSdb->applyConfig = config;
|
pSdb->applyConfig = config;
|
||||||
|
@ -173,7 +175,9 @@ void sdbGetCommitInfo(SSdb *pSdb, int64_t *index, int64_t *term, int64_t *config
|
||||||
*index = pSdb->commitIndex;
|
*index = pSdb->commitIndex;
|
||||||
*term = pSdb->commitTerm;
|
*term = pSdb->commitTerm;
|
||||||
*config = pSdb->commitConfig;
|
*config = pSdb->commitConfig;
|
||||||
|
#if 0
|
||||||
mTrace("mnode current info, apply index:%" PRId64 " term:%" PRId64 " config:%" PRId64 ", commit index:%" PRId64
|
mTrace("mnode current info, apply index:%" PRId64 " term:%" PRId64 " config:%" PRId64 ", commit index:%" PRId64
|
||||||
" term:%" PRId64 " config:%" PRId64,
|
" term:%" PRId64 " config:%" PRId64,
|
||||||
pSdb->applyIndex, pSdb->applyTerm, pSdb->applyConfig, *index, *term, *config);
|
pSdb->applyIndex, pSdb->applyTerm, pSdb->applyConfig, *index, *term, *config);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,31 +53,10 @@ endi
|
||||||
if $data(4)[4] != ready then
|
if $data(4)[4] != ready then
|
||||||
goto step1
|
goto step1
|
||||||
endi
|
endi
|
||||||
#if $data(5)[4] != ready then
|
|
||||||
# goto step1
|
|
||||||
#endi
|
|
||||||
|
|
||||||
print =============== step2: create db
|
print =============== step2: create db
|
||||||
sql create database d1 vgroups 1 replica 3
|
sql create database d1 vgroups 1 replica 3
|
||||||
|
|
||||||
# dnode not exist
|
|
||||||
sql_error redistribute vgroup 3 dnode 6 dnode 3 dnode 4
|
|
||||||
# vgroup not exist
|
|
||||||
sql_error redistribute vgroup 3 dnode 5 dnode 3 dnode 4
|
|
||||||
# un changed
|
|
||||||
sql_error redistribute vgroup 2 dnode 2 dnode 3 dnode 4
|
|
||||||
# no enought vnodes
|
|
||||||
sql_error redistribute vgroup 2 dnode 1 dnode 3 dnode 4
|
|
||||||
# offline vnodes
|
|
||||||
sql_error redistribute vgroup 2 dnode 5 dnode 3 dnode 4
|
|
||||||
# Invalid replica
|
|
||||||
sql_error redistribute vgroup 2 dnode 5
|
|
||||||
sql_error redistribute vgroup 2 dnode 5 dnode 3
|
|
||||||
sql_error redistribute vgroup 2 dnode 2 dnode 3
|
|
||||||
sql_error redistribute vgroup 2 dnode 2 dnode 2
|
|
||||||
sql_error redistribute vgroup 3 dnode 2 dnode 2
|
|
||||||
sql_error redistribute vgroup 2 dnode 2 dnode 2 dnode 3
|
|
||||||
|
|
||||||
system sh/exec.sh -n dnode5 -s start
|
system sh/exec.sh -n dnode5 -s start
|
||||||
$x = 0
|
$x = 0
|
||||||
step2:
|
step2:
|
||||||
|
|
Loading…
Reference in New Issue