提交 1c40f32e 编写于 作者: S Shengliang Guan

[TD-10430] resolve fix problems

上级 140ec7c8
......@@ -32,7 +32,7 @@ struct Dnode *dnodeCreateInstance();
*
* @param dnode, instance of dnode module.
*/
void dnodeCleanupInstance(struct Dnode *dnode);
void dnodeDropInstance(struct Dnode *dnode);
/**
* Send messages to other dnodes, such as create vnode message.
......
......@@ -82,7 +82,7 @@ struct Mnode *mnodeCreateInstance(SMnodePara para);
*
* @param mnode, instance of mnode module.
*/
void mnodeCleanupInstance(struct Mnode *vnode);
void mnodeDropInstance(struct Mnode *vnode);
/**
* Deploy mnode instances in dnode.
......
......@@ -71,7 +71,7 @@ struct Vnode *vnodeCreateInstance(SVnodePara para);
*
* @param vnode, instance of vnode module.
*/
void vnodeCleanupInstance(struct Vnode *vnode);
void vnodeDropInstance(struct Vnode *vnode);
typedef struct {
int32_t unused;
......
......@@ -5,3 +5,10 @@ target_include_directories(
PUBLIC "${CMAKE_SOURCE_DIR}/include/os"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include"
)
target_link_libraries(
os
PUBLIC pthread
PUBLIC dl
PUBLIC rt
PUBLIC m
)
\ No newline at end of file
......@@ -7,5 +7,5 @@ aux_source_directory(. TAOSD_SRC)
add_executable(taosd ${TAOSD_SRC})
target_link_libraries(
taosd
PUBLIC os
PUBLIC dnode
)
\ No newline at end of file
......@@ -2,11 +2,7 @@ aux_source_directory(src DNODE_SRC)
add_library(dnode ${DNODE_SRC})
target_link_libraries(
dnode
PUBLIC os
PUBLIC cjson
PUBLIC util
PUBLIC common
PUBLIC transport
PUBLIC mnode
PUBLIC vnode
)
......
......@@ -65,7 +65,7 @@ static int32_t dnodeInitVnodeModule(Dnode *dnode, struct Vnode** out) {
static void dnodeCleanupVnodeModule(Dnode *dnode, struct Vnode **out) {
struct Vnode *vnode = *out;
*out = NULL;
vnodeCleanupInstance(vnode);
vnodeDropInstance(vnode);
}
static int32_t dnodeInitMnodeModule(Dnode *dnode, struct Mnode **out) {
......@@ -90,7 +90,7 @@ static int32_t dnodeInitMnodeModule(Dnode *dnode, struct Mnode **out) {
static void dnodeCleanupMnodeModule(Dnode *dnode, struct Mnode **out) {
struct Mnode *mnode = *out;
*out = NULL;
mnodeCleanupInstance(mnode);
mnodeDropInstance(mnode);
}
Dnode *dnodeCreateInstance() {
......@@ -223,7 +223,7 @@ Dnode *dnodeCreateInstance() {
return dnode;
}
void dnodeCleanupInstance(Dnode *dnode) {
void dnodeDropInstance(Dnode *dnode) {
if (dnode->main->runStatus != TD_RUN_STAT_STOPPED) {
dnode->main->runStatus = TD_RUN_STAT_STOPPED;
taosStepCleanup(dnode->steps);
......
......@@ -112,7 +112,9 @@ void dnodeCleanupMain(DnMain **out) {
main->dnodeTimer = NULL;
}
#if 0
taos_cleanup();
#endif
taosCloseLog();
taosStopCacheRefreshWorker();
......
......@@ -5,3 +5,7 @@ target_include_directories(
PUBLIC "${CMAKE_SOURCE_DIR}/include/server/mnode"
private "${CMAKE_CURRENT_SOURCE_DIR}/inc"
)
target_link_libraries(
mnode
PUBLIC transport
)
\ No newline at end of file
......@@ -20,6 +20,11 @@
extern "C" {
#endif
#include "os.h"
#include "taosmsg.h"
#include "trpc.h"
#include "mnode.h"
#ifdef __cplusplus
}
#endif
......
......@@ -12,3 +12,25 @@
* 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/>.
*/
#include "mnodeInt.h"
struct Mnode *mnodeCreateInstance(SMnodePara para) {
return NULL;
}
void mnodeDropInstance(struct Mnode *vnode) {}
int32_t mnodeDeploy(struct Mnode *mnode, struct SMInfos *minfos) { return 0; }
void mnodeUnDeploy(struct Mnode *mnode) {}
bool mnodeIsServing(struct Mnode *mnode) { return false; }
int32_t mnodeGetStatistics(struct Mnode *mnode, SMnodeStat *stat) { return 0; }
int32_t mnodeRetriveAuth(struct Mnode *mnode, char *user, char *spi, char *encrypt, char *secret, char *ckey) {
return 0;
}
void mnodeProcessMsg(struct Mnode *mnode, SRpcMsg *rpcMsg) {}
......@@ -13,8 +13,25 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "os.h"
#include "tulog.h"
#include "trpc.h"
#include "dnode.h"
int main(int argc, char const *argv[]) {
printf("Hello world!\n");
struct Dnode *dnode = dnodeCreateInstance();
if (dnode == NULL) {
uInfo("Failed to start TDengine, please check the log at:%s", tsLogDir);
exit(EXIT_FAILURE);
}
uInfo("Started TDengine service successfully.");
// if (tsem_wait(&exitSem) != 0) {
// syslog(LOG_ERR, "failed to wait exit semphore: %s", strerror(errno));
// }
dnodeDropInstance(dnode);
uInfo("TDengine is shut down!");
return 0;
}
......@@ -9,9 +9,10 @@ target_include_directories(
PUBLIC "${CMAKE_SOURCE_DIR}/include/server/vnode"
private "${CMAKE_CURRENT_SOURCE_DIR}/inc"
)
target_include_directories(
target_link_libraries(
vnode
PRIVATE meta
PRIVATE tq
PRIVATE tsdb
PUBLIC transport
PUBLIC meta
PUBLIC tq
PUBLIC tsdb
)
\ No newline at end of file
......@@ -20,6 +20,11 @@
extern "C" {
#endif
#include "os.h"
#include "taosmsg.h"
#include "trpc.h"
#include "vnode.h"
#ifdef __cplusplus
}
#endif
......
......@@ -12,3 +12,19 @@
* 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/>.
*/
#include "vnodeInt.h"
struct Vnode *vnodeCreateInstance(SVnodePara para) {
return NULL;
}
void vnodeDropInstance(struct Vnode *vnode) {}
int32_t vnodeGetStatistics(struct Vnode *vnode, SVnodeStat *stat) { return 0; }
void vnodeGetStatus(struct Vnode *vnode, struct SStatusMsg *status) {}
void vnodeSetAccess(struct Vnode *vnode, struct SVgroupAccess *access, int32_t numOfVnodes) {}
void vnodeProcessMsg(struct Vnode *vnode, SRpcMsg *msg) {}
/*
* 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/>.
*/
#define _DEFAULT_SOURCE
#include "os.h"
#include "tulog.h"
#include "tstep.h"
SSteps *taosStepInit(int32_t maxsize) {
SSteps *steps = calloc(1, sizeof(SSteps));
if (steps == NULL) return NULL;
steps->maxsize = maxsize;
steps->cursize = 0;
steps->steps = calloc(maxsize, sizeof(SStepObj));
return steps;
}
int32_t taosStepAdd(SSteps *steps, SStepObj *step) {
if (steps == NULL) return - 1;
if (steps->cursize >= steps->maxsize) {
uError("failed to add step since up to the maxsize");
return -1;
}
steps->steps[steps->cursize++] = *step;
return 0;
}
static void taosStepCleanupImp(SSteps *steps, int32_t pos) {
for (int32_t s = pos; s >= 0; s--) {
SStepObj *step = steps->steps + s;
uDebug("step:%s will cleanup", step->name);
if (step->cleanupFp != NULL) {
(*step->cleanupFp)(step->self);
}
}
}
int32_t taosStepExec(SSteps *steps) {
if (steps == NULL) return -1;
for (int32_t s = 0; s < steps->cursize; s++) {
SStepObj *step = steps->steps + s;
if (step->initFp == NULL) continue;
if (step->reportFp != NULL) {
(*step->reportFp)(step->parent, step->name, "start initialize");
}
int32_t code = (*step->initFp)(step->parent, step->self);
if (code != 0) {
uDebug("step:%s will cleanup", step->name);
taosStepCleanupImp(steps, s);
return code;
}
uInfo("step:%s is initialized", step->name);
if (step->reportFp != NULL) {
(*step->reportFp)(step->parent, step->name, "initialize completed");
}
}
return 0;
}
void taosStepCleanup(SSteps *steps) {
if (steps == NULL) return;
taosStepCleanupImp(steps, steps->cursize - 1);
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册