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

[TD-10430] resolve fix problems

上级 140ec7c8
...@@ -32,7 +32,7 @@ struct Dnode *dnodeCreateInstance(); ...@@ -32,7 +32,7 @@ struct Dnode *dnodeCreateInstance();
* *
* @param dnode, instance of dnode module. * @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. * Send messages to other dnodes, such as create vnode message.
......
...@@ -82,7 +82,7 @@ struct Mnode *mnodeCreateInstance(SMnodePara para); ...@@ -82,7 +82,7 @@ struct Mnode *mnodeCreateInstance(SMnodePara para);
* *
* @param mnode, instance of mnode module. * @param mnode, instance of mnode module.
*/ */
void mnodeCleanupInstance(struct Mnode *vnode); void mnodeDropInstance(struct Mnode *vnode);
/** /**
* Deploy mnode instances in dnode. * Deploy mnode instances in dnode.
......
...@@ -71,7 +71,7 @@ struct Vnode *vnodeCreateInstance(SVnodePara para); ...@@ -71,7 +71,7 @@ struct Vnode *vnodeCreateInstance(SVnodePara para);
* *
* @param vnode, instance of vnode module. * @param vnode, instance of vnode module.
*/ */
void vnodeCleanupInstance(struct Vnode *vnode); void vnodeDropInstance(struct Vnode *vnode);
typedef struct { typedef struct {
int32_t unused; int32_t unused;
......
...@@ -5,3 +5,10 @@ target_include_directories( ...@@ -5,3 +5,10 @@ target_include_directories(
PUBLIC "${CMAKE_SOURCE_DIR}/include/os" PUBLIC "${CMAKE_SOURCE_DIR}/include/os"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include" 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) ...@@ -7,5 +7,5 @@ aux_source_directory(. TAOSD_SRC)
add_executable(taosd ${TAOSD_SRC}) add_executable(taosd ${TAOSD_SRC})
target_link_libraries( target_link_libraries(
taosd taosd
PUBLIC os PUBLIC dnode
) )
\ No newline at end of file
...@@ -2,11 +2,7 @@ aux_source_directory(src DNODE_SRC) ...@@ -2,11 +2,7 @@ aux_source_directory(src DNODE_SRC)
add_library(dnode ${DNODE_SRC}) add_library(dnode ${DNODE_SRC})
target_link_libraries( target_link_libraries(
dnode dnode
PUBLIC os
PUBLIC cjson PUBLIC cjson
PUBLIC util
PUBLIC common
PUBLIC transport
PUBLIC mnode PUBLIC mnode
PUBLIC vnode PUBLIC vnode
) )
......
...@@ -65,7 +65,7 @@ static int32_t dnodeInitVnodeModule(Dnode *dnode, struct Vnode** out) { ...@@ -65,7 +65,7 @@ static int32_t dnodeInitVnodeModule(Dnode *dnode, struct Vnode** out) {
static void dnodeCleanupVnodeModule(Dnode *dnode, struct Vnode **out) { static void dnodeCleanupVnodeModule(Dnode *dnode, struct Vnode **out) {
struct Vnode *vnode = *out; struct Vnode *vnode = *out;
*out = NULL; *out = NULL;
vnodeCleanupInstance(vnode); vnodeDropInstance(vnode);
} }
static int32_t dnodeInitMnodeModule(Dnode *dnode, struct Mnode **out) { static int32_t dnodeInitMnodeModule(Dnode *dnode, struct Mnode **out) {
...@@ -90,7 +90,7 @@ 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) { static void dnodeCleanupMnodeModule(Dnode *dnode, struct Mnode **out) {
struct Mnode *mnode = *out; struct Mnode *mnode = *out;
*out = NULL; *out = NULL;
mnodeCleanupInstance(mnode); mnodeDropInstance(mnode);
} }
Dnode *dnodeCreateInstance() { Dnode *dnodeCreateInstance() {
...@@ -223,7 +223,7 @@ Dnode *dnodeCreateInstance() { ...@@ -223,7 +223,7 @@ Dnode *dnodeCreateInstance() {
return dnode; return dnode;
} }
void dnodeCleanupInstance(Dnode *dnode) { void dnodeDropInstance(Dnode *dnode) {
if (dnode->main->runStatus != TD_RUN_STAT_STOPPED) { if (dnode->main->runStatus != TD_RUN_STAT_STOPPED) {
dnode->main->runStatus = TD_RUN_STAT_STOPPED; dnode->main->runStatus = TD_RUN_STAT_STOPPED;
taosStepCleanup(dnode->steps); taosStepCleanup(dnode->steps);
......
...@@ -112,7 +112,9 @@ void dnodeCleanupMain(DnMain **out) { ...@@ -112,7 +112,9 @@ void dnodeCleanupMain(DnMain **out) {
main->dnodeTimer = NULL; main->dnodeTimer = NULL;
} }
#if 0
taos_cleanup(); taos_cleanup();
#endif
taosCloseLog(); taosCloseLog();
taosStopCacheRefreshWorker(); taosStopCacheRefreshWorker();
......
...@@ -5,3 +5,7 @@ target_include_directories( ...@@ -5,3 +5,7 @@ target_include_directories(
PUBLIC "${CMAKE_SOURCE_DIR}/include/server/mnode" PUBLIC "${CMAKE_SOURCE_DIR}/include/server/mnode"
private "${CMAKE_CURRENT_SOURCE_DIR}/inc" private "${CMAKE_CURRENT_SOURCE_DIR}/inc"
) )
target_link_libraries(
mnode
PUBLIC transport
)
\ No newline at end of file
...@@ -20,6 +20,11 @@ ...@@ -20,6 +20,11 @@
extern "C" { extern "C" {
#endif #endif
#include "os.h"
#include "taosmsg.h"
#include "trpc.h"
#include "mnode.h"
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -12,3 +12,25 @@ ...@@ -12,3 +12,25 @@
* You should have received a copy of the GNU Affero General Public License * 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/>. * 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 @@ ...@@ -13,8 +13,25 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "os.h" #include "os.h"
#include "tulog.h"
#include "trpc.h"
#include "dnode.h"
int main(int argc, char const *argv[]) { 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; return 0;
} }
...@@ -9,9 +9,10 @@ target_include_directories( ...@@ -9,9 +9,10 @@ target_include_directories(
PUBLIC "${CMAKE_SOURCE_DIR}/include/server/vnode" PUBLIC "${CMAKE_SOURCE_DIR}/include/server/vnode"
private "${CMAKE_CURRENT_SOURCE_DIR}/inc" private "${CMAKE_CURRENT_SOURCE_DIR}/inc"
) )
target_include_directories( target_link_libraries(
vnode vnode
PRIVATE meta PUBLIC transport
PRIVATE tq PUBLIC meta
PRIVATE tsdb PUBLIC tq
PUBLIC tsdb
) )
\ No newline at end of file
...@@ -20,6 +20,11 @@ ...@@ -20,6 +20,11 @@
extern "C" { extern "C" {
#endif #endif
#include "os.h"
#include "taosmsg.h"
#include "trpc.h"
#include "vnode.h"
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -12,3 +12,19 @@ ...@@ -12,3 +12,19 @@
* You should have received a copy of the GNU Affero General Public License * 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/>. * 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.
先完成此消息的编辑!
想要评论请 注册