enh: rotate wal of mnode properly
This commit is contained in:
parent
106e9f3281
commit
caaff5c546
|
@ -344,8 +344,8 @@ static int32_t mndInitWal(SMnode *pMnode) {
|
|||
.fsyncPeriod = 0,
|
||||
.rollPeriod = -1,
|
||||
.segSize = -1,
|
||||
.retentionPeriod = -1,
|
||||
.retentionSize = -1,
|
||||
.retentionPeriod = 0,
|
||||
.retentionSize = 0,
|
||||
.level = TAOS_WAL_FSYNC,
|
||||
};
|
||||
|
||||
|
@ -370,7 +370,6 @@ static int32_t mndInitSdb(SMnode *pMnode) {
|
|||
opt.path = pMnode->path;
|
||||
opt.pMnode = pMnode;
|
||||
opt.pWal = pMnode->pWal;
|
||||
opt.sync = pMnode->syncMgmt.sync;
|
||||
|
||||
pMnode->pSdb = sdbInit(&opt);
|
||||
if (pMnode->pSdb == NULL) {
|
||||
|
@ -552,16 +551,7 @@ void mndPreClose(SMnode *pMnode) {
|
|||
if (pMnode != NULL) {
|
||||
syncLeaderTransfer(pMnode->syncMgmt.sync);
|
||||
syncPreStop(pMnode->syncMgmt.sync);
|
||||
#if 0
|
||||
while (syncSnapshotRecving(pMnode->syncMgmt.sync)) {
|
||||
mInfo("vgId:1, snapshot is recving");
|
||||
taosMsleep(300);
|
||||
}
|
||||
while (syncSnapshotSending(pMnode->syncMgmt.sync)) {
|
||||
mInfo("vgId:1, snapshot is sending");
|
||||
taosMsleep(300);
|
||||
}
|
||||
#endif
|
||||
sdbWriteFile(pMnode->pSdb, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -118,12 +118,12 @@ int32_t mndProcessWriteMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta
|
|||
transId, pTrans->createdTime, pMgmt->transId);
|
||||
mndTransExecute(pMnode, pTrans, false);
|
||||
mndReleaseTrans(pMnode, pTrans);
|
||||
// sdbWriteFile(pMnode->pSdb, SDB_WRITE_DELTA);
|
||||
} else {
|
||||
mError("trans:%d, not found while execute in mnode since %s", transId, terrstr());
|
||||
}
|
||||
}
|
||||
|
||||
sdbWriteFile(pMnode->pSdb, SDB_WRITE_DELTA);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -319,6 +319,7 @@ int32_t mndInitSync(SMnode *pMnode) {
|
|||
mError("failed to open sync since %s", terrstr());
|
||||
return -1;
|
||||
}
|
||||
pMnode->pSdb->sync = pMgmt->sync;
|
||||
|
||||
mInfo("mnode-sync is opened, id:%" PRId64, pMgmt->sync);
|
||||
return 0;
|
||||
|
|
|
@ -1645,8 +1645,6 @@ void mndTransPullup(SMnode *pMnode) {
|
|||
}
|
||||
mndReleaseTrans(pMnode, pTrans);
|
||||
}
|
||||
|
||||
sdbWriteFile(pMnode->pSdb, SDB_WRITE_DELTA);
|
||||
taosArrayDestroy(pArray);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ extern "C" {
|
|||
#define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", DEBUG_TRACE, mDebugFlag, __VA_ARGS__); }}
|
||||
// clang-format on
|
||||
|
||||
#define SDB_WRITE_DELTA 20
|
||||
#define SDB_WRITE_DELTA 2000
|
||||
|
||||
#define SDB_GET_VAL(pData, dataPos, val, pos, func, type) \
|
||||
{ \
|
||||
|
|
|
@ -53,7 +53,6 @@ SSdb *sdbInit(SSdbOpt *pOption) {
|
|||
}
|
||||
|
||||
pSdb->pWal = pOption->pWal;
|
||||
pSdb->sync = pOption->sync;
|
||||
pSdb->applyIndex = -1;
|
||||
pSdb->applyTerm = -1;
|
||||
pSdb->applyConfig = -1;
|
||||
|
|
|
@ -472,10 +472,7 @@ int32_t sdbWriteFile(SSdb *pSdb, int32_t delta) {
|
|||
|
||||
taosThreadMutexLock(&pSdb->filelock);
|
||||
if (pSdb->pWal != NULL) {
|
||||
// code = walBeginSnapshot(pSdb->pWal, pSdb->applyIndex, 0);
|
||||
if (pSdb->sync == 0) {
|
||||
code = 0;
|
||||
} else {
|
||||
if (pSdb->sync > 0) {
|
||||
code = syncBeginSnapshot(pSdb->sync, pSdb->applyIndex);
|
||||
}
|
||||
}
|
||||
|
@ -484,11 +481,7 @@ int32_t sdbWriteFile(SSdb *pSdb, int32_t delta) {
|
|||
}
|
||||
if (code == 0) {
|
||||
if (pSdb->pWal != NULL) {
|
||||
// code = walEndSnapshot(pSdb->pWal);
|
||||
|
||||
if (pSdb->sync == 0) {
|
||||
code = 0;
|
||||
} else {
|
||||
if (pSdb->sync > 0) {
|
||||
code = syncEndSnapshot(pSdb->sync);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue