[TD-1920]add mnode compact wal functions

This commit is contained in:
lichuang 2021-05-20 11:06:28 +08:00
parent 4e32f1cc72
commit 7316fb8979
8 changed files with 26 additions and 0 deletions

View File

@ -142,6 +142,7 @@ extern int32_t tsMonitorInterval;
extern int8_t tsEnableStream;
// internal
extern int8_t tsCompactMnodeWal;
extern int8_t tsPrintAuth;
extern int8_t tscEmbedded;
extern char configDir[];

View File

@ -176,6 +176,7 @@ int32_t tsMonitorInterval = 30; // seconds
int8_t tsEnableStream = 1;
// internal
int8_t tsCompactMnodeWal = 0;
int8_t tsPrintAuth = 0;
int8_t tscEmbedded = 0;
char configDir[TSDB_FILENAME_LEN] = {0};

View File

@ -40,6 +40,7 @@
#include "dnodeShell.h"
#include "dnodeTelemetry.h"
#include "module.h"
#include "mnode.h"
#if !defined(_MODULE) || !defined(_TD_LINUX)
int32_t moduleStart() { return 0; }

View File

@ -42,6 +42,8 @@ int32_t main(int32_t argc, char *argv[]) {
}
} else if (strcmp(argv[i], "-C") == 0) {
dump_config = 1;
} else if (strcmp(argv[i], "--compact-mnode-wal") == 0) {
tsCompactMnodeWal = 1;
} else if (strcmp(argv[i], "-V") == 0) {
#ifdef _ACCT
char *versionStr = "enterprise";

View File

@ -73,6 +73,8 @@ int32_t mnodeProcessPeerReq(SMnodeMsg *pMsg);
void mnodeProcessPeerRsp(SRpcMsg *pMsg);
int32_t mnodeRetriveAuth(char *user, char *spi, char *encrypt, char *secret, char *ckey);
int32_t mnodeCompactWal();
#ifdef __cplusplus
}
#endif

View File

@ -106,6 +106,7 @@ int32_t sdbGetId(void *pTable);
uint64_t sdbGetVersion();
bool sdbCheckRowDeleted(void *pTable, void *pRow);
int32_t mnodeCompactWal();
#ifdef __cplusplus
}
#endif

View File

@ -57,6 +57,12 @@ static SStep tsMnodeSteps[] = {
{"show", mnodeInitShow, mnodeCleanUpShow}
};
/*
static SStep tsMnodeCompactSteps[] = {
{"cluster", mnodeInitCluster, NULL},
};
*/
static void mnodeInitTimer();
static void mnodeCleanupTimer();
static bool mnodeNeedStart() ;

View File

@ -450,6 +450,12 @@ int32_t sdbInit() {
}
tsSdbMgmt.status = SDB_STATUS_SERVING;
if (tsCompactMnodeWal) {
mnodeCompactWal();
exit(EXIT_SUCCESS);
}
return TSDB_CODE_SUCCESS;
}
@ -1138,3 +1144,9 @@ static void *sdbWorkerFp(void *pWorker) {
int32_t sdbGetReplicaNum() {
return tsSdbMgmt.cfg.replica;
}
int32_t mnodeCompactWal() {
sdbInfo("vgId:1, start compact mnode wal...");
return 0;
}