提交 f9f0e72d 编写于 作者: S slguan

vnodePeer.h

上级 70462035
...@@ -684,10 +684,15 @@ typedef struct { ...@@ -684,10 +684,15 @@ typedef struct {
} SSecIe; } SSecIe;
typedef struct { typedef struct {
uint32_t ip; int32_t dnode; //the ID of dnode
uint32_t vnode; int32_t vnode; //the index of vnode
} SVPeerDesc; } SVPeerDesc;
typedef struct {
int32_t numOfVPeers;
SVPeerDesc vpeerDesc[];
} SVpeerDescArray;
typedef struct { typedef struct {
int32_t vnode; int32_t vnode;
SVnodeCfg cfg; SVnodeCfg cfg;
......
...@@ -25,7 +25,7 @@ extern "C" { ...@@ -25,7 +25,7 @@ extern "C" {
#include <stdint.h> #include <stdint.h>
#include "mnode.h" #include "mnode.h"
int32_t mgmtInitSTable();
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -34,3 +34,4 @@ ...@@ -34,3 +34,4 @@
#include "tsqlfunction.h" #include "tsqlfunction.h"
#include "ttime.h" #include "ttime.h"
#include "tstatus.h" #include "tstatus.h"
...@@ -97,7 +97,7 @@ int32_t mgmtMeterDropColumnByName(STabObj *pTable, const char *name); ...@@ -97,7 +97,7 @@ int32_t mgmtMeterDropColumnByName(STabObj *pTable, const char *name);
static int dropMeterImp(SDbObj *pDb, STabObj * pTable, SAcctObj *pAcct); static int dropMeterImp(SDbObj *pDb, STabObj * pTable, SAcctObj *pAcct);
static void dropAllMetersOfMetric(SDbObj *pDb, STabObj * pMetric, SAcctObj *pAcct); static void dropAllMetersOfMetric(SDbObj *pDb, STabObj * pMetric, SAcctObj *pAcct);
void mgmtMeterActionInit() { static void mgmtMeterActionInit() {
mgmtMeterActionFp[SDB_TYPE_INSERT] = mgmtMeterActionInsert; mgmtMeterActionFp[SDB_TYPE_INSERT] = mgmtMeterActionInsert;
mgmtMeterActionFp[SDB_TYPE_DELETE] = mgmtMeterActionDelete; mgmtMeterActionFp[SDB_TYPE_DELETE] = mgmtMeterActionDelete;
mgmtMeterActionFp[SDB_TYPE_UPDATE] = mgmtMeterActionUpdate; mgmtMeterActionFp[SDB_TYPE_UPDATE] = mgmtMeterActionUpdate;
......
...@@ -13,93 +13,41 @@ ...@@ -13,93 +13,41 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef TDENGINE_VNODEPEER_H #ifndef TDENGINE_VNODE_PEER_H
#define TDENGINE_VNODEPEER_H #define TDENGINE_VNODEPEER_H
#include "os.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#define TSDB_VMSG_SYNC_DATA 1 #include <stdint.h>
#define TSDB_VMSG_FORWARD 2 #include <stdbool.h>
#define TSDB_VMSG_SYNC_REQ 3 #include "tsdb.h"
#define TSDB_VMSG_SYNC_RSP 4
#define TSDB_VMSG_SYNC_MUST 5
#define TSDB_VMSG_STATUS 6
#pragma pack(push, 1)
typedef struct {
char type;
char version;
short sourceVid;
short destVid;
} SFirstPkt;
typedef struct {
uint64_t lastCreate;
uint64_t lastRemove;
uint32_t fileId;
uint64_t fmagic[];
} SSyncMsg;
typedef struct { /*
char status; * Initialize the resources
uint64_t version; */
} SPeerState; int32_t vnodeInitPeer(int numOfThreads);
typedef struct {
char status : 6;
char ack : 2;
char commitInProcess;
int32_t fileId; // ID for corrupted file, 0 means no corrupted file
uint64_t version;
SPeerState peerStates[];
} SPeerStatus;
#pragma pack(pop)
typedef struct _thread_obj { /*
pthread_t thread; * Free the resources
int threadId; */
int pollFd; void vnodeCleanUpPeers();
int numOfFds;
} SThreadObj;
typedef struct { /*
int numOfThreads; * Start a vnode synchronization process
SThreadObj **pThread; */
pthread_t thread; int32_t vnodeOpenPeer(int32_t vnode);
int threadId;
} SThreadPool;
typedef struct _vnodePeer { /*
void * signature; * Update the peerinfo of vnode
int ownId; // own vnode ID */
uint32_t ip; int32_t vnodeConfigPeer(SVpeerDescArray msg);
char ipstr[20]; // ip string
int vid;
int status;
int syncStatus;
int32_t fileId; // 0 means no corrupted file
uint64_t version;
int commitInProcess;
int syncFd;
int peerFd; // forward FD
void * hbTimer;
void * syncTimer;
SThreadObj *pThread;
} SVnodePeer;
typedef struct { /*
SVnodePeer *pVPeer; * Close a vnode synchronization process
uint64_t lastCreate; */
uint64_t lastRemove; void vnodeCleanUpPeer(int32_t vnode);
uint32_t fileId;
uint64_t fmagic[];
} SSyncCmd;
#ifdef __cplusplus #ifdef __cplusplus
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册