Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
47bb45ef
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
47bb45ef
编写于
5月 21, 2021
作者:
S
Shengliang Guan
提交者:
GitHub
5月 21, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #6179 from taosdata/feature/TD-1920
Feature/td 1920
上级
870c05ad
e38362c0
变更
24
隐藏空白更改
内联
并排
Showing
24 changed file
with
357 addition
and
0 deletion
+357
-0
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+3
-0
src/common/src/tglobal.c
src/common/src/tglobal.c
+3
-0
src/dnode/src/dnodeMain.c
src/dnode/src/dnodeMain.c
+12
-0
src/dnode/src/dnodeSystem.c
src/dnode/src/dnodeSystem.c
+2
-0
src/inc/mnode.h
src/inc/mnode.h
+3
-0
src/mnode/inc/mnodeAcct.h
src/mnode/inc/mnodeAcct.h
+2
-0
src/mnode/inc/mnodeCluster.h
src/mnode/inc/mnodeCluster.h
+2
-0
src/mnode/inc/mnodeDb.h
src/mnode/inc/mnodeDb.h
+2
-0
src/mnode/inc/mnodeDnode.h
src/mnode/inc/mnodeDnode.h
+1
-0
src/mnode/inc/mnodeMnode.h
src/mnode/inc/mnodeMnode.h
+1
-0
src/mnode/inc/mnodeSdb.h
src/mnode/inc/mnodeSdb.h
+2
-0
src/mnode/inc/mnodeTable.h
src/mnode/inc/mnodeTable.h
+1
-0
src/mnode/inc/mnodeUser.h
src/mnode/inc/mnodeUser.h
+2
-0
src/mnode/inc/mnodeVgroup.h
src/mnode/inc/mnodeVgroup.h
+1
-0
src/mnode/src/mnodeAcct.c
src/mnode/src/mnodeAcct.c
+26
-0
src/mnode/src/mnodeCluster.c
src/mnode/src/mnodeCluster.c
+24
-0
src/mnode/src/mnodeDb.c
src/mnode/src/mnodeDb.c
+27
-0
src/mnode/src/mnodeDnode.c
src/mnode/src/mnodeDnode.c
+27
-0
src/mnode/src/mnodeMain.c
src/mnode/src/mnodeMain.c
+17
-0
src/mnode/src/mnodeMnode.c
src/mnode/src/mnodeMnode.c
+27
-0
src/mnode/src/mnodeSdb.c
src/mnode/src/mnodeSdb.c
+56
-0
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+62
-0
src/mnode/src/mnodeUser.c
src/mnode/src/mnodeUser.c
+27
-0
src/mnode/src/mnodeVgroup.c
src/mnode/src/mnodeVgroup.c
+27
-0
未找到文件。
src/common/inc/tglobal.h
浏览文件 @
47bb45ef
...
...
@@ -142,12 +142,15 @@ extern int32_t tsMonitorInterval;
extern
int8_t
tsEnableStream
;
// internal
extern
int8_t
tsCompactMnodeWal
;
extern
int8_t
tsPrintAuth
;
extern
int8_t
tscEmbedded
;
extern
char
configDir
[];
extern
char
tsVnodeDir
[];
extern
char
tsDnodeDir
[];
extern
char
tsMnodeDir
[];
extern
char
tsMnodeBakDir
[];
extern
char
tsMnodeTmpDir
[];
extern
char
tsDataDir
[];
extern
char
tsLogDir
[];
extern
char
tsScriptDir
[];
...
...
src/common/src/tglobal.c
浏览文件 @
47bb45ef
...
...
@@ -176,12 +176,15 @@ 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
};
char
tsVnodeDir
[
TSDB_FILENAME_LEN
]
=
{
0
};
char
tsDnodeDir
[
TSDB_FILENAME_LEN
]
=
{
0
};
char
tsMnodeDir
[
TSDB_FILENAME_LEN
]
=
{
0
};
char
tsMnodeTmpDir
[
TSDB_FILENAME_LEN
]
=
{
0
};
char
tsMnodeBakDir
[
TSDB_FILENAME_LEN
]
=
{
0
};
char
tsDataDir
[
TSDB_FILENAME_LEN
]
=
{
0
};
char
tsScriptDir
[
TSDB_FILENAME_LEN
]
=
{
0
};
char
tsTempDir
[
TSDB_FILENAME_LEN
]
=
"/tmp/"
;
...
...
src/dnode/src/dnodeMain.c
浏览文件 @
47bb45ef
...
...
@@ -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
;
}
...
...
@@ -216,6 +217,17 @@ static int32_t dnodeInitStorage() {
sprintf
(
tsDnodeDir
,
"%s/dnode"
,
tsDataDir
);
// sprintf(tsVnodeBakDir, "%s/vnode_bak", tsDataDir);
if
(
tsCompactMnodeWal
==
1
)
{
sprintf
(
tsMnodeTmpDir
,
"%s/mnode_tmp"
,
tsDataDir
);
tfsRmdir
(
tsMnodeTmpDir
);
if
(
dnodeCreateDir
(
tsMnodeTmpDir
)
<
0
)
{
dError
(
"failed to create dir: %s, reason: %s"
,
tsMnodeTmpDir
,
strerror
(
errno
));
return
-
1
;
}
sprintf
(
tsMnodeBakDir
,
"%s/mnode_bak"
,
tsDataDir
);
//tfsRmdir(tsMnodeBakDir);
}
//TODO(dengyihao): no need to init here
if
(
dnodeCreateDir
(
tsMnodeDir
)
<
0
)
{
dError
(
"failed to create dir: %s, reason: %s"
,
tsMnodeDir
,
strerror
(
errno
));
...
...
src/dnode/src/dnodeSystem.c
浏览文件 @
47bb45ef
...
...
@@ -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"
;
...
...
src/inc/mnode.h
浏览文件 @
47bb45ef
...
...
@@ -73,6 +73,9 @@ 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
();
int32_t
mnodeCompactComponents
();
#ifdef __cplusplus
}
#endif
...
...
src/mnode/inc/mnodeAcct.h
浏览文件 @
47bb45ef
...
...
@@ -35,6 +35,8 @@ void mnodeDropDbFromAcct(SAcctObj *pAcct, SDbObj *pDb);
void
mnodeAddUserToAcct
(
SAcctObj
*
pAcct
,
SUserObj
*
pUser
);
void
mnodeDropUserFromAcct
(
SAcctObj
*
pAcct
,
SUserObj
*
pUser
);
int32_t
mnodeCompactAccts
();
#ifdef __cplusplus
}
#endif
...
...
src/mnode/inc/mnodeCluster.h
浏览文件 @
47bb45ef
...
...
@@ -25,6 +25,8 @@ void mnodeCleanupCluster();
void
mnodeUpdateClusterId
();
const
char
*
mnodeGetClusterId
();
int32_t
mnodeCompactCluster
();
#ifdef __cplusplus
}
#endif
...
...
src/mnode/inc/mnodeDb.h
浏览文件 @
47bb45ef
...
...
@@ -41,6 +41,8 @@ void mnodeDecDbRef(SDbObj *pDb);
bool
mnodeCheckIsMonitorDB
(
char
*
db
,
char
*
monitordb
);
void
mnodeDropAllDbs
(
SAcctObj
*
pAcct
);
int32_t
mnodeCompactDbs
();
// util func
void
mnodeAddSuperTableIntoDb
(
SDbObj
*
pDb
);
void
mnodeRemoveSuperTableFromDb
(
SDbObj
*
pDb
);
...
...
src/mnode/inc/mnodeDnode.h
浏览文件 @
47bb45ef
...
...
@@ -77,6 +77,7 @@ void * mnodeGetDnodeByEp(char *ep);
void
mnodeUpdateDnode
(
SDnodeObj
*
pDnode
);
int32_t
mnodeDropDnode
(
SDnodeObj
*
pDnode
,
void
*
pMsg
);
int32_t
mnodeCompactDnodes
();
extern
int32_t
tsAccessSquence
;
#ifdef __cplusplus
...
...
src/mnode/inc/mnodeMnode.h
浏览文件 @
47bb45ef
...
...
@@ -50,6 +50,7 @@ char* mnodeGetMnodeMasterEp();
void
mnodeGetMnodeInfos
(
void
*
mnodes
);
void
mnodeUpdateMnodeEpSet
(
SMInfos
*
pMnodes
);
int32_t
mnodeCompactMnodes
();
#ifdef __cplusplus
}
#endif
...
...
src/mnode/inc/mnodeSdb.h
浏览文件 @
47bb45ef
...
...
@@ -92,6 +92,7 @@ void sdbUpdateMnodeRoles();
int32_t
sdbGetReplicaNum
();
int32_t
sdbInsertRow
(
SSdbRow
*
pRow
);
int32_t
sdbInsertCompactRow
(
SSdbRow
*
pRow
);
int32_t
sdbDeleteRow
(
SSdbRow
*
pRow
);
int32_t
sdbUpdateRow
(
SSdbRow
*
pRow
);
int32_t
sdbInsertRowToQueue
(
SSdbRow
*
pRow
);
...
...
@@ -106,6 +107,7 @@ int32_t sdbGetId(void *pTable);
uint64_t
sdbGetVersion
();
bool
sdbCheckRowDeleted
(
void
*
pTable
,
void
*
pRow
);
int32_t
mnodeCompactWal
();
#ifdef __cplusplus
}
#endif
...
...
src/mnode/inc/mnodeTable.h
浏览文件 @
47bb45ef
...
...
@@ -36,6 +36,7 @@ void mnodeCancelGetNextSuperTable(void *pIter);
void
mnodeDropAllChildTables
(
SDbObj
*
pDropDb
);
void
mnodeDropAllSuperTables
(
SDbObj
*
pDropDb
);
void
mnodeDropAllChildTablesInVgroups
(
SVgObj
*
pVgroup
);
int32_t
mnodeCompactTables
();
#ifdef __cplusplus
}
...
...
src/mnode/inc/mnodeUser.h
浏览文件 @
47bb45ef
...
...
@@ -33,6 +33,8 @@ char * mnodeGetUserFromMsg(void *pMnodeMsg);
int32_t
mnodeCreateUser
(
SAcctObj
*
pAcct
,
char
*
name
,
char
*
pass
,
void
*
pMsg
);
void
mnodeDropAllUsers
(
SAcctObj
*
pAcct
);
int32_t
mnodeCompactUsers
();
#ifdef __cplusplus
}
#endif
...
...
src/mnode/inc/mnodeVgroup.h
浏览文件 @
47bb45ef
...
...
@@ -32,6 +32,7 @@ void mnodeDropAllDbVgroups(SDbObj *pDropDb);
void
mnodeSendDropAllDbVgroupsMsg
(
SDbObj
*
pDropDb
);
void
mnodeDropAllDnodeVgroups
(
SDnodeObj
*
pDropDnode
);
//void mnodeUpdateAllDbVgroups(SDbObj *pAlterDb);
int32_t
mnodeCompactVgroups
();
void
*
mnodeGetNextVgroup
(
void
*
pIter
,
SVgObj
**
pVgroup
);
void
mnodeCancelGetNextVgroup
(
void
*
pIter
);
...
...
src/mnode/src/mnodeAcct.c
浏览文件 @
47bb45ef
...
...
@@ -238,6 +238,32 @@ static int32_t mnodeCreateRootAcct() {
return
sdbInsertRow
(
&
row
);
}
int32_t
mnodeCompactAccts
()
{
void
*
pIter
=
NULL
;
SAcctObj
*
pAcct
=
NULL
;
mInfo
(
"start to compact accts table..."
);
while
(
1
)
{
pIter
=
mnodeGetNextAcct
(
pIter
,
&
pAcct
);
if
(
pAcct
==
NULL
)
break
;
SSdbRow
row
=
{
.
type
=
SDB_OPER_GLOBAL
,
.
pTable
=
tsAcctSdb
,
.
pObj
=
pAcct
,
};
mInfo
(
"compact accts %s"
,
pAcct
->
user
);
sdbInsertCompactRow
(
&
row
);
}
mInfo
(
"end to compact accts table..."
);
return
0
;
}
#ifndef _ACCT
int32_t
acctInit
()
{
return
TSDB_CODE_SUCCESS
;
}
...
...
src/mnode/src/mnodeCluster.c
浏览文件 @
47bb45ef
...
...
@@ -237,3 +237,27 @@ static int32_t mnodeRetrieveClusters(SShowObj *pShow, char *data, int32_t rows,
pShow
->
numOfReads
+=
numOfRows
;
return
numOfRows
;
}
int32_t
mnodeCompactCluster
()
{
SClusterObj
*
pCluster
=
NULL
;
void
*
pIter
;
mInfo
(
"start to compact cluster table..."
);
pIter
=
mnodeGetNextCluster
(
NULL
,
&
pCluster
);
while
(
pCluster
)
{
SSdbRow
row
=
{
.
type
=
SDB_OPER_GLOBAL
,
.
pTable
=
tsClusterSdb
,
.
pObj
=
pCluster
,
};
sdbInsertCompactRow
(
&
row
);
pIter
=
mnodeGetNextCluster
(
pIter
,
&
pCluster
);
}
mInfo
(
"end to compact cluster table..."
);
return
0
;
}
\ No newline at end of file
src/mnode/src/mnodeDb.c
浏览文件 @
47bb45ef
...
...
@@ -1271,3 +1271,30 @@ void mnodeDropAllDbs(SAcctObj *pAcct) {
mInfo
(
"acct:%s, all dbs:%d is dropped from sdb"
,
pAcct
->
user
,
numOfDbs
);
}
int32_t
mnodeCompactDbs
()
{
void
*
pIter
=
NULL
;
SDbObj
*
pDb
=
NULL
;
mInfo
(
"start to compact dbs table..."
);
while
(
1
)
{
pIter
=
mnodeGetNextDb
(
pIter
,
&
pDb
);
if
(
pDb
==
NULL
)
break
;
SSdbRow
row
=
{
.
type
=
SDB_OPER_GLOBAL
,
.
pTable
=
tsDbSdb
,
.
pObj
=
pDb
,
.
rowSize
=
sizeof
(
SDbObj
),
};
mInfo
(
"compact dbs %s"
,
pDb
->
name
);
sdbInsertCompactRow
(
&
row
);
}
mInfo
(
"end to compact dbs table..."
);
return
0
;
}
\ No newline at end of file
src/mnode/src/mnodeDnode.c
浏览文件 @
47bb45ef
...
...
@@ -1270,3 +1270,30 @@ char* dnodeRoles[] = {
"vnode"
,
"any"
};
int32_t
mnodeCompactDnodes
()
{
SDnodeObj
*
pDnode
=
NULL
;
void
*
pIter
=
NULL
;
mInfo
(
"start to compact dnodes table..."
);
while
(
1
)
{
pIter
=
mnodeGetNextDnode
(
pIter
,
&
pDnode
);
if
(
pDnode
==
NULL
)
break
;
SSdbRow
row
=
{
.
type
=
SDB_OPER_GLOBAL
,
.
pTable
=
tsDnodeSdb
,
.
pObj
=
pDnode
,
.
rowSize
=
sizeof
(
SDnodeObj
),
};
mInfo
(
"compact dnode %d"
,
pDnode
->
dnodeId
);
sdbInsertCompactRow
(
&
row
);
}
mInfo
(
"end to compact dnodes table..."
);
return
0
;
}
\ No newline at end of file
src/mnode/src/mnodeMain.c
浏览文件 @
47bb45ef
...
...
@@ -57,6 +57,18 @@ static SStep tsMnodeSteps[] = {
{
"show"
,
mnodeInitShow
,
mnodeCleanUpShow
}
};
static
SStep
tsMnodeCompactSteps
[]
=
{
{
"cluster"
,
mnodeCompactCluster
,
NULL
},
{
"dnodes"
,
mnodeCompactDnodes
,
NULL
},
{
"mnodes"
,
mnodeCompactMnodes
,
NULL
},
{
"accts"
,
mnodeCompactAccts
,
NULL
},
{
"users"
,
mnodeCompactUsers
,
NULL
},
{
"dbs"
,
mnodeCompactDbs
,
NULL
},
{
"vgroups"
,
mnodeCompactVgroups
,
NULL
},
{
"tables"
,
mnodeCompactTables
,
NULL
},
};
static
void
mnodeInitTimer
();
static
void
mnodeCleanupTimer
();
static
bool
mnodeNeedStart
()
;
...
...
@@ -71,6 +83,11 @@ static int32_t mnodeInitComponents() {
return
dnodeStepInit
(
tsMnodeSteps
,
stepSize
);
}
int32_t
mnodeCompactComponents
()
{
int32_t
stepSize
=
sizeof
(
tsMnodeCompactSteps
)
/
sizeof
(
SStep
);
return
dnodeStepInit
(
tsMnodeCompactSteps
,
stepSize
);
}
int32_t
mnodeStartSystem
()
{
if
(
tsMgmtIsRunning
)
{
mInfo
(
"mnode module already started..."
);
...
...
src/mnode/src/mnodeMnode.c
浏览文件 @
47bb45ef
...
...
@@ -566,3 +566,30 @@ static int32_t mnodeRetrieveMnodes(SShowObj *pShow, char *data, int32_t rows, vo
return
numOfRows
;
}
int32_t
mnodeCompactMnodes
()
{
void
*
pIter
=
NULL
;
SMnodeObj
*
pMnode
=
NULL
;
mInfo
(
"start to compact mnodes table..."
);
while
(
1
)
{
pIter
=
mnodeGetNextMnode
(
pIter
,
&
pMnode
);
if
(
pMnode
==
NULL
)
break
;
SSdbRow
row
=
{
.
type
=
SDB_OPER_GLOBAL
,
.
pTable
=
tsMnodeSdb
,
.
pObj
=
pMnode
,
.
rowSize
=
sizeof
(
SMnodeObj
),
};
mInfo
(
"compact mnode %d"
,
pMnode
->
mnodeId
);
sdbInsertCompactRow
(
&
row
);
}
mInfo
(
"end to compact mnodes table..."
);
return
0
;
}
\ No newline at end of file
src/mnode/src/mnodeSdb.c
浏览文件 @
47bb45ef
...
...
@@ -20,6 +20,7 @@
#include "tutil.h"
#include "tref.h"
#include "tbn.h"
#include "tfs.h"
#include "tqueue.h"
#include "twal.h"
#include "tsync.h"
...
...
@@ -450,6 +451,12 @@ int32_t sdbInit() {
}
tsSdbMgmt
.
status
=
SDB_STATUS_SERVING
;
if
(
tsCompactMnodeWal
)
{
mnodeCompactWal
();
exit
(
EXIT_SUCCESS
);
}
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -726,6 +733,12 @@ static int32_t sdbProcessWrite(void *wparam, void *hparam, int32_t qtype, void *
}
}
int32_t
sdbInsertCompactRow
(
SSdbRow
*
pRow
)
{
SSdbTable
*
pTable
=
pRow
->
pTable
;
if
(
pTable
==
NULL
)
return
TSDB_CODE_MND_SDB_INVALID_TABLE_TYPE
;
return
sdbWriteRowToQueue
(
pRow
,
SDB_ACTION_INSERT
);
}
int32_t
sdbInsertRow
(
SSdbRow
*
pRow
)
{
SSdbTable
*
pTable
=
pRow
->
pTable
;
if
(
pTable
==
NULL
)
return
TSDB_CODE_MND_SDB_INVALID_TABLE_TYPE
;
...
...
@@ -1138,3 +1151,46 @@ static void *sdbWorkerFp(void *pWorker) {
int32_t
sdbGetReplicaNum
()
{
return
tsSdbMgmt
.
cfg
.
replica
;
}
int32_t
mnodeCompactWal
()
{
sdbInfo
(
"vgId:1, start compact mnode wal..."
);
// close old wal
walFsync
(
tsSdbMgmt
.
wal
,
true
);
walClose
(
tsSdbMgmt
.
wal
);
// reset version,then compacted wal log can start from version 1
tsSdbMgmt
.
version
=
0
;
// change wal to wal_tmp dir
SWalCfg
walCfg
=
{.
vgId
=
1
,
.
walLevel
=
TAOS_WAL_FSYNC
,
.
keep
=
TAOS_WAL_KEEP
,
.
fsyncPeriod
=
0
};
char
temp
[
TSDB_FILENAME_LEN
]
=
{
0
};
sprintf
(
temp
,
"%s/wal"
,
tsMnodeTmpDir
);
tsSdbMgmt
.
wal
=
walOpen
(
temp
,
&
walCfg
);
walRenew
(
tsSdbMgmt
.
wal
);
// compact memory tables info to wal tmp dir
if
(
mnodeCompactComponents
()
!=
0
)
{
tfsRmdir
(
tsMnodeTmpDir
);
return
-
1
;
}
// close wal
walFsync
(
tsSdbMgmt
.
wal
,
true
);
walClose
(
tsSdbMgmt
.
wal
);
// rename old wal to wal_bak
if
(
taosRename
(
tsMnodeDir
,
tsMnodeBakDir
)
!=
0
)
{
return
-
1
;
}
// rename wal_tmp to wal
if
(
taosRename
(
tsMnodeTmpDir
,
tsMnodeDir
)
!=
0
)
{
return
-
1
;
}
// del wal_tmp dir
sdbInfo
(
"vgId:1, compact mnode wal success"
);
return
0
;
}
\ No newline at end of file
src/mnode/src/mnodeTable.c
浏览文件 @
47bb45ef
...
...
@@ -3242,3 +3242,65 @@ static int32_t mnodeRetrieveStreamTables(SShowObj *pShow, char *data, int32_t ro
return
numOfRows
;
}
static
int32_t
mnodeCompactSuperTables
()
{
void
*
pIter
=
NULL
;
SSTableObj
*
pTable
=
NULL
;
mInfo
(
"start to compact super table..."
);
while
(
1
)
{
pIter
=
mnodeGetNextSuperTable
(
pIter
,
&
pTable
);
if
(
pTable
==
NULL
)
break
;
int32_t
schemaSize
=
(
pTable
->
numOfColumns
+
pTable
->
numOfTags
)
*
sizeof
(
SSchema
);
SSdbRow
row
=
{
.
type
=
SDB_OPER_GLOBAL
,
.
pTable
=
tsSuperTableSdb
,
.
pObj
=
pTable
,
.
rowSize
=
sizeof
(
SSTableObj
)
+
schemaSize
,
};
mInfo
(
"compact super %"
PRIu64
,
pTable
->
uid
);
sdbInsertCompactRow
(
&
row
);
}
mInfo
(
"end to compact super table..."
);
return
0
;
}
static
int32_t
mnodeCompactChildTables
()
{
void
*
pIter
=
NULL
;
SCTableObj
*
pTable
=
NULL
;
mInfo
(
"start to compact child table..."
);
while
(
1
)
{
pIter
=
mnodeGetNextChildTable
(
pIter
,
&
pTable
);
if
(
pTable
==
NULL
)
break
;
SSdbRow
row
=
{
.
type
=
SDB_OPER_GLOBAL
,
.
pObj
=
pTable
,
.
pTable
=
tsChildTableSdb
,
};
mInfo
(
"compact child %"
PRIu64
":%d"
,
pTable
->
uid
,
pTable
->
tid
);
sdbInsertCompactRow
(
&
row
);
}
mInfo
(
"end to compact child table..."
);
return
0
;
}
int32_t
mnodeCompactTables
()
{
mnodeCompactSuperTables
();
mnodeCompactChildTables
();
return
0
;
}
\ No newline at end of file
src/mnode/src/mnodeUser.c
浏览文件 @
47bb45ef
...
...
@@ -617,3 +617,30 @@ static int32_t mnodeProcessAuthMsg(SMnodeMsg *pMsg) {
return
mnodeRetriveAuth
(
pAuthMsg
->
user
,
&
pAuthRsp
->
spi
,
&
pAuthRsp
->
encrypt
,
pAuthRsp
->
secret
,
pAuthRsp
->
ckey
);
}
int32_t
mnodeCompactUsers
()
{
void
*
pIter
=
NULL
;
SUserObj
*
pUser
=
NULL
;
mInfo
(
"start to compact users table..."
);
while
(
1
)
{
pIter
=
mnodeGetNextUser
(
pIter
,
&
pUser
);
if
(
pUser
==
NULL
)
break
;
SSdbRow
row
=
{
.
type
=
SDB_OPER_GLOBAL
,
.
pTable
=
tsUserSdb
,
.
pObj
=
pUser
,
.
rowSize
=
sizeof
(
SUserObj
),
};
mInfo
(
"compact users %s"
,
pUser
->
user
);
sdbInsertCompactRow
(
&
row
);
}
mInfo
(
"end to compact users table..."
);
return
0
;
}
\ No newline at end of file
src/mnode/src/mnodeVgroup.c
浏览文件 @
47bb45ef
...
...
@@ -1302,3 +1302,30 @@ void mnodeSetVgidVer(int8_t *cver, uint64_t iver) {
cver
[
1
]
=
(
int8_t
)((
int32_t
)(
iver
%
100000
)
/
100
);
cver
[
2
]
=
(
int8_t
)(
iver
%
100
);
}
int32_t
mnodeCompactVgroups
()
{
void
*
pIter
=
NULL
;
SVgObj
*
pVgroup
=
NULL
;
mInfo
(
"start to compact vgroups table..."
);
while
(
1
)
{
pIter
=
mnodeGetNextVgroup
(
pIter
,
&
pVgroup
);
if
(
pVgroup
==
NULL
)
break
;
SSdbRow
row
=
{
.
type
=
SDB_OPER_GLOBAL
,
.
pTable
=
tsVgroupSdb
,
.
pObj
=
pVgroup
,
.
rowSize
=
sizeof
(
SVgObj
),
};
mInfo
(
"compact vgroups %d"
,
pVgroup
->
vgId
);
sdbInsertCompactRow
(
&
row
);
}
mInfo
(
"end to compact vgroups table..."
);
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录