diff --git a/src/dnode/src/dnodeMain.c b/src/dnode/src/dnodeMain.c index cce382b15f5c7e1396ecce543fbd1355bfdf5ac5..64da11f3123b5eafd1de2ae9253fe5fc3090ad80 100644 --- a/src/dnode/src/dnodeMain.c +++ b/src/dnode/src/dnodeMain.c @@ -86,6 +86,17 @@ static SStep tsDnodeSteps[] = { {"dnode-telemetry", dnodeInitTelemetry, dnodeCleanupTelemetry}, }; +static SStep tsDnodeCompactSteps[] = { + {"dnode-tfile", tfInit, tfCleanup}, + {"dnode-storage", dnodeInitStorage, dnodeCleanupStorage}, + {"dnode-eps", dnodeInitEps, dnodeCleanupEps}, + {"dnode-wal", walInit, walCleanUp}, + {"dnode-mread", dnodeInitMRead, NULL}, + {"dnode-mwrite", dnodeInitMWrite, NULL}, + {"dnode-mpeer", dnodeInitMPeer, NULL}, + {"dnode-modules", dnodeInitModules, dnodeCleanupModules}, +}; + static int dnodeCreateDir(const char *dir) { if (mkdir(dir, 0755) != 0 && errno != EEXIST) { return -1; @@ -95,13 +106,23 @@ static int dnodeCreateDir(const char *dir) { } static void dnodeCleanupComponents() { - int32_t stepSize = sizeof(tsDnodeSteps) / sizeof(SStep); - dnodeStepCleanup(tsDnodeSteps, stepSize); + if (!tsCompactMnodeWal) { + int32_t stepSize = sizeof(tsDnodeSteps) / sizeof(SStep); + dnodeStepCleanup(tsDnodeSteps, stepSize); + } else { + int32_t stepSize = sizeof(tsDnodeCompactSteps) / sizeof(SStep); + dnodeStepCleanup(tsDnodeCompactSteps, stepSize); + } } static int32_t dnodeInitComponents() { - int32_t stepSize = sizeof(tsDnodeSteps) / sizeof(SStep); - return dnodeStepInit(tsDnodeSteps, stepSize); + if (!tsCompactMnodeWal) { + int32_t stepSize = sizeof(tsDnodeSteps) / sizeof(SStep); + return dnodeStepInit(tsDnodeSteps, stepSize); + } else { + int32_t stepSize = sizeof(tsDnodeCompactSteps) / sizeof(SStep); + return dnodeStepInit(tsDnodeCompactSteps, stepSize); + } } static int32_t dnodeInitTmr() { diff --git a/src/mnode/src/mnodeMain.c b/src/mnode/src/mnodeMain.c index d3511a4e62b56ab70050f51ad606a7297a2be6a1..8ce798c8ec2271ecb236d49278f07f974e4bb043 100644 --- a/src/mnode/src/mnodeMain.c +++ b/src/mnode/src/mnodeMain.c @@ -121,7 +121,7 @@ int32_t mnodeStartSystem() { int32_t mnodeInitSystem() { mnodeInitTimer(); - if (mnodeNeedStart()) { + if (mnodeNeedStart() || tsCompactMnodeWal) { return mnodeStartSystem(); } return 0; diff --git a/src/mnode/src/mnodeSdb.c b/src/mnode/src/mnodeSdb.c index 84e4f33ca7efe2cafca9ec64d8b7872cac827403..ac3e5d86ecfd57b3b06f49b39bcb991ff06423d5 100644 --- a/src/mnode/src/mnodeSdb.c +++ b/src/mnode/src/mnodeSdb.c @@ -690,7 +690,7 @@ static int32_t sdbProcessWrite(void *wparam, void *hparam, int32_t qtype, void * pthread_mutex_unlock(&tsSdbMgmt.mutex); // from app, row is created - if (pRow != NULL) { + if (pRow != NULL && tsCompactMnodeWal != 1) { // forward to peers pRow->processedCount = 0; int32_t syncCode = syncForwardToPeer(tsSdbMgmt.sync, pHead, pRow, TAOS_QTYPE_RPC, false); @@ -713,7 +713,9 @@ static int32_t sdbProcessWrite(void *wparam, void *hparam, int32_t qtype, void * actStr[action], sdbGetKeyStr(pTable, pHead->cont), pHead->version); // even it is WAL/FWD, it shall be called to update version in sync - syncForwardToPeer(tsSdbMgmt.sync, pHead, pRow, TAOS_QTYPE_RPC, false); + if (tsCompactMnodeWal != 1) { + syncForwardToPeer(tsSdbMgmt.sync, pHead, pRow, TAOS_QTYPE_RPC, false); + } // from wal or forward msg, row not created, should add into hash if (action == SDB_ACTION_INSERT) { diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c index db822c2b43b37c87cd5db5bd4f0a2d4caea9b03c..5710601e5c057282637bd6c67ac5d7b1e41d7341 100644 --- a/src/mnode/src/mnodeTable.c +++ b/src/mnode/src/mnodeTable.c @@ -3375,7 +3375,7 @@ static int32_t mnodeCompactSuperTables() { .rowSize = sizeof(SSTableObj) + schemaSize, }; - mInfo("compact super %" PRIu64, pTable->uid); + //mInfo("compact super %" PRIu64, pTable->uid); sdbInsertCompactRow(&row); } @@ -3401,7 +3401,7 @@ static int32_t mnodeCompactChildTables() { .pTable = tsChildTableSdb, }; - mInfo("compact child %" PRIu64 ":%d", pTable->uid, pTable->tid); + //mInfo("compact child %" PRIu64 ":%d", pTable->uid, pTable->tid); sdbInsertCompactRow(&row); } diff --git a/src/wal/src/walWrite.c b/src/wal/src/walWrite.c index f865870d478882df64bd2308b87f448c4602c847..b884546a08674fef7c2c42f104c5200e0d5efff8 100644 --- a/src/wal/src/walWrite.c +++ b/src/wal/src/walWrite.c @@ -430,6 +430,8 @@ static int32_t walRestoreWalFile(SWal *pWal, void *pVnode, FWalWrite writeFp, ch pWal->vgId, fileId, pHead->version, pWal->version, pHead->len, offset); pWal->version = pHead->version; + + //wInfo("writeFp: %ld", offset); (*writeFp)(pVnode, pHead, TAOS_QTYPE_WAL, NULL); }