提交 7316fb89 编写于 作者: L lichuang

[TD-1920]add mnode compact wal functions

上级 4e32f1cc
...@@ -142,6 +142,7 @@ extern int32_t tsMonitorInterval; ...@@ -142,6 +142,7 @@ extern int32_t tsMonitorInterval;
extern int8_t tsEnableStream; extern int8_t tsEnableStream;
// internal // internal
extern int8_t tsCompactMnodeWal;
extern int8_t tsPrintAuth; extern int8_t tsPrintAuth;
extern int8_t tscEmbedded; extern int8_t tscEmbedded;
extern char configDir[]; extern char configDir[];
......
...@@ -176,6 +176,7 @@ int32_t tsMonitorInterval = 30; // seconds ...@@ -176,6 +176,7 @@ int32_t tsMonitorInterval = 30; // seconds
int8_t tsEnableStream = 1; int8_t tsEnableStream = 1;
// internal // internal
int8_t tsCompactMnodeWal = 0;
int8_t tsPrintAuth = 0; int8_t tsPrintAuth = 0;
int8_t tscEmbedded = 0; int8_t tscEmbedded = 0;
char configDir[TSDB_FILENAME_LEN] = {0}; char configDir[TSDB_FILENAME_LEN] = {0};
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "dnodeShell.h" #include "dnodeShell.h"
#include "dnodeTelemetry.h" #include "dnodeTelemetry.h"
#include "module.h" #include "module.h"
#include "mnode.h"
#if !defined(_MODULE) || !defined(_TD_LINUX) #if !defined(_MODULE) || !defined(_TD_LINUX)
int32_t moduleStart() { return 0; } int32_t moduleStart() { return 0; }
......
...@@ -42,6 +42,8 @@ int32_t main(int32_t argc, char *argv[]) { ...@@ -42,6 +42,8 @@ int32_t main(int32_t argc, char *argv[]) {
} }
} else if (strcmp(argv[i], "-C") == 0) { } else if (strcmp(argv[i], "-C") == 0) {
dump_config = 1; dump_config = 1;
} else if (strcmp(argv[i], "--compact-mnode-wal") == 0) {
tsCompactMnodeWal = 1;
} else if (strcmp(argv[i], "-V") == 0) { } else if (strcmp(argv[i], "-V") == 0) {
#ifdef _ACCT #ifdef _ACCT
char *versionStr = "enterprise"; char *versionStr = "enterprise";
......
...@@ -73,6 +73,8 @@ int32_t mnodeProcessPeerReq(SMnodeMsg *pMsg); ...@@ -73,6 +73,8 @@ int32_t mnodeProcessPeerReq(SMnodeMsg *pMsg);
void mnodeProcessPeerRsp(SRpcMsg *pMsg); void mnodeProcessPeerRsp(SRpcMsg *pMsg);
int32_t mnodeRetriveAuth(char *user, char *spi, char *encrypt, char *secret, char *ckey); int32_t mnodeRetriveAuth(char *user, char *spi, char *encrypt, char *secret, char *ckey);
int32_t mnodeCompactWal();
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -106,6 +106,7 @@ int32_t sdbGetId(void *pTable); ...@@ -106,6 +106,7 @@ int32_t sdbGetId(void *pTable);
uint64_t sdbGetVersion(); uint64_t sdbGetVersion();
bool sdbCheckRowDeleted(void *pTable, void *pRow); bool sdbCheckRowDeleted(void *pTable, void *pRow);
int32_t mnodeCompactWal();
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -57,6 +57,12 @@ static SStep tsMnodeSteps[] = { ...@@ -57,6 +57,12 @@ static SStep tsMnodeSteps[] = {
{"show", mnodeInitShow, mnodeCleanUpShow} {"show", mnodeInitShow, mnodeCleanUpShow}
}; };
/*
static SStep tsMnodeCompactSteps[] = {
{"cluster", mnodeInitCluster, NULL},
};
*/
static void mnodeInitTimer(); static void mnodeInitTimer();
static void mnodeCleanupTimer(); static void mnodeCleanupTimer();
static bool mnodeNeedStart() ; static bool mnodeNeedStart() ;
......
...@@ -450,6 +450,12 @@ int32_t sdbInit() { ...@@ -450,6 +450,12 @@ int32_t sdbInit() {
} }
tsSdbMgmt.status = SDB_STATUS_SERVING; tsSdbMgmt.status = SDB_STATUS_SERVING;
if (tsCompactMnodeWal) {
mnodeCompactWal();
exit(EXIT_SUCCESS);
}
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -1138,3 +1144,9 @@ static void *sdbWorkerFp(void *pWorker) { ...@@ -1138,3 +1144,9 @@ static void *sdbWorkerFp(void *pWorker) {
int32_t sdbGetReplicaNum() { int32_t sdbGetReplicaNum() {
return tsSdbMgmt.cfg.replica; return tsSdbMgmt.cfg.replica;
} }
int32_t mnodeCompactWal() {
sdbInfo("vgId:1, start compact mnode wal...");
return 0;
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册