diff --git a/include/common/taoserror.h b/include/common/taoserror.h index 7e3060103753de7d45c7c09b67f91621324c5307..c3f3e3b98b5414ae0f7b08e0b977b70764d8216f 100644 --- a/include/common/taoserror.h +++ b/include/common/taoserror.h @@ -20,9 +20,6 @@ extern "C" { #endif -#include -#include - #define TAOS_DEF_ERROR_CODE(mod, code) ((int32_t)((0x80000000 | ((mod)<<16) | (code)))) #define TAOS_SYSTEM_ERROR(code) (0x80ff0000 | (code)) diff --git a/include/common/taosmsg.h b/include/common/taosmsg.h index be2f6907525f6324fb133d3ff3bcbd80ee5e4dc3..c296317758511f1c6f4a7f5fd563b40f0ca92569 100644 --- a/include/common/taosmsg.h +++ b/include/common/taosmsg.h @@ -20,9 +20,6 @@ extern "C" { #endif -#include -#include - #include "taosdef.h" #include "taoserror.h" #include "tdataformat.h" diff --git a/include/common/ttype.h b/include/common/ttype.h index 2150b818d7b514885c0b820b7406cce717ecf1d3..941ad7ae8493e3f70403486fb37830adb1a556cb 100644 --- a/include/common/ttype.h +++ b/include/common/ttype.h @@ -5,8 +5,6 @@ extern "C" { #endif -#include -#include #include "taosdef.h" // this data type is internally used only in 'in' query to hold the values diff --git a/include/server/dnode/dnode.h b/include/server/dnode/dnode.h index 76a3d3ea1b8e6f767fe3f511f2a84bfe75ca4013..a41235e7c9a966be7c312efd7e463a8c4e6bf5a8 100644 --- a/include/server/dnode/dnode.h +++ b/include/server/dnode/dnode.h @@ -20,6 +20,10 @@ extern "C" { #endif +struct SRpcEpSet; +struct SRpcMsg; +struct Dnode; + /** * Initialize and start the dnode module. * diff --git a/include/util/tdef.h b/include/util/tdef.h index 04a06d127514dc11fb4d2b1b987e996f7dcd0599..c67886f240d4a408e0e5d855e755fe43182deed8 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -16,6 +16,8 @@ #ifndef _TD_UTIL_DEF_H #define _TD_UTIL_DEF_H +#include "os.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/include/util/tulog.h b/include/util/ulog.h similarity index 100% rename from include/util/tulog.h rename to include/util/ulog.h diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 61378c79c4b5c44ffa11ae9132aa6f8b89ab5f71..6e76e3a8d085adadb4d9d92867cc0ca0ccd646a7 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -13,7 +13,7 @@ * along with this program. If not, see . */ #include "tdataformat.h" -#include "tulog.h" +#include "ulog.h" #include "talgo.h" #include "tcoding.h" #include "wchar.h" diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 1cebf9935124632c2c83dd66c5a6ab70628f5230..9eab95cd41243d62fc9a51dbc402d4b08efdcdc9 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -17,7 +17,7 @@ #include "os.h" #include "taosdef.h" #include "taoserror.h" -#include "tulog.h" +#include "ulog.h" #include "tlog.h" #include "tconfig.h" #include "tglobal.h" diff --git a/source/common/src/tlocale.c b/source/common/src/tlocale.c index 46a3d951db8473cbb1b6346a66938312d4e41fb1..a98a46b28a658924042b35df93d17db18b2c2f54 100644 --- a/source/common/src/tlocale.c +++ b/source/common/src/tlocale.c @@ -15,7 +15,7 @@ #define _DEFAULT_SOURCE #include "os.h" -#include "tulog.h" +#include "ulog.h" #include "tglobal.h" #include "tconfig.h" #include "tutil.h" diff --git a/source/common/src/ttimezone.c b/source/common/src/ttimezone.c index 62d4768db8a368daab105ac5abf6cf7607d5e52b..c45e39c20d458bff58d35c8e76848051617da8eb 100644 --- a/source/common/src/ttimezone.c +++ b/source/common/src/ttimezone.c @@ -15,7 +15,7 @@ #define _DEFAULT_SOURCE #include "os.h" -#include "tulog.h" +#include "ulog.h" #include "tglobal.h" #include "tconfig.h" #include "tutil.h" diff --git a/source/server/server.c b/source/server/server.c index b5c8992b65a0fc510a92140003d9c858b0664c6f..0e50b1f97fd4d65b93e7eebbb15637ed71f6cc8c 100644 --- a/source/server/server.c +++ b/source/server/server.c @@ -13,11 +13,22 @@ * along with this program. If not, see . */ #include "os.h" -#include "tulog.h" -#include "trpc.h" +#include "ulog.h" #include "dnode.h" +static bool stop = false; +static void sigintHandler(int32_t signum, void *info, void *ctx) { stop = true; } +static void setSignalHandler() { + taosSetSignal(SIGTERM, sigintHandler); + taosSetSignal(SIGHUP, sigintHandler); + taosSetSignal(SIGINT, sigintHandler); + taosSetSignal(SIGABRT, sigintHandler); + taosSetSignal(SIGBREAK, sigintHandler); +} + int main(int argc, char const *argv[]) { + setSignalHandler(); + struct Dnode *dnode = dnodeCreateInstance(); if (dnode == NULL) { uInfo("Failed to start TDengine, please check the log at:%s", tsLogDir); @@ -26,12 +37,12 @@ int main(int argc, char const *argv[]) { uInfo("Started TDengine service successfully."); - // if (tsem_wait(&exitSem) != 0) { - // syslog(LOG_ERR, "failed to wait exit semphore: %s", strerror(errno)); - // } + while (!stop) { + taosMsleep(100); + } - dnodeDropInstance(dnode); - uInfo("TDengine is shut down!"); + dnodeDropInstance(dnode); + return 0; } diff --git a/source/util/src/hash.c b/source/util/src/hash.c index 644fc67eb5a3f34771ea74bc70ccc5525999d6f7..72d293a0e919899332d11697c023cf91d86c991b 100644 --- a/source/util/src/hash.c +++ b/source/util/src/hash.c @@ -15,7 +15,7 @@ #include "os.h" #include "hash.h" -#include "tulog.h" +#include "ulog.h" #include "tdef.h" #define EXT_SIZE 1024 diff --git a/source/util/src/tcache.c b/source/util/src/tcache.c index 589d3d4fa57c42b472319673a72d2e7ab599689f..0c9a1a18adef255cf88e289b4fbad90d169dcb7e 100644 --- a/source/util/src/tcache.c +++ b/source/util/src/tcache.c @@ -15,7 +15,7 @@ #define _DEFAULT_SOURCE #include "os.h" -#include "tulog.h" +#include "ulog.h" #include "ttimer.h" #include "tutil.h" #include "tcache.h" diff --git a/source/util/src/tcompare.c b/source/util/src/tcompare.c index 29cd13a6d5effbde356d43f2521c976ce1222fa5..1f47ae6be1eb207afc582a9e6dc143a1c56af6b3 100644 --- a/source/util/src/tcompare.c +++ b/source/util/src/tcompare.c @@ -18,7 +18,7 @@ #define _DEFAULT_SOURCE #include "tcompare.h" -#include "tulog.h" +#include "ulog.h" #include "hash.h" #include "regex.h" #include "os.h" diff --git a/source/util/src/tcompression.c b/source/util/src/tcompression.c index 990008a8401fbb0b619e367235f1859350c8b98c..4713de9772b2ba93e9c3e6bae1b9a7fdecea72dd 100644 --- a/source/util/src/tcompression.c +++ b/source/util/src/tcompression.c @@ -53,7 +53,7 @@ #include "td_sz.h" #endif #include "tscompression.h" -#include "tulog.h" +#include "ulog.h" static const int TEST_NUMBER = 1; #define is_bigendian() ((*(char *)&TEST_NUMBER) == 0) diff --git a/source/util/src/tconfig.c b/source/util/src/tconfig.c index b0256471cdfd6cb2afaa9fefa767ef6808c30580..6b3f08a446786c039b24befcbc9d2ec5f8f20a44 100644 --- a/source/util/src/tconfig.c +++ b/source/util/src/tconfig.c @@ -16,7 +16,7 @@ #define _DEFAULT_SOURCE #include "os.h" #include "tconfig.h" -#include "tulog.h" +#include "ulog.h" #include "tutil.h" SGlobalCfg tsGlobalConfig[TSDB_CFG_MAX_NUM] = {{0}}; diff --git a/source/util/src/tfile.c b/source/util/src/tfile.c index f4e1e5c11508b4ffc39f5c3155b46d2cbd974029..2dafd689d3a7a6bdad387bb087d866749e249e72 100644 --- a/source/util/src/tfile.c +++ b/source/util/src/tfile.c @@ -16,7 +16,7 @@ #define _DEFAULT_SOURCE #include "os.h" #include "taoserror.h" -#include "tulog.h" +#include "ulog.h" #include "tutil.h" #include "tref.h" diff --git a/source/util/src/tidpool.c b/source/util/src/tidpool.c index 61cecf54c0e14a4435ba72d317715cdec902068b..00c43bb25fdf6cea9d618b0ad5c48a0951a93b35 100644 --- a/source/util/src/tidpool.c +++ b/source/util/src/tidpool.c @@ -14,7 +14,7 @@ */ #include "os.h" -#include "tulog.h" +#include "ulog.h" typedef struct { int maxId; diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index f134730c5c2837be15af6a8e6d8cf506ffbb5998..2fb84656b60129247dc76f0efa7e96260e0a5399 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -15,7 +15,7 @@ #define _DEFAULT_SOURCE #include "os.h" -#include "tulog.h" +#include "ulog.h" #include "tlog.h" #include "tnote.h" #include "tutil.h" diff --git a/source/util/src/tlosertree.c b/source/util/src/tlosertree.c index c6e3a984931ee75b99246c258631f7dbf8ded252..6155ba4c1add9f5ead6acbe702c4cfd7d55419e2 100644 --- a/source/util/src/tlosertree.c +++ b/source/util/src/tlosertree.c @@ -15,7 +15,7 @@ #include "os.h" #include "tlosertree.h" -#include "tulog.h" +#include "ulog.h" // set initial value for loser tree void tLoserTreeInit(SLoserTreeInfo* pTree) { diff --git a/source/util/src/tmempool.c b/source/util/src/tmempool.c index 678c965eb1a7315977616778c0e4b39ceb4c7525..a61c4abb146ec7497fca7499ac06773812cdea90 100644 --- a/source/util/src/tmempool.c +++ b/source/util/src/tmempool.c @@ -14,7 +14,7 @@ */ #include "os.h" -#include "tulog.h" +#include "ulog.h" #include "tmempool.h" #include "tutil.h" diff --git a/source/util/src/tqueue.c b/source/util/src/tqueue.c index 6a37f11ecef376e70f4eefbf6446150bd350cf07..da1fb1837f9da1b2ff0f4eb37892ad88356f4865 100644 --- a/source/util/src/tqueue.c +++ b/source/util/src/tqueue.c @@ -14,7 +14,7 @@ */ #include "os.h" -#include "tulog.h" +#include "ulog.h" #include "taoserror.h" #include "tqueue.h" diff --git a/source/util/src/tref.c b/source/util/src/tref.c index 7d64bd1f83fb8d235c825057251a5e76e0b96b2a..68f161bd3dc6c12f121855c6edf04f62a2f285cb 100644 --- a/source/util/src/tref.c +++ b/source/util/src/tref.c @@ -15,7 +15,7 @@ #include "os.h" #include "taoserror.h" -#include "tulog.h" +#include "ulog.h" #include "tutil.h" #define TSDB_REF_OBJECTS 50 diff --git a/source/util/src/tsched.c b/source/util/src/tsched.c index 915eaa8d4ffc75addb98035eeb27046056f194bc..915edc45ceb99d75a36bf31eb93f550ccc98d561 100644 --- a/source/util/src/tsched.c +++ b/source/util/src/tsched.c @@ -16,7 +16,7 @@ #include "os.h" #include "tdef.h" #include "tutil.h" -#include "tulog.h" +#include "ulog.h" #include "tsched.h" #include "ttimer.h" diff --git a/source/util/src/tskiplist.c b/source/util/src/tskiplist.c index 4905b2723ed46fe51eb4f0c30b425e822b6c155e..d02b148863145acda026b3d605c4ca44e643108a 100644 --- a/source/util/src/tskiplist.c +++ b/source/util/src/tskiplist.c @@ -16,7 +16,7 @@ #include "tskiplist.h" #include "os.h" #include "tcompare.h" -#include "tulog.h" +#include "ulog.h" #include "tutil.h" static int initForwardBackwardPtr(SSkipList *pSkipList); diff --git a/source/util/src/tstep.c b/source/util/src/tstep.c index 97cd3290da842636a85c5ed6cf4b52e73881bd74..e307977e70dc097681d6d0421f3b55cfcd5fcd47 100644 --- a/source/util/src/tstep.c +++ b/source/util/src/tstep.c @@ -15,7 +15,7 @@ #define _DEFAULT_SOURCE #include "os.h" -#include "tulog.h" +#include "ulog.h" #include "tstep.h" SSteps *taosStepInit(int32_t maxsize) { diff --git a/source/util/src/tthread.c b/source/util/src/tthread.c index 2ffefa25e6a13b8ffd7c61005d0a6056545da243..5ed7fb5aa00d1a5c5c3fffae2de46dbea57e011f 100644 --- a/source/util/src/tthread.c +++ b/source/util/src/tthread.c @@ -17,7 +17,7 @@ #include "tthread.h" #include "tdef.h" #include "tutil.h" -#include "tulog.h" +#include "ulog.h" #include "taoserror.h" // create new thread diff --git a/source/util/src/tutil.c b/source/util/src/tutil.c index 9c79a7cca2fc479649582fa682dea62bbe2171a6..c5027af7c7978d48b602dbe7d977c21138a8aa37 100644 --- a/source/util/src/tutil.c +++ b/source/util/src/tutil.c @@ -17,7 +17,7 @@ #include "tcrc32c.h" #include "tdef.h" #include "tutil.h" -#include "tulog.h" +#include "ulog.h" #include "taoserror.h" int32_t strdequote(char *z) { diff --git a/source/util/src/tworker.c b/source/util/src/tworker.c index 3fe34755d74913178c942fa805c09e6974dcc40c..5370e78c090b28580a28e04dbb92b67ffaed3cb1 100644 --- a/source/util/src/tworker.c +++ b/source/util/src/tworker.c @@ -15,7 +15,7 @@ #define _DEFAULT_SOURCE #include "os.h" -#include "tulog.h" +#include "ulog.h" #include "tqueue.h" #include "tworker.h" diff --git a/source/util/test/trefTest.c b/source/util/test/trefTest.c index e01da070afd3333cf02c25b51d2e9711c1616fb0..54aa6a5f346b481e387593fcbd40077ca1a979ec 100644 --- a/source/util/test/trefTest.c +++ b/source/util/test/trefTest.c @@ -8,7 +8,7 @@ #include "tlog.h" #include "tglobal.h" #include "taoserror.h" -#include "tulog.h" +#include "ulog.h" typedef struct { int refNum; diff --git a/src/inc/module.h b/src/inc/module.h deleted file mode 100644 index b9b64c493ec5777ddd6981ebf3212ffd0ff0114d..0000000000000000000000000000000000000000 --- a/src/inc/module.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. - * - * 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 . - */ - -#ifndef TDENGINE_MODULE -#define TDENGINE_MODULE - -#ifdef __cplusplus -extern "C" { -#endif - -int32_t moduleStart(); -void moduleStop(); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/inc/vnode.h b/src/inc/vnode.h deleted file mode 100644 index b3291645c00be17283f7d078acb2d4c9a2629ece..0000000000000000000000000000000000000000 --- a/src/inc/vnode.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. - * - * 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 . - */ - -#ifndef TDENGINE_VNODE_H -#define TDENGINE_VNODE_H - -#ifdef __cplusplus -extern "C" { -#endif -#include "trpc.h" -#include "twal.h" - -typedef struct { - int32_t len; - void * rsp; - void * qhandle; // used by query and retrieve msg -} SRspRet; - -typedef struct { - int32_t code; - int32_t contLen; - void * rpcHandle; - void * rpcAhandle; - void * qhandle; - void * pVnode; - int8_t qtype; - int8_t msgType; - SRspRet rspRet; - char pCont[]; -} SVReadMsg; - -typedef struct { - int32_t code; - int32_t processedCount; - int32_t qtype; - void * pVnode; - SRpcMsg rpcMsg; - SRspRet rspRet; - char reserveForSync[24]; - SWalHead walHead; -} SVWriteMsg; - -// vnodeStatus -extern char *vnodeStatus[]; - -// vnodeMain -int32_t vnodeCreate(SCreateVnodeMsg *pVnodeCfg); -int32_t vnodeDrop(int32_t vgId); -int32_t vnodeOpen(int32_t vgId); -int32_t vnodeAlter(void *pVnode, SCreateVnodeMsg *pVnodeCfg); -int32_t vnodeSync(int32_t vgId); -int32_t vnodeClose(int32_t vgId); -int32_t vnodeCompact(int32_t vgId); - -// vnodeMgmt -int32_t vnodeInitMgmt(); -void vnodeCleanupMgmt(); -void* vnodeAcquire(int32_t vgId); -void vnodeRelease(void *pVnode); -void* vnodeAcquireNotClose(int32_t vgId); -void* vnodeGetWal(void *pVnode); -int32_t vnodeGetVnodeList(int32_t vnodeList[], int32_t *numOfVnodes); -void vnodeBuildStatusMsg(void *pStatus); -void vnodeSetAccess(SVgroupAccess *pAccess, int32_t numOfVnodes); - -// vnodeWrite -int32_t vnodeWriteToWQueue(void *pVnode, void *pHead, int32_t qtype, void *pRpcMsg); -void vnodeFreeFromWQueue(void *pVnode, SVWriteMsg *pWrite); -int32_t vnodeProcessWrite(void *pVnode, void *pHead, int32_t qtype, void *pRspRet); - -// vnodeSync -void vnodeConfirmForward(void *pVnode, uint64_t version, int32_t code, bool force); - -// vnodeRead -int32_t vnodeWriteToRQueue(void *pVnode, void *pCont, int32_t contLen, int8_t qtype, void *rparam); -void vnodeFreeFromRQueue(void *pVnode, SVReadMsg *pRead); -int32_t vnodeProcessRead(void *pVnode, SVReadMsg *pRead); - -#ifdef __cplusplus -} -#endif - -#endif