未验证 提交 c9b93dc4 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #10376 from taosdata/feature/config

rpc config
......@@ -44,7 +44,6 @@ extern int8_t tsDeadLockKillQuery;
// client
extern int32_t tsMaxWildCardsLen;
extern int32_t tsMaxRegexStringLen;
extern int8_t tsTscEnableRecordSql;
extern int32_t tsMaxNumOfOrderedResults;
extern int32_t tsMinSlidingTime;
extern int32_t tsMinIntervalTime;
......@@ -55,23 +54,8 @@ extern float tsStreamComputDelayRatio; // the delayed computing ration of the
extern int32_t tsProjectExecInterval;
extern int64_t tsMaxRetentWindow;
// system info
extern uint32_t tsVersion;
// lossy
extern char tsLossyColumns[];
extern double tsFPrecision;
extern double tsDPrecision;
extern uint32_t tsMaxRange;
extern uint32_t tsCurRange;
extern char tsCompressor[];
#define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
void taosInitGlobalCfg();
int32_t taosCfgDynamicOptions(char *msg);
bool taosCheckBalanceCfgOptions(const char *option, int32_t *vnodeId, int32_t *dnodeId);
void taosAddDataDir(int index, char *v1, int level, int primary);
......
......@@ -32,6 +32,8 @@ typedef struct {
uint16_t numOfCommitThreads;
bool enableTelem;
bool printAuth;
int32_t rpcTimer;
int32_t rpcMaxTime;
char timezone[TSDB_TIMEZONE_LEN];
char locale[TSDB_LOCALE_LEN];
char charset[TSDB_LOCALE_LEN];
......
......@@ -84,9 +84,15 @@ typedef struct SRpcInit {
void *parent;
} SRpcInit;
int32_t rpcInit();
typedef struct {
int32_t rpcTimer;
int32_t rpcMaxTime;
int32_t sver;
} SRpcCfg;
int32_t rpcInit(SRpcCfg *pCfg);
void rpcCleanup();
void * rpcOpen(const SRpcInit *pRpc);
void *rpcOpen(const SRpcInit *pRpc);
void rpcClose(void *);
void * rpcMallocCont(int contLen);
void rpcFreeCont(void *pCont);
......
/*
* 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/>.
*/
#ifndef _TD_UTIL_NOTE_H
#define _TD_UTIL_NOTE_H
#ifdef __cplusplus
extern "C" {
#endif
#define MAX_NOTE_LINE_SIZE 66000
#define NOTE_FILE_NAME_LEN 300
typedef struct {
int32_t fileNum;
int32_t maxLines;
int32_t lines;
int32_t flag;
int32_t fd;
int32_t openInProgress;
char name[NOTE_FILE_NAME_LEN];
pthread_mutex_t mutex;
} SNoteObj;
extern SNoteObj tsHttpNote;
extern SNoteObj tsTscNote;
extern SNoteObj tsInfoNote;
int32_t taosInitNotes();
void taosNotePrint(SNoteObj* pNote, const char* const format, ...);
void taosNotePrintBuffer(SNoteObj* pNote, char* buffer, int32_t len);
#define nPrintHttp(...) \
if (tsHttpEnableRecordSql) { \
taosNotePrint(&tsHttpNote, __VA_ARGS__); \
}
#define nPrintTsc(...) \
if (tsTscEnableRecordSql) { \
taosNotePrint(&tsTscNote, __VA_ARGS__); \
}
#define nInfo(buffer, len) \
if (tscEmbeddedInUtil == 1) { \
taosNotePrintBuffer(&tsInfoNote, buffer, len); \
}
#ifdef __cplusplus
}
#endif
#endif /*_TD_UTIL_NOTE_H*/
......@@ -17,7 +17,7 @@
#include "clientInt.h"
#include "ulog.h"
// todo refact
// todo refact
SConfig *tscCfg;
static int32_t tscLoadCfg(SConfig *pConfig, const char *inputCfgDir, const char *envFile, const char *apolloUrl) {
......@@ -125,7 +125,7 @@ static int32_t tscAddEpCfg(SConfig *pCfg) {
return -1;
}
if (cfgAddString(pCfg, "fqdn", defaultFqdn) != 0) return -1;
int32_t defaultServerPort = 6030;
if (cfgAddInt32(pCfg, "serverPort", defaultServerPort, 1, 65056) != 0) return -1;
......@@ -142,11 +142,10 @@ static int32_t tscAddEpCfg(SConfig *pCfg) {
static int32_t tscAddCfg(SConfig *pCfg) {
if (tscAddEpCfg(pCfg) != 0) return -1;
// if (cfgAddString(pCfg, "buildinfo", buildinfo) != 0) return -1;
// if (cfgAddString(pCfg, "gitinfo", gitinfo) != 0) return -1;
// if (cfgAddString(pCfg, "version", version) != 0) return -1;
// if (cfgAddDir(pCfg, "dataDir", tsDataDir) != 0) return -1;
if (cfgAddTimezone(pCfg, "timezone", "") != 0) return -1;
if (cfgAddLocale(pCfg, "locale", "") != 0) return -1;
......@@ -160,7 +159,8 @@ static int32_t tscAddCfg(SConfig *pCfg) {
if (cfgAddFloat(pCfg, "numOfThreadsPerCore", 1, 0, 10) != 0) return -1;
if (cfgAddFloat(pCfg, "ratioOfQueryCores", 1, 0, 5) != 0) return -1;
if (cfgAddInt32(pCfg, "shellActivityTimer", 3, 1, 120) != 0) return -1;
if (cfgAddInt32(pCfg, "rpcTimer", 300, 100, 3000) != 0) return -1;
if (cfgAddInt32(pCfg, "rpcMaxTime", 600, 100, 7200) != 0) return -1;
if (cfgAddInt32(pCfg, "maxConnections", 50000, 1, 100000) != 0) return -1;
return 0;
}
......@@ -169,8 +169,6 @@ int32_t tscCheckCfg(SConfig *pCfg) {
bool enableCore = cfgGetItem(pCfg, "enableCoreFile")->bval;
taosSetCoreDump(enableCore);
return 0;
}
......
......@@ -22,7 +22,6 @@
#include "tcache.h"
#include "tglobal.h"
#include "tmsg.h"
#include "tnote.h"
#include "tref.h"
#include "trpc.h"
#include "ttime.h"
......@@ -224,11 +223,14 @@ void taos_init_imp(void) {
return;
}
taosInitNotes();
initMsgHandleFp();
initQueryModuleMsgHandle();
rpcInit();
SRpcCfg rpcCfg = {0};
rpcCfg.rpcTimer = cfgGetItem(tscCfg, "rpcTimer")->i32;
rpcCfg.rpcMaxTime = cfgGetItem(tscCfg, "rpcMaxTime")->i32;
rpcCfg.sver = 30000000;
rpcInit(&rpcCfg);
SCatalogCfg cfg = {.maxDBCacheNum = 100, .maxTblCacheNum = 100};
catalogInit(&cfg);
......
......@@ -8,7 +8,6 @@
#include "tep.h"
#include "tglobal.h"
#include "tmsgtype.h"
#include "tnote.h"
#include "tpagedbuf.h"
#include "tref.h"
......@@ -242,11 +241,9 @@ TAOS_RES* taos_query_l(TAOS* taos, const char* sql, int sqlLen) {
return NULL;
}
nPrintTsc("%s", sql)
SRequestObj* pRequest = NULL;
SQueryNode* pQueryNode = NULL;
SArray* pNodeList = taosArrayInit(4, sizeof(struct SQueryNodeAddr));
SRequestObj* pRequest = NULL;
SQueryNode* pQueryNode = NULL;
SArray* pNodeList = taosArrayInit(4, sizeof(struct SQueryNodeAddr));
terrno = TSDB_CODE_SUCCESS;
CHECK_CODE_GOTO(buildRequest(pTscObj, sql, sqlLen, &pRequest), _return);
......
......@@ -24,7 +24,6 @@
#include "tep.h"
#include "tglobal.h"
#include "tmsgtype.h"
#include "tnote.h"
#include "tpagedbuf.h"
#include "tref.h"
......
......@@ -49,7 +49,7 @@ int main(int argc, char** argv) {
}
TEST(testCase, driverInit_Test) {
taosInitGlobalCfg();
// taosInitGlobalCfg();
// taos_init();
}
......
......@@ -34,7 +34,7 @@ int main(int argc, char** argv) {
}
TEST(testCase, driverInit_Test) {
taosInitGlobalCfg();
// taosInitGlobalCfg();
// taos_init();
}
......
......@@ -60,8 +60,6 @@ int32_t tsCompatibleModel = 1;
int32_t tsMaxWildCardsLen = TSDB_PATTERN_STRING_DEFAULT_LEN;
int32_t tsMaxRegexStringLen = TSDB_REGEX_STRING_DEFAULT_LEN;
int8_t tsTscEnableRecordSql = 0;
// the maximum number of results for projection query on super table that are returned from
// one virtual node, to order according to timestamp
int32_t tsMaxNumOfOrderedResults = 100000;
......@@ -118,23 +116,6 @@ bool tsdbForceKeepFile = false;
*/
int64_t tsTickPerDay[] = {86400000L, 86400000000L, 86400000000000L};
// system info
int32_t tsTotalMemoryMB = 0;
uint32_t tsVersion = 0;
//
// lossy compress 6
//
char tsLossyColumns[32] = ""; // "float|double" means all float and double columns can be lossy compressed. set empty
// can close lossy compress.
// below option can take effect when tsLossyColumns not empty
double tsFPrecision = 1E-8; // float column precision
double tsDPrecision = 1E-16; // double column precision
uint32_t tsMaxRange = 500; // max range
uint32_t tsCurRange = 100; // range
char tsCompressor[32] = "ZSTD_COMPRESSOR"; // ZSTD_COMPRESSOR or GZIP_COMPRESSOR
int32_t (*monStartSystemFp)() = NULL;
void (*monStopSystemFp)() = NULL;
void (*monExecuteSQLFp)(char *sql) = NULL;
......@@ -427,17 +408,6 @@ static void doInitGlobalConfig(void) {
taosAddConfigOption(cfg);
cfg.option = "enableRecordSql";
cfg.ptr = &tsTscEnableRecordSql;
cfg.valType = TAOS_CFG_VTYPE_INT8;
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG;
cfg.minValue = 0;
cfg.maxValue = 1;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosAddConfigOption(cfg);
cfg.option = "maxBinaryDisplayWidth";
cfg.ptr = &tsMaxBinaryDisplayWidth;
cfg.valType = TAOS_CFG_VTYPE_INT32;
......@@ -529,8 +499,6 @@ static void doInitGlobalConfig(void) {
#endif
}
void taosInitGlobalCfg() { pthread_once(&tsInitGlobalCfgOnce, doInitGlobalConfig); }
/*
* alter dnode 1 balance "vnode:1-dnode:2"
*/
......
......@@ -80,6 +80,9 @@ static int32_t dmnAddDnodeCfg(SConfig *pCfg) {
if (cfgAddFloat(pCfg, "ratioOfQueryCores", 1, 0, 5) != 0) return -1;
if (cfgAddInt32(pCfg, "maxShellConns", 50000, 10, 50000000) != 0) return -1;
if (cfgAddInt32(pCfg, "shellActivityTimer", 3, 1, 120) != 0) return -1;
if (cfgAddInt32(pCfg, "rpcTimer", 300, 100, 3000) != 0) return -1;
if (cfgAddInt32(pCfg, "rpcMaxTime", 600, 100, 7200) != 0) return -1;
return 0;
}
......@@ -184,6 +187,8 @@ SDnodeEnvCfg dmnGetEnvCfg(SConfig *pCfg) {
envCfg.numOfCores = cfgGetItem(pCfg, "numOfCores")->i32;
envCfg.numOfCommitThreads = (uint16_t)cfgGetItem(pCfg, "numOfCommitThreads")->i32;
envCfg.enableTelem = cfgGetItem(pCfg, "telemetryReporting")->bval;
envCfg.rpcMaxTime = cfgGetItem(pCfg, "rpcMaxTime")->i32;
envCfg.rpcTimer = cfgGetItem(pCfg, "rpcTimer")->i32;
return envCfg;
}
......
......@@ -270,7 +270,8 @@ int32_t dndInit(const SDnodeEnvCfg *pCfg) {
taosBlockSIGPIPE();
taosResolveCRC();
if (rpcInit() != 0) {
SRpcCfg rpcCfg = {.rpcTimer = pCfg->rpcTimer, .rpcMaxTime = pCfg->rpcMaxTime, .sver = pCfg->sver};
if (rpcInit(&rpcCfg) != 0) {
dError("failed to init rpc since %s", terrstr());
dndCleanup();
return -1;
......
......@@ -24,7 +24,6 @@
#include "tdataformat.h"
#include "tglobal.h"
#include "tmsg.h"
#include "tnote.h"
#include "trpc.h"
#include "tthread.h"
#include "ulog.h"
......
......@@ -43,6 +43,8 @@ void Testbase::Init(const char* path, int16_t port) {
SDnodeEnvCfg cfg = {0};
cfg.numOfCommitThreads = 1;
cfg.numOfCores = 1;
cfg.rpcMaxTime = 600;
cfg.rpcTimer = 300;
dndInit(&cfg);
char fqdn[] = "localhost";
......
......@@ -146,8 +146,9 @@ typedef struct SRpcConn {
static int tsRpcRefId = -1;
static int32_t tsRpcNum = 0;
int32_t tsRpcTimer = 300;
int32_t tsRpcMaxTime = 600; // seconds;
int32_t tsRpcTimer = 300;
int32_t tsRpcMaxTime = 600; // seconds;
uint32_t tsVersion = 0;
// static pthread_once_t tsRpcInit = PTHREAD_ONCE_INIT;
......@@ -228,7 +229,9 @@ static void rpcInitImp(void) {
tsFqdnHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK);
}
int32_t rpcInit(void) {
int32_t rpcInit(SRpcCfg *pCfg) {
tsRpcTimer = pCfg->rpcTimer;
tsRpcMaxTime = pCfg->rpcMaxTime;
pthread_once(&tsRpcInitOnce, rpcInitImp);
return 0;
}
......
......@@ -112,7 +112,7 @@ void rpcSendRedirectRsp(void* thandle, const SEpSet* pEpSet) {
int rpcReportProgress(void* pConn, char* pCont, int contLen) { return -1; }
void rpcCancelRequest(int64_t rid) { return; }
int32_t rpcInit(void) {
int32_t rpcInit(SRpcCfg* pCfg) {
// impl later
return 0;
}
......
......@@ -82,6 +82,8 @@ char tsDataDir[PATH_MAX] = "/var/lib/taos";
char tsLogDir[PATH_MAX] = "/var/log/taos";
char tsTempDir[PATH_MAX] = "/tmp/";
void osInit() {}
void osInit() {
srand(taosSafeRand());
}
#endif
......@@ -16,7 +16,6 @@
#define _DEFAULT_SOURCE
#include "tlog.h"
#include "os.h"
#include "tnote.h"
#include "tutil.h"
#include "ulog.h"
......@@ -432,7 +431,6 @@ void taosPrintLog(const char *flags, int32_t dflag, const char *format, ...) {
}
if (dflag & DEBUG_SCREEN) taosWriteFile(1, buffer, (uint32_t)len);
if (dflag == 255) nInfo(buffer, len);
}
void taosDumpData(unsigned char *msg, int32_t len) {
......
/*
* 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 "tutil.h"
#include "tdef.h"
#include "tnote.h"
SNoteObj tsHttpNote;
SNoteObj tsTscNote;
SNoteObj tsInfoNote;
static int32_t taosOpenNoteWithMaxLines(char *fn, int32_t maxLines, int32_t maxNoteNum, SNoteObj *pNote);
static void taosCloseNoteByFd(int32_t oldFd, SNoteObj *pNote);
static void taosInitNote(int32_t numOfLines, int32_t maxNotes, SNoteObj *pNote, char *name) {
memset(pNote, 0, sizeof(SNoteObj));
pNote->fileNum = 1;
pNote->fd = -1;
if (taosOpenNoteWithMaxLines(name, numOfLines, maxNotes, pNote) < 0) {
fprintf(stderr, "failed to init note file\n");
}
taosNotePrint(pNote, "==================================================");
taosNotePrint(pNote, "=================== new note ===================");
taosNotePrint(pNote, "==================================================");
}
int32_t taosInitNotes() {
char name[TSDB_FILENAME_LEN * 2] = {0};
#if 0
if (tsTscEnableRecordSql) {
snprintf(name, TSDB_FILENAME_LEN * 2, "%s/tscsql-%d", tsLogDir, taosGetPId());
taosInitNote(tsNumOfLogLines, 1, &tsTscNote, name);
}
#endif
return 0;
}
static bool taosLockNote(int32_t fd, SNoteObj *pNote) {
if (fd < 0) return false;
if (pNote->fileNum > 1) {
int32_t ret = (int32_t)taosLockFile(fd);
if (ret == 0) {
return true;
}
}
return false;
}
static void taosUnLockNote(int32_t fd, SNoteObj *pNote) {
if (fd < 0) return;
if (pNote->fileNum > 1) {
taosUnLockFile(fd);
}
}
static void *taosThreadToOpenNewNote(void *param) {
char name[NOTE_FILE_NAME_LEN * 2];
SNoteObj *pNote = (SNoteObj *)param;
setThreadName("openNewNote");
pNote->flag ^= 1;
pNote->lines = 0;
sprintf(name, "%s.%d", pNote->name, pNote->flag);
taosUmaskFile(0);
int32_t fd = taosOpenFileCreateWriteTrunc(name);
if (fd < 0) {
return NULL;
}
taosLockNote(fd, pNote);
(void)taosLSeekFile(fd, 0, SEEK_SET);
int32_t oldFd = pNote->fd;
pNote->fd = fd;
pNote->lines = 0;
pNote->openInProgress = 0;
taosNotePrint(pNote, "=============== new note is opened =============");
taosCloseNoteByFd(oldFd, pNote);
return NULL;
}
static int32_t taosOpenNewNote(SNoteObj *pNote) {
pthread_mutex_lock(&pNote->mutex);
if (pNote->lines > pNote->maxLines && pNote->openInProgress == 0) {
pNote->openInProgress = 1;
taosNotePrint(pNote, "=============== open new note ==================");
pthread_t pattern;
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
pthread_create(&pattern, &attr, taosThreadToOpenNewNote, (void *)pNote);
pthread_attr_destroy(&attr);
}
pthread_mutex_unlock(&pNote->mutex);
return pNote->fd;
}
static bool taosCheckNoteIsOpen(char *noteName, SNoteObj *pNote) {
int32_t fd = taosOpenFileCreateWrite(noteName);
if (fd < 0) {
fprintf(stderr, "failed to open note:%s reason:%s\n", noteName, strerror(errno));
return true;
}
if (taosLockNote(fd, pNote)) {
taosUnLockNote(fd, pNote);
taosCloseFile(fd);
return false;
} else {
taosCloseFile(fd);
return true;
}
}
static void taosGetNoteName(char *fn, SNoteObj *pNote) {
if (pNote->fileNum > 1) {
for (int32_t i = 0; i < pNote->fileNum; i++) {
char fileName[NOTE_FILE_NAME_LEN];
sprintf(fileName, "%s%d.0", fn, i);
bool file1open = taosCheckNoteIsOpen(fileName, pNote);
sprintf(fileName, "%s%d.1", fn, i);
bool file2open = taosCheckNoteIsOpen(fileName, pNote);
if (!file1open && !file2open) {
sprintf(pNote->name, "%s%d", fn, i);
return;
}
}
}
if (strlen(fn) < NOTE_FILE_NAME_LEN) {
strcpy(pNote->name, fn);
}
}
static int32_t taosOpenNoteWithMaxLines(char *fn, int32_t maxLines, int32_t maxNoteNum, SNoteObj *pNote) {
char name[NOTE_FILE_NAME_LEN * 2] = {0};
int32_t size;
int32_t logstat0_mtime, logstat1_mtime;
pNote->maxLines = maxLines;
pNote->fileNum = maxNoteNum;
taosGetNoteName(fn, pNote);
if (strlen(fn) < NOTE_FILE_NAME_LEN + 50 - 2) {
strcpy(name, fn);
strcat(name, ".0");
}
bool log0Exist = taosStatFile(name, NULL, &logstat0_mtime) >= 0;
if (strlen(fn) < NOTE_FILE_NAME_LEN + 50 - 2) {
strcpy(name, fn);
strcat(name, ".1");
}
bool log1Exist = taosStatFile(name, NULL, &logstat1_mtime) >= 0;
if (!log0Exist && !log1Exist) {
pNote->flag = 0;
} else if (!log1Exist) {
pNote->flag = 0;
} else if (!log0Exist) {
pNote->flag = 1;
} else {
pNote->flag = (logstat0_mtime > logstat1_mtime) ? 0 : 1;
}
char noteName[NOTE_FILE_NAME_LEN * 2] = {0};
sprintf(noteName, "%s.%d", pNote->name, pNote->flag);
pthread_mutex_init(&pNote->mutex, NULL);
taosUmaskFile(0);
pNote->fd = taosOpenFileCreateWrite(noteName);
if (pNote->fd < 0) {
fprintf(stderr, "failed to open note file:%s reason:%s\n", noteName, strerror(errno));
return -1;
}
taosLockNote(pNote->fd, pNote);
// only an estimate for number of lines
int64_t filestat_size;
if (taosFStatFile(pNote->fd, &filestat_size, NULL) < 0) {
fprintf(stderr, "failed to fstat note file:%s reason:%s\n", noteName, strerror(errno));
return -1;
}
size = (int32_t)filestat_size;
pNote->lines = size / 60;
taosLSeekFile(pNote->fd, 0, SEEK_END);
return 0;
}
void taosNotePrintBuffer(SNoteObj *pNote, char *buffer, int32_t len) {
if (pNote->fd <= 0) return;
taosWriteFile(pNote->fd, buffer, len);
if (pNote->maxLines > 0) {
pNote->lines++;
if ((pNote->lines > pNote->maxLines) && (pNote->openInProgress == 0)) taosOpenNewNote(pNote);
}
}
void taosNotePrint(SNoteObj *pNote, const char *const format, ...) {
va_list argpointer;
char buffer[MAX_NOTE_LINE_SIZE + 2];
int32_t len;
struct tm Tm, *ptm;
struct timeval timeSecs;
time_t curTime;
taosGetTimeOfDay(&timeSecs);
curTime = timeSecs.tv_sec;
ptm = localtime_r(&curTime, &Tm);
len = sprintf(buffer, "%02d/%02d %02d:%02d:%02d.%06d %08" PRId64 " ", ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour,
ptm->tm_min, ptm->tm_sec, (int32_t)timeSecs.tv_usec, taosGetSelfPthreadId());
va_start(argpointer, format);
len += vsnprintf(buffer + len, MAX_NOTE_LINE_SIZE - len, format, argpointer);
va_end(argpointer);
if (len >= MAX_NOTE_LINE_SIZE) len = MAX_NOTE_LINE_SIZE - 2;
buffer[len++] = '\n';
buffer[len] = 0;
taosNotePrintBuffer(pNote, buffer, len);
}
// static void taosCloseNote(SNoteObj *pNote) { taosCloseNoteByFd(pNote->fd, pNote); }
static void taosCloseNoteByFd(int32_t fd, SNoteObj *pNote) {
if (fd >= 0) {
taosUnLockNote(fd, pNote);
taosCloseFile(fd);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册