2021-09-22 08:15:20 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can use, redistribute, and/or modify
|
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3
|
|
|
|
|
* or later ("AGPL"), as published by the Free Software Foundation.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2021-11-27 15:02:20 +00:00
|
|
|
#ifndef _TD_MND_VGROUP_H_
|
|
|
|
|
#define _TD_MND_VGROUP_H_
|
2021-10-04 09:44:39 +00:00
|
|
|
|
2021-11-27 14:56:18 +00:00
|
|
|
#include "mndInt.h"
|
2021-10-04 09:44:39 +00:00
|
|
|
|
2021-10-16 07:16:05 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
2021-10-04 09:44:39 +00:00
|
|
|
|
2021-12-16 05:35:51 +00:00
|
|
|
int32_t mndInitVgroup(SMnode *pMnode);
|
|
|
|
|
void mndCleanupVgroup(SMnode *pMnode);
|
|
|
|
|
SVgObj *mndAcquireVgroup(SMnode *pMnode, int32_t vgId);
|
|
|
|
|
void mndReleaseVgroup(SMnode *pMnode, SVgObj *pVgroup);
|
|
|
|
|
SSdbRaw *mndVgroupActionEncode(SVgObj *pVgroup);
|
2023-05-30 10:50:00 +00:00
|
|
|
SSdbRow *mndVgroupActionDecode(SSdbRaw *pRaw);
|
2022-03-21 08:35:27 +00:00
|
|
|
SEpSet mndGetVgroupEpset(SMnode *pMnode, const SVgObj *pVgroup);
|
2024-03-15 01:14:54 +00:00
|
|
|
SEpSet mndGetVgroupEpsetById(SMnode *pMnode, int32_t vgId);
|
2021-12-29 07:10:50 +00:00
|
|
|
int32_t mndGetVnodesNum(SMnode *pMnode, int32_t dnodeId);
|
2022-06-10 10:56:00 +00:00
|
|
|
void mndSortVnodeGid(SVgObj *pVgroup);
|
2022-07-04 09:50:35 +00:00
|
|
|
int64_t mndGetVnodesMemory(SMnode *pMnode, int32_t dnodeId);
|
|
|
|
|
int64_t mndGetVgroupMemory(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup);
|
2021-12-18 12:56:05 +00:00
|
|
|
|
2022-06-06 03:49:30 +00:00
|
|
|
SArray *mndBuildDnodesArray(SMnode *, int32_t exceptDnodeId);
|
|
|
|
|
int32_t mndAllocSmaVgroup(SMnode *, SDbObj *pDb, SVgObj *pVgroup);
|
|
|
|
|
int32_t mndAllocVgroup(SMnode *, SDbObj *pDb, SVgObj **ppVgroups);
|
2023-08-18 06:26:58 +00:00
|
|
|
int32_t mndAddNewVgPrepareAction(SMnode *, STrans *pTrans, SVgObj *pVg);
|
2022-10-20 08:47:03 +00:00
|
|
|
int32_t mndAddCreateVnodeAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, SVnodeGid *pVgid);
|
2022-06-06 03:49:30 +00:00
|
|
|
int32_t mndAddAlterVnodeConfirmAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup);
|
|
|
|
|
int32_t mndAddAlterVnodeAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, tmsg_t msgType);
|
|
|
|
|
int32_t mndAddDropVnodeAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, SVnodeGid *pVgid, bool isRedo);
|
2023-05-16 06:02:54 +00:00
|
|
|
int32_t mndSetMoveVgroupsInfoToTrans(SMnode *, STrans *pTrans, int32_t dropDnodeId, bool force, bool unsafe);
|
2022-10-11 08:23:23 +00:00
|
|
|
int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb, SDbObj *pNewDb, SVgObj *pVgroup,
|
2024-03-15 01:14:54 +00:00
|
|
|
SArray *pArray, SVgObj* pNewVgroup);
|
2023-03-07 13:46:34 +00:00
|
|
|
int32_t mndBuildCompactVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int64_t compactTs,
|
|
|
|
|
STimeWindow tw);
|
2023-07-19 07:35:37 +00:00
|
|
|
int32_t mndBuildRaftAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb, SDbObj *pNewDb, SVgObj *pVgroup,
|
|
|
|
|
SArray *pArray);
|
2022-06-06 03:49:30 +00:00
|
|
|
|
2022-10-20 08:47:03 +00:00
|
|
|
void *mndBuildCreateVnodeReq(SMnode *, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen);
|
2022-06-06 03:49:30 +00:00
|
|
|
void *mndBuildDropVnodeReq(SMnode *, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen);
|
2022-07-01 09:02:33 +00:00
|
|
|
bool mndVgroupInDb(SVgObj *pVgroup, int64_t dbUid);
|
2023-05-09 09:15:37 +00:00
|
|
|
bool mndVgroupInDnode(SVgObj *pVgroup, int32_t dnodeId);
|
2024-03-15 01:14:54 +00:00
|
|
|
int32_t mndBuildRestoreAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *db, SVgObj *pVgroup,
|
|
|
|
|
SDnodeObj *pDnode);
|
2021-10-17 03:42:05 +00:00
|
|
|
|
2023-05-06 01:14:03 +00:00
|
|
|
int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj *pVgroup);
|
|
|
|
|
|
2021-10-16 07:16:05 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2021-10-04 09:44:39 +00:00
|
|
|
|
2021-11-27 15:02:20 +00:00
|
|
|
#endif /*_TD_MND_VGROUP_H_*/
|