Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a11a2f37
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a11a2f37
编写于
3月 05, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/3.0' into feature/config
上级
cde33ee2
23521373
变更
71
显示空白变更内容
内联
并排
Showing
71 changed file
with
782 addition
and
448 deletion
+782
-448
include/common/tcommon.h
include/common/tcommon.h
+3
-20
include/common/tdatablock.h
include/common/tdatablock.h
+0
-0
include/common/tmsg.h
include/common/tmsg.h
+1
-1
include/libs/executor/executor.h
include/libs/executor/executor.h
+0
-19
include/libs/scalar/filter.h
include/libs/scalar/filter.h
+3
-2
include/libs/sync/sync.h
include/libs/sync/sync.h
+1
-1
include/os/osFile.h
include/os/osFile.h
+6
-2
include/util/thash.h
include/util/thash.h
+3
-12
source/client/inc/clientInt.h
source/client/inc/clientInt.h
+14
-18
source/client/src/clientHb.c
source/client/src/clientHb.c
+22
-15
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+1
-1
source/client/src/tmq.c
source/client/src/tmq.c
+263
-115
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+1
-1
source/common/src/tglobal.c
source/common/src/tglobal.c
+1
-1
source/common/src/ttszip.c
source/common/src/ttszip.c
+2
-2
source/common/test/commonTests.cpp
source/common/test/commonTests.cpp
+2
-1
source/dnode/mgmt/impl/inc/dndInt.h
source/dnode/mgmt/impl/inc/dndInt.h
+3
-3
source/dnode/mgmt/impl/test/sut/src/client.cpp
source/dnode/mgmt/impl/test/sut/src/client.cpp
+1
-1
source/dnode/mnode/impl/inc/mndInt.h
source/dnode/mnode/impl/inc/mndInt.h
+1
-1
source/dnode/vnode/inc/meta.h
source/dnode/vnode/inc/meta.h
+6
-6
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+21
-0
source/dnode/vnode/src/inc/metaDef.h
source/dnode/vnode/src/inc/metaDef.h
+1
-1
source/dnode/vnode/src/meta/metaBDBImpl.c
source/dnode/vnode/src/meta/metaBDBImpl.c
+17
-17
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+3
-1
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+1
-1
source/dnode/vnode/src/tsdb/tsdbFS.c
source/dnode/vnode/src/tsdb/tsdbFS.c
+4
-4
source/libs/catalog/test/catalogTests.cpp
source/libs/catalog/test/catalogTests.cpp
+2
-2
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+8
-1
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+4
-4
source/libs/executor/src/executorMain.c
source/libs/executor/src/executorMain.c
+1
-38
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+4
-6
source/libs/executor/src/tsort.c
source/libs/executor/src/tsort.c
+2
-2
source/libs/executor/test/executorTests.cpp
source/libs/executor/test/executorTests.cpp
+1
-1
source/libs/executor/test/sortTests.cpp
source/libs/executor/test/sortTests.cpp
+1
-1
source/libs/function/src/taggfunction.c
source/libs/function/src/taggfunction.c
+1
-1
source/libs/index/inc/indexInt.h
source/libs/index/inc/indexInt.h
+1
-1
source/libs/index/inc/index_util.h
source/libs/index/inc/index_util.h
+15
-0
source/libs/index/src/index.c
source/libs/index/src/index.c
+90
-31
source/libs/index/src/index_cache.c
source/libs/index/src/index_cache.c
+4
-9
source/libs/index/src/index_tfile.c
source/libs/index/src/index_tfile.c
+1
-1
source/libs/index/src/index_util.c
source/libs/index/src/index_util.c
+22
-1
source/libs/index/test/fstTest.cc
source/libs/index/test/fstTest.cc
+1
-1
source/libs/index/test/jsonUT.cc
source/libs/index/test/jsonUT.cc
+16
-0
source/libs/index/test/utilUT.cc
source/libs/index/test/utilUT.cc
+81
-0
source/libs/parser/test/mockCatalogService.cpp
source/libs/parser/test/mockCatalogService.cpp
+1
-1
source/libs/qcom/src/queryUtil.c
source/libs/qcom/src/queryUtil.c
+40
-26
source/libs/qworker/test/qworkerTests.cpp
source/libs/qworker/test/qworkerTests.cpp
+1
-1
source/libs/scalar/inc/filterInt.h
source/libs/scalar/inc/filterInt.h
+5
-5
source/libs/scalar/src/filter.c
source/libs/scalar/src/filter.c
+3
-3
source/libs/scalar/src/scalar.c
source/libs/scalar/src/scalar.c
+5
-5
source/libs/scalar/src/sclvector.c
source/libs/scalar/src/sclvector.c
+6
-6
source/libs/scalar/test/filter/filterTests.cpp
source/libs/scalar/test/filter/filterTests.cpp
+8
-2
source/libs/scalar/test/scalar/scalarTests.cpp
source/libs/scalar/test/scalar/scalarTests.cpp
+1
-1
source/libs/scheduler/test/schedulerTests.cpp
source/libs/scheduler/test/schedulerTests.cpp
+13
-1
source/libs/sync/src/syncIO.c
source/libs/sync/src/syncIO.c
+1
-1
source/libs/tfs/src/tfs.c
source/libs/tfs/src/tfs.c
+1
-1
source/libs/transport/test/pushClient.c
source/libs/transport/test/pushClient.c
+1
-1
source/libs/transport/test/pushServer.c
source/libs/transport/test/pushServer.c
+1
-1
source/libs/transport/test/rclient.c
source/libs/transport/test/rclient.c
+1
-1
source/libs/transport/test/rserver.c
source/libs/transport/test/rserver.c
+1
-1
source/libs/transport/test/syncClient.c
source/libs/transport/test/syncClient.c
+1
-1
source/libs/transport/test/transUT.cc
source/libs/transport/test/transUT.cc
+2
-2
source/libs/wal/src/walMeta.c
source/libs/wal/src/walMeta.c
+1
-1
source/libs/wal/src/walWrite.c
source/libs/wal/src/walWrite.c
+12
-9
source/libs/wal/test/walMetaTest.cpp
source/libs/wal/test/walMetaTest.cpp
+2
-2
source/os/src/osDir.c
source/os/src/osDir.c
+2
-2
source/os/src/osFile.c
source/os/src/osFile.c
+3
-1
source/util/src/terror.c
source/util/src/terror.c
+3
-0
source/util/src/thash.c
source/util/src/thash.c
+28
-24
source/util/src/tlog.c
source/util/src/tlog.c
+2
-2
source/util/src/tpagedbuf.c
source/util/src/tpagedbuf.c
+1
-1
未找到文件。
include/common/tcommon.h
浏览文件 @
a11a2f37
...
@@ -25,24 +25,6 @@
...
@@ -25,24 +25,6 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
// typedef struct STimeWindow {
// TSKEY skey;
// TSKEY ekey;
// } STimeWindow;
// typedef struct {
// int32_t dataLen;
// char name[TSDB_TABLE_FNAME_LEN];
// char *data;
// } STagData;
// typedef struct SSchema {
// uint8_t type;
// char name[TSDB_COL_NAME_LEN];
// int16_t colId;
// int16_t bytes;
// } SSchema;
enum
{
enum
{
TMQ_CONF__RESET_OFFSET__LATEST
=
-
1
,
TMQ_CONF__RESET_OFFSET__LATEST
=
-
1
,
TMQ_CONF__RESET_OFFSET__EARLIEAST
=
-
2
,
TMQ_CONF__RESET_OFFSET__EARLIEAST
=
-
2
,
...
@@ -50,7 +32,8 @@ enum {
...
@@ -50,7 +32,8 @@ enum {
};
};
enum
{
enum
{
TMQ_MSG_TYPE__POLL_RSP
=
0
,
TMQ_MSG_TYPE__DUMMY
=
0
,
TMQ_MSG_TYPE__POLL_RSP
,
TMQ_MSG_TYPE__EP_RSP
,
TMQ_MSG_TYPE__EP_RSP
,
};
};
...
...
include/common/t
ep
.h
→
include/common/t
datablock
.h
浏览文件 @
a11a2f37
文件已移动
include/common/tmsg.h
浏览文件 @
a11a2f37
...
@@ -70,7 +70,7 @@ typedef uint16_t tmsg_t;
...
@@ -70,7 +70,7 @@ typedef uint16_t tmsg_t;
typedef
enum
{
typedef
enum
{
HEARTBEAT_TYPE_MQ
=
0
,
HEARTBEAT_TYPE_MQ
=
0
,
HEARTBEAT_TYPE_QUERY
=
1
,
HEARTBEAT_TYPE_QUERY
,
// types can be added here
// types can be added here
//
//
HEARTBEAT_TYPE_MAX
HEARTBEAT_TYPE_MAX
...
...
include/libs/executor/executor.h
浏览文件 @
a11a2f37
...
@@ -89,25 +89,6 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t *useconds);
...
@@ -89,25 +89,6 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t *useconds);
*/
*/
int32_t
qRetrieveQueryResultInfo
(
qTaskInfo_t
tinfo
,
bool
*
buildRes
,
void
*
pRspContext
);
int32_t
qRetrieveQueryResultInfo
(
qTaskInfo_t
tinfo
,
bool
*
buildRes
,
void
*
pRspContext
);
/**
*
* Retrieve the actual results to fill the response message payload.
* Note that this function must be executed after qRetrieveQueryResultInfo is invoked.
*
* @param tinfo tinfo object
* @param pRsp response message
* @param contLen payload length
* @return
*/
//int32_t qDumpRetrieveResult(qTaskInfo_t tinfo, SRetrieveTableRsp** pRsp, int32_t* contLen, bool* continueExec);
/**
* return the transporter context (RPC)
* @param tinfo
* @return
*/
void
*
qGetResultRetrieveMsg
(
qTaskInfo_t
tinfo
);
/**
/**
* kill the ongoing query and free the query handle and corresponding resources automatically
* kill the ongoing query and free the query handle and corresponding resources automatically
* @param tinfo qhandle
* @param tinfo qhandle
...
...
include/libs/scalar/filter.h
浏览文件 @
a11a2f37
...
@@ -19,10 +19,12 @@
...
@@ -19,10 +19,12 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
#include "tcommon.h"
#include "nodes.h"
typedef
struct
SFilterInfo
SFilterInfo
;
typedef
struct
SFilterInfo
SFilterInfo
;
typedef
int32_t
(
*
filer_get_col_from_id
)(
void
*
,
int32_t
,
void
**
);
typedef
int32_t
(
*
filer_get_col_from_id
)(
void
*
,
int32_t
,
void
**
);
enum
{
enum
{
FLT_OPTION_NO_REWRITE
=
1
,
FLT_OPTION_NO_REWRITE
=
1
,
FLT_OPTION_TIMESTAMP
=
2
,
FLT_OPTION_TIMESTAMP
=
2
,
...
@@ -34,7 +36,6 @@ typedef struct SFilterColumnParam{
...
@@ -34,7 +36,6 @@ typedef struct SFilterColumnParam{
SArray
*
pDataBlock
;
SArray
*
pDataBlock
;
}
SFilterColumnParam
;
}
SFilterColumnParam
;
extern
int32_t
filterInitFromNode
(
SNode
*
pNode
,
SFilterInfo
**
pinfo
,
uint32_t
options
);
extern
int32_t
filterInitFromNode
(
SNode
*
pNode
,
SFilterInfo
**
pinfo
,
uint32_t
options
);
extern
bool
filterExecute
(
SFilterInfo
*
info
,
SSDataBlock
*
pSrc
,
int8_t
**
p
,
SColumnDataAgg
*
statis
,
int16_t
numOfCols
);
extern
bool
filterExecute
(
SFilterInfo
*
info
,
SSDataBlock
*
pSrc
,
int8_t
**
p
,
SColumnDataAgg
*
statis
,
int16_t
numOfCols
);
extern
int32_t
filterSetDataFromSlotId
(
SFilterInfo
*
info
,
void
*
param
);
extern
int32_t
filterSetDataFromSlotId
(
SFilterInfo
*
info
,
void
*
param
);
...
...
include/libs/sync/sync.h
浏览文件 @
a11a2f37
...
@@ -21,7 +21,7 @@ extern "C" {
...
@@ -21,7 +21,7 @@ extern "C" {
#endif
#endif
#include <stdint.h>
#include <stdint.h>
#include <t
ep
.h>
#include <t
datablock
.h>
#include "taosdef.h"
#include "taosdef.h"
#include "trpc.h"
#include "trpc.h"
...
...
include/os/osFile.h
浏览文件 @
a11a2f37
...
@@ -22,6 +22,7 @@ extern "C" {
...
@@ -22,6 +22,7 @@ extern "C" {
#include "osSocket.h"
#include "osSocket.h"
// If the error is in a third-party library, place this header file under the third-party library header file.
#ifndef ALLOW_FORBID_FUNC
#ifndef ALLOW_FORBID_FUNC
#define open OPEN_FUNC_TAOS_FORBID
#define open OPEN_FUNC_TAOS_FORBID
#define fopen FOPEN_FUNC_TAOS_FORBID
#define fopen FOPEN_FUNC_TAOS_FORBID
...
@@ -31,6 +32,8 @@ extern "C" {
...
@@ -31,6 +32,8 @@ extern "C" {
#define fstat FSTAT_FUNC_TAOS_FORBID
#define fstat FSTAT_FUNC_TAOS_FORBID
#define close CLOSE_FUNC_TAOS_FORBID
#define close CLOSE_FUNC_TAOS_FORBID
#define fclose FCLOSE_FUNC_TAOS_FORBID
#define fclose FCLOSE_FUNC_TAOS_FORBID
#define fsync FSYNC_FUNC_TAOS_FORBID
// #define fflush FFLUSH_FUNC_TAOS_FORBID
#endif
#endif
#ifndef PATH_MAX
#ifndef PATH_MAX
...
@@ -47,7 +50,7 @@ typedef struct TdFile *TdFilePtr;
...
@@ -47,7 +50,7 @@ typedef struct TdFile *TdFilePtr;
#define TD_FILE_TEXT 0x0020
#define TD_FILE_TEXT 0x0020
#define TD_FILE_AUTO_DEL 0x0040
#define TD_FILE_AUTO_DEL 0x0040
#define TD_FILE_EXCL 0x0080
#define TD_FILE_EXCL 0x0080
#define TD_FILE_STREAM 0x0100 // Only support taosFprintfFile, taosGetLineFile, taos
GetLineFile, taos
EOFFile
#define TD_FILE_STREAM 0x0100 // Only support taosFprintfFile, taosGetLineFile, taosEOFFile
TdFilePtr
taosOpenFile
(
const
char
*
path
,
int32_t
tdFileOptions
);
TdFilePtr
taosOpenFile
(
const
char
*
path
,
int32_t
tdFileOptions
);
#define TD_FILE_ACCESS_EXIST_OK 0x1
#define TD_FILE_ACCESS_EXIST_OK 0x1
...
@@ -80,6 +83,7 @@ int64_t taosCloseFile(TdFilePtr *ppFile);
...
@@ -80,6 +83,7 @@ int64_t taosCloseFile(TdFilePtr *ppFile);
int32_t
taosRenameFile
(
const
char
*
oldName
,
const
char
*
newName
);
int32_t
taosRenameFile
(
const
char
*
oldName
,
const
char
*
newName
);
int64_t
taosCopyFile
(
const
char
*
from
,
const
char
*
to
);
int64_t
taosCopyFile
(
const
char
*
from
,
const
char
*
to
);
int32_t
taosRemoveFile
(
const
char
*
path
);
void
taosGetTmpfilePath
(
const
char
*
inputTmpDir
,
const
char
*
fileNamePrefix
,
char
*
dstPath
);
void
taosGetTmpfilePath
(
const
char
*
inputTmpDir
,
const
char
*
fileNamePrefix
,
char
*
dstPath
);
...
...
include/util/thash.h
浏览文件 @
a11a2f37
...
@@ -28,7 +28,8 @@ typedef int32_t (*_equal_fn_t)(const void *, const void *, size_t len);
...
@@ -28,7 +28,8 @@ typedef int32_t (*_equal_fn_t)(const void *, const void *, size_t len);
typedef
void
(
*
_hash_before_fn_t
)(
void
*
);
typedef
void
(
*
_hash_before_fn_t
)(
void
*
);
typedef
void
(
*
_hash_free_fn_t
)(
void
*
);
typedef
void
(
*
_hash_free_fn_t
)(
void
*
);
#define HASH_NODE_EXIST(code) (code == -2)
#define HASH_KEY_ALREADY_EXISTS (-2)
#define HASH_NODE_EXIST(code) (code == HASH_KEY_ALREADY_EXISTS)
/**
/**
* murmur hash algorithm
* murmur hash algorithm
...
@@ -49,24 +50,14 @@ uint32_t taosIntHash_32(const char *key, uint32_t len);
...
@@ -49,24 +50,14 @@ uint32_t taosIntHash_32(const char *key, uint32_t len);
uint32_t
taosIntHash_64
(
const
char
*
key
,
uint32_t
len
);
uint32_t
taosIntHash_64
(
const
char
*
key
,
uint32_t
len
);
_hash_fn_t
taosGetDefaultHashFunction
(
int32_t
type
);
_hash_fn_t
taosGetDefaultHashFunction
(
int32_t
type
);
_equal_fn_t
taosGetDefaultEqualFunction
(
int32_t
type
);
_equal_fn_t
taosGetDefaultEqualFunction
(
int32_t
type
);
typedef
struct
SHashNode
{
struct
SHashNode
*
next
;
uint32_t
hashVal
;
// the hash value of key
uint32_t
dataLen
;
// length of data
uint32_t
keyLen
;
// length of the key
uint16_t
refCount
;
// reference count
int8_t
removed
;
// flag to indicate removed
char
data
[];
}
SHashNode
;
typedef
enum
SHashLockTypeE
{
typedef
enum
SHashLockTypeE
{
HASH_NO_LOCK
=
0
,
HASH_NO_LOCK
=
0
,
HASH_ENTRY_LOCK
=
1
,
HASH_ENTRY_LOCK
=
1
,
}
SHashLockTypeE
;
}
SHashLockTypeE
;
typedef
struct
SHashNode
SHashNode
;
typedef
struct
SHashObj
SHashObj
;
typedef
struct
SHashObj
SHashObj
;
/**
/**
...
...
source/client/inc/clientInt.h
浏览文件 @
a11a2f37
...
@@ -20,12 +20,12 @@
...
@@ -20,12 +20,12 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
#include "tcommon.h"
#include "parser.h"
#include "parser.h"
#include "query.h"
#include "query.h"
#include "taos.h"
#include "taos.h"
#include "tcommon.h"
#include "tdatablock.h"
#include "tdef.h"
#include "tdef.h"
#include "tep.h"
#include "thash.h"
#include "thash.h"
#include "tlist.h"
#include "tlist.h"
#include "tmsg.h"
#include "tmsg.h"
...
@@ -47,12 +47,12 @@ extern "C" {
...
@@ -47,12 +47,12 @@ extern "C" {
typedef
struct
SAppInstInfo
SAppInstInfo
;
typedef
struct
SAppInstInfo
SAppInstInfo
;
typedef
struct
SHbConnInfo
{
typedef
struct
{
void
*
param
;
void
*
param
;
SClientHbReq
*
req
;
SClientHbReq
*
req
;
}
SHbConnInfo
;
}
SHbConnInfo
;
typedef
struct
SAppHbMgr
{
typedef
struct
{
char
*
key
;
char
*
key
;
// statistics
// statistics
int32_t
reportCnt
;
int32_t
reportCnt
;
...
@@ -68,11 +68,11 @@ typedef struct SAppHbMgr {
...
@@ -68,11 +68,11 @@ typedef struct SAppHbMgr {
SHashObj
*
connInfo
;
// hash<SClientHbKey, SHbConnInfo>
SHashObj
*
connInfo
;
// hash<SClientHbKey, SHbConnInfo>
}
SAppHbMgr
;
}
SAppHbMgr
;
typedef
int32_t
(
*
FHbRspHandle
)(
struct
SAppHbMgr
*
pAppHbMgr
,
SClientHbRsp
*
pRsp
);
typedef
int32_t
(
*
FHbRspHandle
)(
SAppHbMgr
*
pAppHbMgr
,
SClientHbRsp
*
pRsp
);
typedef
int32_t
(
*
FHbReqHandle
)(
SClientHbKey
*
connKey
,
void
*
param
,
SClientHbReq
*
req
);
typedef
int32_t
(
*
FHbReqHandle
)(
SClientHbKey
*
connKey
,
void
*
param
,
SClientHbReq
*
req
);
typedef
struct
SClientHbMgr
{
typedef
struct
{
int8_t
inited
;
int8_t
inited
;
// ctl
// ctl
int8_t
threadStop
;
int8_t
threadStop
;
...
@@ -114,7 +114,7 @@ struct SAppInstInfo {
...
@@ -114,7 +114,7 @@ struct SAppInstInfo {
SList
*
pConnList
;
// STscObj linked list
SList
*
pConnList
;
// STscObj linked list
int64_t
clusterId
;
int64_t
clusterId
;
void
*
pTransporter
;
void
*
pTransporter
;
struct
SAppHbMgr
*
pAppHbMgr
;
SAppHbMgr
*
pAppHbMgr
;
};
};
typedef
struct
SAppInfo
{
typedef
struct
SAppInfo
{
...
@@ -141,10 +141,6 @@ typedef struct STscObj {
...
@@ -141,10 +141,6 @@ typedef struct STscObj {
SAppInstInfo
*
pAppInfo
;
SAppInstInfo
*
pAppInfo
;
}
STscObj
;
}
STscObj
;
typedef
struct
SMqConsumer
{
STscObj
*
pTscObj
;
}
SMqConsumer
;
typedef
struct
SReqResultInfo
{
typedef
struct
SReqResultInfo
{
const
char
*
pRspMsg
;
const
char
*
pRspMsg
;
const
char
*
pData
;
const
char
*
pData
;
...
...
source/client/src/clientHb.c
浏览文件 @
a11a2f37
...
@@ -23,7 +23,7 @@ static SClientHbMgr clientHbMgr = {0};
...
@@ -23,7 +23,7 @@ static SClientHbMgr clientHbMgr = {0};
static
int32_t
hbCreateThread
();
static
int32_t
hbCreateThread
();
static
void
hbStopThread
();
static
void
hbStopThread
();
static
int32_t
hbMqHbRspHandle
(
struct
SAppHbMgr
*
pAppHbMgr
,
SClientHbRsp
*
pRsp
)
{
return
0
;
}
static
int32_t
hbMqHbRspHandle
(
SAppHbMgr
*
pAppHbMgr
,
SClientHbRsp
*
pRsp
)
{
return
0
;
}
static
int32_t
hbProcessDBInfoRsp
(
void
*
value
,
int32_t
valueLen
,
struct
SCatalog
*
pCatalog
)
{
static
int32_t
hbProcessDBInfoRsp
(
void
*
value
,
int32_t
valueLen
,
struct
SCatalog
*
pCatalog
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
...
@@ -104,7 +104,7 @@ static int32_t hbProcessStbInfoRsp(void *value, int32_t valueLen, struct SCatalo
...
@@ -104,7 +104,7 @@ static int32_t hbProcessStbInfoRsp(void *value, int32_t valueLen, struct SCatalo
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
hbQueryHbRspHandle
(
struct
SAppHbMgr
*
pAppHbMgr
,
SClientHbRsp
*
pRsp
)
{
static
int32_t
hbQueryHbRspHandle
(
SAppHbMgr
*
pAppHbMgr
,
SClientHbRsp
*
pRsp
)
{
SHbConnInfo
*
info
=
taosHashGet
(
pAppHbMgr
->
connInfo
,
&
pRsp
->
connKey
,
sizeof
(
SClientHbKey
));
SHbConnInfo
*
info
=
taosHashGet
(
pAppHbMgr
->
connInfo
,
&
pRsp
->
connKey
,
sizeof
(
SClientHbKey
));
if
(
NULL
==
info
)
{
if
(
NULL
==
info
)
{
tscWarn
(
"fail to get connInfo, may be dropped, connId:%d, type:%d"
,
pRsp
->
connKey
.
connId
,
pRsp
->
connKey
.
hbType
);
tscWarn
(
"fail to get connInfo, may be dropped, connId:%d, type:%d"
,
pRsp
->
connKey
.
connId
,
pRsp
->
connKey
.
hbType
);
...
@@ -163,7 +163,7 @@ static int32_t hbQueryHbRspHandle(struct SAppHbMgr *pAppHbMgr, SClientHbRsp *pRs
...
@@ -163,7 +163,7 @@ static int32_t hbQueryHbRspHandle(struct SAppHbMgr *pAppHbMgr, SClientHbRsp *pRs
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
hb
Mq
AsyncCallBack
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
static
int32_t
hbAsyncCallBack
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
static
int32_t
emptyRspNum
=
0
;
static
int32_t
emptyRspNum
=
0
;
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
tfree
(
param
);
tfree
(
param
);
...
@@ -226,7 +226,11 @@ int32_t hbGetExpiredDBInfo(SClientHbKey *connKey, struct SCatalog *pCatalog, SCl
...
@@ -226,7 +226,11 @@ int32_t hbGetExpiredDBInfo(SClientHbKey *connKey, struct SCatalog *pCatalog, SCl
db
->
vgVersion
=
htonl
(
db
->
vgVersion
);
db
->
vgVersion
=
htonl
(
db
->
vgVersion
);
}
}
SKv
kv
=
{.
key
=
HEARTBEAT_KEY_DBINFO
,
.
valueLen
=
sizeof
(
SDbVgVersion
)
*
dbNum
,
.
value
=
dbs
};
SKv
kv
=
{
.
key
=
HEARTBEAT_KEY_DBINFO
,
.
valueLen
=
sizeof
(
SDbVgVersion
)
*
dbNum
,
.
value
=
dbs
,
};
tscDebug
(
"hb got %d expired db, valueLen:%d"
,
dbNum
,
kv
.
valueLen
);
tscDebug
(
"hb got %d expired db, valueLen:%d"
,
dbNum
,
kv
.
valueLen
);
...
@@ -256,7 +260,11 @@ int32_t hbGetExpiredStbInfo(SClientHbKey *connKey, struct SCatalog *pCatalog, SC
...
@@ -256,7 +260,11 @@ int32_t hbGetExpiredStbInfo(SClientHbKey *connKey, struct SCatalog *pCatalog, SC
stb
->
tversion
=
htons
(
stb
->
tversion
);
stb
->
tversion
=
htons
(
stb
->
tversion
);
}
}
SKv
kv
=
{.
key
=
HEARTBEAT_KEY_STBINFO
,
.
valueLen
=
sizeof
(
SSTableMetaVersion
)
*
stbNum
,
.
value
=
stbs
};
SKv
kv
=
{
.
key
=
HEARTBEAT_KEY_STBINFO
,
.
valueLen
=
sizeof
(
SSTableMetaVersion
)
*
stbNum
,
.
value
=
stbs
,
};
tscDebug
(
"hb got %d expired stb, valueLen:%d"
,
stbNum
,
kv
.
valueLen
);
tscDebug
(
"hb got %d expired stb, valueLen:%d"
,
stbNum
,
kv
.
valueLen
);
...
@@ -288,7 +296,7 @@ int32_t hbQueryHbReqHandle(SClientHbKey *connKey, void *param, SClientHbReq *req
...
@@ -288,7 +296,7 @@ int32_t hbQueryHbReqHandle(SClientHbKey *connKey, void *param, SClientHbReq *req
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
hbMqHbReqHandle
(
SClientHbKey
*
connKey
,
void
*
param
,
SClientHbReq
*
req
)
{}
int32_t
hbMqHbReqHandle
(
SClientHbKey
*
connKey
,
void
*
param
,
SClientHbReq
*
req
)
{
return
0
;
}
void
hbMgrInitMqHbHandle
()
{
void
hbMgrInitMqHbHandle
()
{
clientHbMgr
.
reqHandle
[
HEARTBEAT_TYPE_QUERY
]
=
hbQueryHbReqHandle
;
clientHbMgr
.
reqHandle
[
HEARTBEAT_TYPE_QUERY
]
=
hbQueryHbReqHandle
;
...
@@ -396,7 +404,7 @@ static void *hbThreadFunc(void *param) {
...
@@ -396,7 +404,7 @@ static void *hbThreadFunc(void *param) {
free
(
buf
);
free
(
buf
);
break
;
break
;
}
}
pInfo
->
fp
=
hb
Mq
AsyncCallBack
;
pInfo
->
fp
=
hbAsyncCallBack
;
pInfo
->
msgInfo
.
pData
=
buf
;
pInfo
->
msgInfo
.
pData
=
buf
;
pInfo
->
msgInfo
.
len
=
tlen
;
pInfo
->
msgInfo
.
len
=
tlen
;
pInfo
->
msgType
=
TDMT_MND_HEARTBEAT
;
pInfo
->
msgType
=
TDMT_MND_HEARTBEAT
;
...
@@ -448,7 +456,6 @@ static void hbStopThread() {
...
@@ -448,7 +456,6 @@ static void hbStopThread() {
}
}
SAppHbMgr
*
appHbMgrInit
(
SAppInstInfo
*
pAppInstInfo
,
char
*
key
)
{
SAppHbMgr
*
appHbMgrInit
(
SAppInstInfo
*
pAppInstInfo
,
char
*
key
)
{
/*return NULL;*/
hbMgrInit
();
hbMgrInit
();
SAppHbMgr
*
pAppHbMgr
=
malloc
(
sizeof
(
SAppHbMgr
));
SAppHbMgr
*
pAppHbMgr
=
malloc
(
sizeof
(
SAppHbMgr
));
if
(
pAppHbMgr
==
NULL
)
{
if
(
pAppHbMgr
==
NULL
)
{
...
@@ -507,7 +514,6 @@ void appHbMgrCleanup(void) {
...
@@ -507,7 +514,6 @@ void appHbMgrCleanup(void) {
}
}
int
hbMgrInit
()
{
int
hbMgrInit
()
{
/*return 0;*/
// init once
// init once
int8_t
old
=
atomic_val_compare_exchange_8
(
&
clientHbMgr
.
inited
,
0
,
1
);
int8_t
old
=
atomic_val_compare_exchange_8
(
&
clientHbMgr
.
inited
,
0
,
1
);
if
(
old
==
1
)
return
0
;
if
(
old
==
1
)
return
0
;
...
@@ -525,7 +531,7 @@ int hbMgrInit() {
...
@@ -525,7 +531,7 @@ int hbMgrInit() {
}
}
void
hbMgrCleanUp
()
{
void
hbMgrCleanUp
()
{
return
;
#if 0
hbStopThread();
hbStopThread();
// destroy all appHbMgr
// destroy all appHbMgr
...
@@ -538,6 +544,7 @@ void hbMgrCleanUp() {
...
@@ -538,6 +544,7 @@ void hbMgrCleanUp() {
pthread_mutex_unlock(&clientHbMgr.lock);
pthread_mutex_unlock(&clientHbMgr.lock);
clientHbMgr.appHbMgrs = NULL;
clientHbMgr.appHbMgrs = NULL;
#endif
}
}
int
hbRegisterConnImpl
(
SAppHbMgr
*
pAppHbMgr
,
SClientHbKey
connKey
,
SHbConnInfo
*
info
)
{
int
hbRegisterConnImpl
(
SAppHbMgr
*
pAppHbMgr
,
SClientHbKey
connKey
,
SHbConnInfo
*
info
)
{
...
@@ -564,8 +571,10 @@ int hbRegisterConnImpl(SAppHbMgr *pAppHbMgr, SClientHbKey connKey, SHbConnInfo *
...
@@ -564,8 +571,10 @@ int hbRegisterConnImpl(SAppHbMgr *pAppHbMgr, SClientHbKey connKey, SHbConnInfo *
}
}
int
hbRegisterConn
(
SAppHbMgr
*
pAppHbMgr
,
int32_t
connId
,
int64_t
clusterId
,
int32_t
hbType
)
{
int
hbRegisterConn
(
SAppHbMgr
*
pAppHbMgr
,
int32_t
connId
,
int64_t
clusterId
,
int32_t
hbType
)
{
/*return 0;*/
SClientHbKey
connKey
=
{
SClientHbKey
connKey
=
{.
connId
=
connId
,
.
hbType
=
HEARTBEAT_TYPE_QUERY
};
.
connId
=
connId
,
.
hbType
=
HEARTBEAT_TYPE_QUERY
,
};
SHbConnInfo
info
=
{
0
};
SHbConnInfo
info
=
{
0
};
switch
(
hbType
)
{
switch
(
hbType
)
{
...
@@ -587,7 +596,6 @@ int hbRegisterConn(SAppHbMgr *pAppHbMgr, int32_t connId, int64_t clusterId, int3
...
@@ -587,7 +596,6 @@ int hbRegisterConn(SAppHbMgr *pAppHbMgr, int32_t connId, int64_t clusterId, int3
}
}
void
hbDeregisterConn
(
SAppHbMgr
*
pAppHbMgr
,
SClientHbKey
connKey
)
{
void
hbDeregisterConn
(
SAppHbMgr
*
pAppHbMgr
,
SClientHbKey
connKey
)
{
/*return;*/
int32_t
code
=
0
;
int32_t
code
=
0
;
code
=
taosHashRemove
(
pAppHbMgr
->
activeInfo
,
&
connKey
,
sizeof
(
SClientHbKey
));
code
=
taosHashRemove
(
pAppHbMgr
->
activeInfo
,
&
connKey
,
sizeof
(
SClientHbKey
));
code
=
taosHashRemove
(
pAppHbMgr
->
connInfo
,
&
connKey
,
sizeof
(
SClientHbKey
));
code
=
taosHashRemove
(
pAppHbMgr
->
connInfo
,
&
connKey
,
sizeof
(
SClientHbKey
));
...
@@ -599,7 +607,6 @@ void hbDeregisterConn(SAppHbMgr *pAppHbMgr, SClientHbKey connKey) {
...
@@ -599,7 +607,6 @@ void hbDeregisterConn(SAppHbMgr *pAppHbMgr, SClientHbKey connKey) {
int
hbAddConnInfo
(
SAppHbMgr
*
pAppHbMgr
,
SClientHbKey
connKey
,
void
*
key
,
void
*
value
,
int32_t
keyLen
,
int
hbAddConnInfo
(
SAppHbMgr
*
pAppHbMgr
,
SClientHbKey
connKey
,
void
*
key
,
void
*
value
,
int32_t
keyLen
,
int32_t
valueLen
)
{
int32_t
valueLen
)
{
return
0
;
// find req by connection id
// find req by connection id
SClientHbReq
*
pReq
=
taosHashGet
(
pAppHbMgr
->
activeInfo
,
&
connKey
,
sizeof
(
SClientHbKey
));
SClientHbReq
*
pReq
=
taosHashGet
(
pAppHbMgr
->
activeInfo
,
&
connKey
,
sizeof
(
SClientHbKey
));
ASSERT
(
pReq
!=
NULL
);
ASSERT
(
pReq
!=
NULL
);
...
...
source/client/src/clientImpl.c
浏览文件 @
a11a2f37
...
@@ -4,8 +4,8 @@
...
@@ -4,8 +4,8 @@
#include "parser.h"
#include "parser.h"
#include "planner.h"
#include "planner.h"
#include "scheduler.h"
#include "scheduler.h"
#include "tdatablock.h"
#include "tdef.h"
#include "tdef.h"
#include "tep.h"
#include "tglobal.h"
#include "tglobal.h"
#include "tmsgtype.h"
#include "tmsgtype.h"
#include "tpagedbuf.h"
#include "tpagedbuf.h"
...
...
source/client/src/tmq.c
浏览文件 @
a11a2f37
...
@@ -20,8 +20,8 @@
...
@@ -20,8 +20,8 @@
#include "parser.h"
#include "parser.h"
#include "planner.h"
#include "planner.h"
#include "scheduler.h"
#include "scheduler.h"
#include "tdatablock.h"
#include "tdef.h"
#include "tdef.h"
#include "tep.h"
#include "tglobal.h"
#include "tglobal.h"
#include "tmsgtype.h"
#include "tmsgtype.h"
#include "tpagedbuf.h"
#include "tpagedbuf.h"
...
@@ -59,6 +59,7 @@ struct tmq_t {
...
@@ -59,6 +59,7 @@ struct tmq_t {
char
groupId
[
256
];
char
groupId
[
256
];
char
clientId
[
256
];
char
clientId
[
256
];
int8_t
autoCommit
;
int8_t
autoCommit
;
int8_t
inWaiting
;
int64_t
consumerId
;
int64_t
consumerId
;
int32_t
epoch
;
int32_t
epoch
;
int32_t
resetOffsetCfg
;
int32_t
resetOffsetCfg
;
...
@@ -66,9 +67,12 @@ struct tmq_t {
...
@@ -66,9 +67,12 @@ struct tmq_t {
STscObj
*
pTscObj
;
STscObj
*
pTscObj
;
tmq_commit_cb
*
commit_cb
;
tmq_commit_cb
*
commit_cb
;
int32_t
nextTopicIdx
;
int32_t
nextTopicIdx
;
int32_t
waitingRequest
;
int32_t
readyRequest
;
SArray
*
clientTopics
;
// SArray<SMqClientTopic>
SArray
*
clientTopics
;
// SArray<SMqClientTopic>
STaosQueue
*
mqueue
;
// queue of tmq_message_t
STaosQueue
*
mqueue
;
// queue of tmq_message_t
STaosQall
*
qall
;
STaosQall
*
qall
;
tsem_t
rspSem
;
// stat
// stat
int64_t
pollCnt
;
int64_t
pollCnt
;
};
};
...
@@ -121,6 +125,8 @@ typedef struct {
...
@@ -121,6 +125,8 @@ typedef struct {
SMqClientVg
*
pVg
;
SMqClientVg
*
pVg
;
int32_t
epoch
;
int32_t
epoch
;
tsem_t
rspSem
;
tsem_t
rspSem
;
tmq_message_t
**
msg
;
int32_t
sync
;
}
SMqPollCbParam
;
}
SMqPollCbParam
;
typedef
struct
{
typedef
struct
{
...
@@ -196,6 +202,26 @@ int32_t tmq_list_append(tmq_list_t* ptr, const char* src) {
...
@@ -196,6 +202,26 @@ int32_t tmq_list_append(tmq_list_t* ptr, const char* src) {
return
0
;
return
0
;
}
}
void
tmqClearUnhandleMsg
(
tmq_t
*
tmq
)
{
tmq_message_t
*
msg
;
while
(
1
)
{
taosGetQitem
(
tmq
->
qall
,
(
void
**
)
&
msg
);
if
(
msg
)
taosFreeQitem
(
msg
);
else
break
;
}
taosReadAllQitems
(
tmq
->
mqueue
,
tmq
->
qall
);
while
(
1
)
{
taosGetQitem
(
tmq
->
qall
,
(
void
**
)
&
msg
);
if
(
msg
)
taosFreeQitem
(
msg
);
else
break
;
}
}
int32_t
tmqSubscribeCb
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
int32_t
tmqSubscribeCb
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
SMqSubscribeCbParam
*
pParam
=
(
SMqSubscribeCbParam
*
)
param
;
SMqSubscribeCbParam
*
pParam
=
(
SMqSubscribeCbParam
*
)
param
;
pParam
->
rspErr
=
code
;
pParam
->
rspErr
=
code
;
...
@@ -205,16 +231,11 @@ int32_t tmqSubscribeCb(void* param, const SDataBuf* pMsg, int32_t code) {
...
@@ -205,16 +231,11 @@ int32_t tmqSubscribeCb(void* param, const SDataBuf* pMsg, int32_t code) {
int32_t
tmqCommitCb
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
int32_t
tmqCommitCb
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
SMqCommitCbParam
*
pParam
=
(
SMqCommitCbParam
*
)
param
;
SMqCommitCbParam
*
pParam
=
(
SMqCommitCbParam
*
)
param
;
tmq_resp_err_t
rspErr
=
code
==
0
?
TMQ_RESP_ERR__SUCCESS
:
TMQ_RESP_ERR__FAIL
;
pParam
->
rspErr
=
code
==
0
?
TMQ_RESP_ERR__SUCCESS
:
TMQ_RESP_ERR__FAIL
;
if
(
pParam
->
tmq
->
commit_cb
)
{
if
(
pParam
->
tmq
->
commit_cb
)
{
pParam
->
tmq
->
commit_cb
(
pParam
->
tmq
,
rspErr
,
NULL
,
NULL
);
pParam
->
tmq
->
commit_cb
(
pParam
->
tmq
,
pParam
->
rspErr
,
NULL
,
NULL
);
}
if
(
!
pParam
->
async
)
tsem_post
(
&
pParam
->
rspSem
);
else
{
tsem_destroy
(
&
pParam
->
rspSem
);
free
(
param
);
}
}
if
(
!
pParam
->
async
)
tsem_post
(
&
pParam
->
rspSem
);
return
0
;
return
0
;
}
}
...
@@ -240,9 +261,12 @@ tmq_t* tmq_consumer_new(void* conn, tmq_conf_t* conf, char* errstr, int32_t errs
...
@@ -240,9 +261,12 @@ tmq_t* tmq_consumer_new(void* conn, tmq_conf_t* conf, char* errstr, int32_t errs
return
NULL
;
return
NULL
;
}
}
pTmq
->
pTscObj
=
(
STscObj
*
)
conn
;
pTmq
->
pTscObj
=
(
STscObj
*
)
conn
;
pTmq
->
inWaiting
=
0
;
pTmq
->
status
=
0
;
pTmq
->
status
=
0
;
pTmq
->
pollCnt
=
0
;
pTmq
->
pollCnt
=
0
;
pTmq
->
epoch
=
0
;
pTmq
->
epoch
=
0
;
pTmq
->
waitingRequest
=
0
;
pTmq
->
readyRequest
=
0
;
// set conf
// set conf
strcpy
(
pTmq
->
clientId
,
conf
->
clientId
);
strcpy
(
pTmq
->
clientId
,
conf
->
clientId
);
strcpy
(
pTmq
->
groupId
,
conf
->
groupId
);
strcpy
(
pTmq
->
groupId
,
conf
->
groupId
);
...
@@ -250,6 +274,8 @@ tmq_t* tmq_consumer_new(void* conn, tmq_conf_t* conf, char* errstr, int32_t errs
...
@@ -250,6 +274,8 @@ tmq_t* tmq_consumer_new(void* conn, tmq_conf_t* conf, char* errstr, int32_t errs
pTmq
->
commit_cb
=
conf
->
commit_cb
;
pTmq
->
commit_cb
=
conf
->
commit_cb
;
pTmq
->
resetOffsetCfg
=
conf
->
resetOffset
;
pTmq
->
resetOffsetCfg
=
conf
->
resetOffset
;
tsem_init
(
&
pTmq
->
rspSem
,
0
,
0
);
pTmq
->
consumerId
=
generateRequestId
()
&
(((
uint64_t
)
-
1
)
>>
1
);
pTmq
->
consumerId
=
generateRequestId
()
&
(((
uint64_t
)
-
1
)
>>
1
);
pTmq
->
clientTopics
=
taosArrayInit
(
0
,
sizeof
(
SMqClientTopic
));
pTmq
->
clientTopics
=
taosArrayInit
(
0
,
sizeof
(
SMqClientTopic
));
...
@@ -315,6 +341,7 @@ tmq_resp_err_t tmq_commit(tmq_t* tmq, const tmq_topic_vgroup_list_t* offsets, in
...
@@ -315,6 +341,7 @@ tmq_resp_err_t tmq_commit(tmq_t* tmq, const tmq_topic_vgroup_list_t* offsets, in
}
}
pParam
->
tmq
=
tmq
;
pParam
->
tmq
=
tmq
;
tsem_init
(
&
pParam
->
rspSem
,
0
,
0
);
tsem_init
(
&
pParam
->
rspSem
,
0
,
0
);
pParam
->
async
=
async
;
pRequest
->
body
.
requestMsg
=
(
SDataBuf
){
pRequest
->
body
.
requestMsg
=
(
SDataBuf
){
.
pData
=
buf
,
.
pData
=
buf
,
...
@@ -335,6 +362,9 @@ tmq_resp_err_t tmq_commit(tmq_t* tmq, const tmq_topic_vgroup_list_t* offsets, in
...
@@ -335,6 +362,9 @@ tmq_resp_err_t tmq_commit(tmq_t* tmq, const tmq_topic_vgroup_list_t* offsets, in
resp
=
pParam
->
rspErr
;
resp
=
pParam
->
rspErr
;
}
}
tsem_destroy
(
&
pParam
->
rspSem
);
free
(
pParam
);
if
(
pArray
)
{
if
(
pArray
)
{
taosArrayDestroy
(
pArray
);
taosArrayDestroy
(
pArray
);
}
}
...
@@ -576,7 +606,7 @@ static char* formatTimestamp(char* buf, int64_t val, int precision) {
...
@@ -576,7 +606,7 @@ static char* formatTimestamp(char* buf, int64_t val, int precision) {
int32_t
tmqGetSkipLogNum
(
tmq_message_t
*
tmq_message
)
{
int32_t
tmqGetSkipLogNum
(
tmq_message_t
*
tmq_message
)
{
if
(
tmq_message
==
NULL
)
return
0
;
if
(
tmq_message
==
NULL
)
return
0
;
SMqConsumeRsp
*
pRsp
=
(
SMqConsumeRsp
*
)
tmq_message
;
SMqConsumeRsp
*
pRsp
=
&
tmq_message
->
consumeRsp
;
return
pRsp
->
skipLogNum
;
return
pRsp
->
skipLogNum
;
}
}
...
@@ -625,56 +655,74 @@ void tmqShowMsg(tmq_message_t* tmq_message) {
...
@@ -625,56 +655,74 @@ void tmqShowMsg(tmq_message_t* tmq_message) {
}
}
int32_t
tmqPollCb
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
int32_t
tmqPollCb
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
printf
(
"recv poll
\n
"
);
/*printf("recv poll\n");*/
SMqPollCbParam
*
pParam
=
(
SMqPollCbParam
*
)
param
;
SMqPollCbParam
*
pParam
=
(
SMqPollCbParam
*
)
param
;
SMqClientVg
*
pVg
=
pParam
->
pVg
;
SMqClientVg
*
pVg
=
pParam
->
pVg
;
tmq_t
*
tmq
=
pParam
->
tmq
;
tmq_t
*
tmq
=
pParam
->
tmq
;
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
printf
(
"msg discard
\n
"
);
printf
(
"msg discard
\n
"
);
if
(
pParam
->
epoch
==
tmq
->
epoch
)
{
goto
WRITE_QUEUE_FAIL
;
atomic_store_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
);
}
return
0
;
}
}
int32_t
msgEpoch
=
((
SMqRspHead
*
)
pMsg
->
pData
)
->
epoch
;
int32_t
msgEpoch
=
((
SMqRspHead
*
)
pMsg
->
pData
)
->
epoch
;
int32_t
tmqEpoch
=
atomic_load_32
(
&
tmq
->
epoch
);
int32_t
tmqEpoch
=
atomic_load_32
(
&
tmq
->
epoch
);
if
(
msgEpoch
<
tmqEpoch
)
{
if
(
msgEpoch
<
tmqEpoch
)
{
tsem_post
(
&
tmq
->
rspSem
);
printf
(
"discard rsp epoch %d, current epoch %d
\n
"
,
msgEpoch
,
tmqEpoch
);
printf
(
"discard rsp epoch %d, current epoch %d
\n
"
,
msgEpoch
,
tmqEpoch
);
return
0
;
return
0
;
}
}
if
(
msgEpoch
!=
tmqEpoch
)
{
if
(
msgEpoch
!=
tmqEpoch
)
{
printf
(
"mismatch rsp epoch %d, current epoch %d
\n
"
,
msgEpoch
,
tmqEpoch
);
printf
(
"mismatch rsp epoch %d, current epoch %d
\n
"
,
msgEpoch
,
tmqEpoch
);
}
else
{
atomic_sub_fetch_32
(
&
tmq
->
waitingRequest
,
1
);
}
#if 0
if (pParam->sync == 1) {
/**pParam->msg = malloc(sizeof(tmq_message_t));*/
*pParam->msg = taosAllocateQitem(sizeof(tmq_message_t));
if (*pParam->msg) {
memcpy(*pParam->msg, pMsg->pData, sizeof(SMqRspHead));
tDecodeSMqConsumeRsp(POINTER_SHIFT(pMsg->pData, sizeof(SMqRspHead)), &((*pParam->msg)->consumeRsp));
if ((*pParam->msg)->consumeRsp.numOfTopics != 0) {
pVg->currentOffset = (*pParam->msg)->consumeRsp.rspOffset;
}
taosWriteQitem(tmq->mqueue, *pParam->msg);
tsem_post(&pParam->rspSem);
return 0;
}
tsem_post(&pParam->rspSem);
return -1;
}
}
#endif
/*SMqConsumeRsp* pRsp = calloc(1, sizeof(SMqConsumeRsp));*/
/*SMqConsumeRsp* pRsp = calloc(1, sizeof(SMqConsumeRsp));*/
tmq_message_t
*
pRsp
=
taosAllocateQitem
(
sizeof
(
tmq_message_t
));
tmq_message_t
*
pRsp
=
taosAllocateQitem
(
sizeof
(
tmq_message_t
));
if
(
pRsp
==
NULL
)
{
if
(
pRsp
==
NULL
)
{
printf
(
"fail
\n
"
);
goto
WRITE_QUEUE_FAIL
;
return
-
1
;
}
}
memcpy
(
pRsp
,
pMsg
->
pData
,
sizeof
(
SMqRspHead
));
memcpy
(
pRsp
,
pMsg
->
pData
,
sizeof
(
SMqRspHead
));
tDecodeSMqConsumeRsp
(
POINTER_SHIFT
(
pMsg
->
pData
,
sizeof
(
SMqRspHead
)),
&
pRsp
->
consumeRsp
);
tDecodeSMqConsumeRsp
(
POINTER_SHIFT
(
pMsg
->
pData
,
sizeof
(
SMqRspHead
)),
&
pRsp
->
consumeRsp
);
/*printf("rsp commit off:%ld rsp off:%ld has data:%d\n", pRsp->committedOffset, pRsp->rspOffset, pRsp->numOfTopics);*/
/*printf("rsp commit off:%ld rsp off:%ld has data:%d\n", pRsp->committedOffset, pRsp->rspOffset, pRsp->numOfTopics);*/
if
(
pRsp
->
consumeRsp
.
numOfTopics
==
0
)
{
if
(
pRsp
->
consumeRsp
.
numOfTopics
==
0
)
{
printf
(
"no data
\n
"
);
/*printf("no data\n");*/
if
(
pParam
->
epoch
==
tmq
->
epoch
)
{
atomic_store_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
);
}
taosFreeQitem
(
pRsp
);
taosFreeQitem
(
pRsp
);
return
0
;
goto
WRITE_QUEUE_FAIL
;
}
}
pRsp
->
extra
=
pParam
->
pVg
;
pRsp
->
extra
=
pParam
->
pVg
;
taosWriteQitem
(
tmq
->
mqueue
,
pRsp
);
taosWriteQitem
(
tmq
->
mqueue
,
pRsp
);
printf
(
"poll in queue
\n
"
);
atomic_add_fetch_32
(
&
tmq
->
readyRequest
,
1
);
/*pParam->rspMsg = (tmq_message_t*)pRsp;*/
tsem_post
(
&
tmq
->
rspSem
);
/*pVg->currentOffset = pRsp->consumeRsp.rspOffset;*/
/*printf("rsp offset: %ld\n", rsp.rspOffset);*/
/*printf("-----msg begin----\n");*/
/*printf("\n-----msg end------\n");*/
return
0
;
return
0
;
WRITE_QUEUE_FAIL:
if
(
pParam
->
epoch
==
tmq
->
epoch
)
{
atomic_store_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
);
}
tsem_post
(
&
tmq
->
rspSem
);
return
code
;
}
}
bool
tmqUpdateEp
(
tmq_t
*
tmq
,
int32_t
epoch
,
SMqCMGetSubEpRsp
*
pRsp
)
{
bool
tmqUpdateEp
(
tmq_t
*
tmq
,
int32_t
epoch
,
SMqCMGetSubEpRsp
*
pRsp
)
{
...
@@ -711,81 +759,94 @@ int32_t tmqAskEpCb(void* param, const SDataBuf* pMsg, int32_t code) {
...
@@ -711,81 +759,94 @@ int32_t tmqAskEpCb(void* param, const SDataBuf* pMsg, int32_t code) {
tmq_t
*
tmq
=
pParam
->
tmq
;
tmq_t
*
tmq
=
pParam
->
tmq
;
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
printf
(
"get topic endpoint error, not ready, wait:%d
\n
"
,
pParam
->
sync
);
printf
(
"get topic endpoint error, not ready, wait:%d
\n
"
,
pParam
->
sync
);
if
(
pParam
->
sync
)
{
goto
END
;
tsem_post
(
&
pParam
->
rspSem
);
}
}
return
0
;
// tmq's epoch is monotomically increase,
// so it's safe to discard any old epoch msg.
// epoch will only increase when received newer epoch ep msg
SMqRspHead
*
head
=
pMsg
->
pData
;
int32_t
epoch
=
atomic_load_32
(
&
tmq
->
epoch
);
if
(
head
->
epoch
<=
epoch
)
{
goto
END
;
}
}
tscDebug
(
"tmq ask ep cb called"
);
if
(
pParam
->
sync
)
{
if
(
pParam
->
sync
)
{
SMqRspHead
*
head
=
pMsg
->
pData
;
SMqCMGetSubEpRsp
rsp
;
SMqCMGetSubEpRsp
rsp
;
tDecodeSMqCMGetSubEpRsp
(
POINTER_SHIFT
(
pMsg
->
pData
,
sizeof
(
SMqRspHead
)),
&
rsp
);
tDecodeSMqCMGetSubEpRsp
(
POINTER_SHIFT
(
pMsg
->
pData
,
sizeof
(
SMqRspHead
)),
&
rsp
);
/*printf("rsp epoch %ld sz %ld\n", rsp.epoch, rsp.topics->size);*/
/*printf("rsp epoch %ld sz %ld\n", rsp.epoch, rsp.topics->size);*/
/*printf("tmq epoch %ld sz %ld\n", tmq->epoch, tmq->clientTopics->size);*/
/*printf("tmq epoch %ld sz %ld\n", tmq->epoch, tmq->clientTopics->size);*/
int32_t
epoch
=
atomic_load_32
(
&
tmq
->
epoch
);
if
(
tmqUpdateEp
(
tmq
,
head
->
epoch
,
&
rsp
))
{
if
(
head
->
epoch
>
epoch
&&
tmqUpdateEp
(
tmq
,
head
->
epoch
,
&
rsp
))
{
atomic_store_64
(
&
tmq
->
status
,
TMQ_CONSUMER_STATUS__READY
);
atomic_store_64
(
&
tmq
->
status
,
TMQ_CONSUMER_STATUS__READY
);
}
}
tsem_post
(
&
pParam
->
rspSem
);
tDeleteSMqCMGetSubEpRsp
(
&
rsp
);
tDeleteSMqCMGetSubEpRsp
(
&
rsp
);
}
else
{
}
else
{
tmq_message_t
*
pRsp
=
taosAllocateQitem
(
sizeof
(
tmq_message_t
));
tmq_message_t
*
pRsp
=
taosAllocateQitem
(
sizeof
(
tmq_message_t
));
if
(
pRsp
==
NULL
)
{
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
code
=
-
1
;
goto
END
;
}
}
memcpy
(
pRsp
,
pMsg
->
pData
,
sizeof
(
SMqRspHead
));
memcpy
(
pRsp
,
pMsg
->
pData
,
sizeof
(
SMqRspHead
));
tDecodeSMqCMGetSubEpRsp
(
POINTER_SHIFT
(
pMsg
->
pData
,
sizeof
(
SMqRspHead
)),
&
pRsp
->
getEpRsp
);
tDecodeSMqCMGetSubEpRsp
(
POINTER_SHIFT
(
pMsg
->
pData
,
sizeof
(
SMqRspHead
)),
&
pRsp
->
getEpRsp
);
taosWriteQitem
(
tmq
->
mqueue
,
pRsp
);
taosWriteQitem
(
tmq
->
mqueue
,
pRsp
);
tsem_post
(
&
tmq
->
rspSem
);
}
}
return
0
;
END:
if
(
pParam
->
sync
)
{
tsem_post
(
&
pParam
->
rspSem
);
}
return
code
;
}
}
int32_t
tmqAskEp
(
tmq_t
*
tmq
,
bool
sync
)
{
int32_t
tmqAskEp
(
tmq_t
*
tmq
,
bool
sync
)
{
printf
(
"ask ep sync %d
\n
"
,
sync
);
int32_t
tlen
=
sizeof
(
SMqCMGetSubEpReq
);
int32_t
tlen
=
sizeof
(
SMqCMGetSubEpReq
);
SMqCMGetSubEpReq
*
buf
=
malloc
(
tlen
);
SMqCMGetSubEpReq
*
req
=
malloc
(
tlen
);
if
(
buf
==
NULL
)
{
if
(
req
==
NULL
)
{
tscError
(
"failed to malloc get subscribe ep buf"
);
tscError
(
"failed to malloc get subscribe ep buf"
);
goto
END
;
return
-
1
;
}
buf
->
consumerId
=
htobe64
(
tmq
->
consumerId
);
buf
->
epoch
=
htonl
(
tmq
->
epoch
);
strcpy
(
buf
->
cgroup
,
tmq
->
groupId
);
SRequestObj
*
pRequest
=
createRequest
(
tmq
->
pTscObj
,
NULL
,
NULL
,
TDMT_MND_GET_SUB_EP
);
if
(
pRequest
==
NULL
)
{
tscError
(
"failed to malloc subscribe ep request"
);
goto
END
;
}
}
req
->
consumerId
=
htobe64
(
tmq
->
consumerId
);
pRequest
->
body
.
requestMsg
=
(
SDataBuf
){
req
->
epoch
=
htonl
(
tmq
->
epoch
);
.
pData
=
buf
,
strcpy
(
req
->
cgroup
,
tmq
->
groupId
);
.
len
=
tlen
,
.
handle
=
NULL
,
};
SMqAskEpCbParam
*
pParam
=
malloc
(
sizeof
(
SMqAskEpCbParam
));
SMqAskEpCbParam
*
pParam
=
malloc
(
sizeof
(
SMqAskEpCbParam
));
if
(
pParam
==
NULL
)
{
if
(
pParam
==
NULL
)
{
tscError
(
"failed to malloc subscribe param"
);
tscError
(
"failed to malloc subscribe param"
);
goto
END
;
free
(
req
);
return
-
1
;
}
}
pParam
->
tmq
=
tmq
;
pParam
->
tmq
=
tmq
;
pParam
->
sync
=
sync
;
pParam
->
sync
=
sync
;
tsem_init
(
&
pParam
->
rspSem
,
0
,
0
);
tsem_init
(
&
pParam
->
rspSem
,
0
,
0
);
SMsgSendInfo
*
sendInfo
=
buildMsgInfoImpl
(
pRequest
);
SMsgSendInfo
*
sendInfo
=
malloc
(
sizeof
(
SMsgSendInfo
));
if
(
sendInfo
==
NULL
)
{
tsem_destroy
(
&
pParam
->
rspSem
);
free
(
pParam
);
free
(
req
);
return
-
1
;
}
sendInfo
->
msgInfo
=
(
SDataBuf
){
.
pData
=
req
,
.
len
=
tlen
,
.
handle
=
NULL
,
};
sendInfo
->
requestId
=
generateRequestId
();
sendInfo
->
requestObjRefId
=
0
;
sendInfo
->
requestObjRefId
=
0
;
sendInfo
->
param
=
pParam
;
sendInfo
->
param
=
pParam
;
sendInfo
->
fp
=
tmqAskEpCb
;
sendInfo
->
fp
=
tmqAskEpCb
;
sendInfo
->
msgType
=
TDMT_MND_GET_SUB_EP
;
SEpSet
epSet
=
getEpSet_s
(
&
tmq
->
pTscObj
->
pAppInfo
->
mgmtEp
);
SEpSet
epSet
=
getEpSet_s
(
&
tmq
->
pTscObj
->
pAppInfo
->
mgmtEp
);
int64_t
transporterId
=
0
;
int64_t
transporterId
=
0
;
asyncSendMsgToServer
(
tmq
->
pTscObj
->
pAppInfo
->
pTransporter
,
&
epSet
,
&
transporterId
,
sendInfo
);
asyncSendMsgToServer
(
tmq
->
pTscObj
->
pAppInfo
->
pTransporter
,
&
epSet
,
&
transporterId
,
sendInfo
);
END:
if
(
sync
)
tsem_wait
(
&
pParam
->
rspSem
);
if
(
sync
)
tsem_wait
(
&
pParam
->
rspSem
);
return
0
;
return
0
;
}
}
...
@@ -804,6 +865,7 @@ tmq_resp_err_t tmq_seek(tmq_t* tmq, const tmq_topic_vgroup_t* offset) {
...
@@ -804,6 +865,7 @@ tmq_resp_err_t tmq_seek(tmq_t* tmq, const tmq_topic_vgroup_t* offset) {
SMqClientVg
*
pVg
=
taosArrayGet
(
clientTopic
->
vgs
,
j
);
SMqClientVg
*
pVg
=
taosArrayGet
(
clientTopic
->
vgs
,
j
);
if
(
pVg
->
vgId
==
pOffset
->
vgId
)
{
if
(
pVg
->
vgId
==
pOffset
->
vgId
)
{
pVg
->
currentOffset
=
pOffset
->
offset
;
pVg
->
currentOffset
=
pOffset
->
offset
;
tmqClearUnhandleMsg
(
tmq
);
return
TMQ_RESP_ERR__SUCCESS
;
return
TMQ_RESP_ERR__SUCCESS
;
}
}
}
}
...
@@ -812,7 +874,7 @@ tmq_resp_err_t tmq_seek(tmq_t* tmq, const tmq_topic_vgroup_t* offset) {
...
@@ -812,7 +874,7 @@ tmq_resp_err_t tmq_seek(tmq_t* tmq, const tmq_topic_vgroup_t* offset) {
return
TMQ_RESP_ERR__FAIL
;
return
TMQ_RESP_ERR__FAIL
;
}
}
SMqConsumeReq
*
tmqBuildConsumeReqImpl
(
tmq_t
*
tmq
,
int64_t
blocking
_t
ime
,
SMqClientTopic
*
pTopic
,
SMqClientVg
*
pVg
)
{
SMqConsumeReq
*
tmqBuildConsumeReqImpl
(
tmq_t
*
tmq
,
int64_t
blocking
T
ime
,
SMqClientTopic
*
pTopic
,
SMqClientVg
*
pVg
)
{
int64_t
reqOffset
;
int64_t
reqOffset
;
if
(
pVg
->
currentOffset
>=
0
)
{
if
(
pVg
->
currentOffset
>=
0
)
{
reqOffset
=
pVg
->
currentOffset
;
reqOffset
=
pVg
->
currentOffset
;
...
@@ -832,7 +894,7 @@ SMqConsumeReq* tmqBuildConsumeReqImpl(tmq_t* tmq, int64_t blocking_time, SMqClie
...
@@ -832,7 +894,7 @@ SMqConsumeReq* tmqBuildConsumeReqImpl(tmq_t* tmq, int64_t blocking_time, SMqClie
strcpy
(
pReq
->
topic
,
pTopic
->
topicName
);
strcpy
(
pReq
->
topic
,
pTopic
->
topicName
);
strcpy
(
pReq
->
cgroup
,
tmq
->
groupId
);
strcpy
(
pReq
->
cgroup
,
tmq
->
groupId
);
pReq
->
blockingTime
=
blocking
_t
ime
;
pReq
->
blockingTime
=
blocking
T
ime
;
pReq
->
consumerId
=
tmq
->
consumerId
;
pReq
->
consumerId
=
tmq
->
consumerId
;
pReq
->
epoch
=
tmq
->
epoch
;
pReq
->
epoch
=
tmq
->
epoch
;
pReq
->
currentOffset
=
reqOffset
;
pReq
->
currentOffset
=
reqOffset
;
...
@@ -842,28 +904,76 @@ SMqConsumeReq* tmqBuildConsumeReqImpl(tmq_t* tmq, int64_t blocking_time, SMqClie
...
@@ -842,28 +904,76 @@ SMqConsumeReq* tmqBuildConsumeReqImpl(tmq_t* tmq, int64_t blocking_time, SMqClie
return
pReq
;
return
pReq
;
}
}
void
tmqClearUnhandleMsg
(
tmq_t
*
tmq
)
{
tmq_message_t
*
tmqSyncPollImpl
(
tmq_t
*
tmq
,
int64_t
blockingTime
)
{
tmq_message_t
*
msg
;
tmq_message_t
*
msg
=
NULL
;
while
(
1
)
{
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
tmq
->
clientTopics
);
i
++
)
{
taosGetQitem
(
tmq
->
qall
,
(
void
**
)
&
msg
);
SMqClientTopic
*
pTopic
=
taosArrayGet
(
tmq
->
clientTopics
,
i
);
if
(
msg
)
for
(
int
j
=
0
;
j
<
taosArrayGetSize
(
pTopic
->
vgs
);
j
++
)
{
taosFreeQitem
(
msg
);
SMqClientVg
*
pVg
=
taosArrayGet
(
pTopic
->
vgs
,
j
);
else
int32_t
vgStatus
=
atomic_val_compare_exchange_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
,
TMQ_VG_STATUS__WAIT
);
break
;
/*if (vgStatus != TMQ_VG_STATUS__IDLE) {*/
/*continue;*/
/*}*/
SMqConsumeReq
*
pReq
=
tmqBuildConsumeReqImpl
(
tmq
,
blockingTime
,
pTopic
,
pVg
);
if
(
pReq
==
NULL
)
{
atomic_store_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
);
// TODO: out of mem
return
NULL
;
}
}
taosReadAllQitems
(
tmq
->
mqueue
,
tmq
->
qall
);
SMqPollCbParam
*
pParam
=
malloc
(
sizeof
(
SMqPollCbParam
));
if
(
pParam
==
NULL
)
{
atomic_store_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
);
// TODO: out of mem
return
NULL
;
}
pParam
->
tmq
=
tmq
;
pParam
->
pVg
=
pVg
;
pParam
->
epoch
=
tmq
->
epoch
;
pParam
->
sync
=
1
;
pParam
->
msg
=
&
msg
;
tsem_init
(
&
pParam
->
rspSem
,
0
,
0
);
SMsgSendInfo
*
sendInfo
=
malloc
(
sizeof
(
SMsgSendInfo
));
if
(
sendInfo
==
NULL
)
{
return
NULL
;
}
sendInfo
->
msgInfo
=
(
SDataBuf
){
.
pData
=
pReq
,
.
len
=
sizeof
(
SMqConsumeReq
),
.
handle
=
NULL
,
};
sendInfo
->
requestId
=
generateRequestId
();
sendInfo
->
requestObjRefId
=
0
;
sendInfo
->
param
=
pParam
;
sendInfo
->
fp
=
tmqPollCb
;
sendInfo
->
msgType
=
TDMT_VND_CONSUME
;
int64_t
transporterId
=
0
;
/*printf("send poll\n");*/
atomic_add_fetch_32
(
&
tmq
->
waitingRequest
,
1
);
asyncSendMsgToServer
(
tmq
->
pTscObj
->
pAppInfo
->
pTransporter
,
&
pVg
->
epSet
,
&
transporterId
,
sendInfo
);
pVg
->
pollCnt
++
;
tmq
->
pollCnt
++
;
tsem_wait
(
&
pParam
->
rspSem
);
tmq_message_t
*
nmsg
=
NULL
;
while
(
1
)
{
while
(
1
)
{
taosGetQitem
(
tmq
->
qall
,
(
void
**
)
&
msg
);
taosReadQitem
(
tmq
->
mqueue
,
(
void
**
)
&
nmsg
);
if
(
msg
)
if
(
nmsg
==
NULL
)
continue
;
taosFreeQitem
(
msg
);
while
(
nmsg
->
head
.
mqMsgType
!=
TMQ_MSG_TYPE__POLL_RSP
)
{
else
taosReadQitem
(
tmq
->
mqueue
,
(
void
**
)
&
nmsg
);
break
;
}
return
nmsg
;
}
}
}
}
return
NULL
;
}
}
int32_t
tmqPollImpl
(
tmq_t
*
tmq
,
int64_t
blockingTime
)
{
int32_t
tmqPollImpl
(
tmq_t
*
tmq
,
int64_t
blockingTime
)
{
printf
(
"call poll
\n
"
);
/*printf("call poll\n");*/
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
tmq
->
clientTopics
);
i
++
)
{
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
tmq
->
clientTopics
);
i
++
)
{
SMqClientTopic
*
pTopic
=
taosArrayGet
(
tmq
->
clientTopics
,
i
);
SMqClientTopic
*
pTopic
=
taosArrayGet
(
tmq
->
clientTopics
,
i
);
for
(
int
j
=
0
;
j
<
taosArrayGetSize
(
pTopic
->
vgs
);
j
++
)
{
for
(
int
j
=
0
;
j
<
taosArrayGetSize
(
pTopic
->
vgs
);
j
++
)
{
...
@@ -875,32 +985,44 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t blockingTime) {
...
@@ -875,32 +985,44 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t blockingTime) {
SMqConsumeReq
*
pReq
=
tmqBuildConsumeReqImpl
(
tmq
,
blockingTime
,
pTopic
,
pVg
);
SMqConsumeReq
*
pReq
=
tmqBuildConsumeReqImpl
(
tmq
,
blockingTime
,
pTopic
,
pVg
);
if
(
pReq
==
NULL
)
{
if
(
pReq
==
NULL
)
{
atomic_store_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
);
atomic_store_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
);
// TODO: out of mem
tsem_post
(
&
tmq
->
rspSem
);
return
-
1
;
return
-
1
;
}
}
SMqPollCbParam
*
param
=
malloc
(
sizeof
(
SMqPollCbParam
));
SMqPollCbParam
*
pParam
=
malloc
(
sizeof
(
SMqPollCbParam
));
if
(
param
==
NULL
)
{
if
(
pParam
==
NULL
)
{
free
(
pReq
);
atomic_store_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
);
atomic_store_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
);
// TODO: out of mem
tsem_post
(
&
tmq
->
rspSem
);
return
-
1
;
return
-
1
;
}
}
param
->
tmq
=
tmq
;
pParam
->
tmq
=
tmq
;
param
->
pVg
=
pVg
;
pParam
->
pVg
=
pVg
;
param
->
epoch
=
tmq
->
epoch
;
pParam
->
epoch
=
tmq
->
epoch
;
SRequestObj
*
pRequest
=
createRequest
(
tmq
->
pTscObj
,
NULL
,
NULL
,
TDMT_VND_CONSUME
);
pParam
->
sync
=
0
;
pRequest
->
body
.
requestMsg
=
(
SDataBuf
){
SMsgSendInfo
*
sendInfo
=
malloc
(
sizeof
(
SMsgSendInfo
));
if
(
sendInfo
==
NULL
)
{
free
(
pReq
);
free
(
pParam
);
atomic_store_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
);
tsem_post
(
&
tmq
->
rspSem
);
return
-
1
;
}
sendInfo
->
msgInfo
=
(
SDataBuf
){
.
pData
=
pReq
,
.
pData
=
pReq
,
.
len
=
sizeof
(
SMqConsumeReq
),
.
len
=
sizeof
(
SMqConsumeReq
),
.
handle
=
NULL
,
.
handle
=
NULL
,
};
};
sendInfo
->
requestId
=
generateRequestId
();
SMsgSendInfo
*
sendInfo
=
buildMsgInfoImpl
(
pRequest
);
sendInfo
->
requestObjRefId
=
0
;
sendInfo
->
requestObjRefId
=
0
;
sendInfo
->
param
=
param
;
sendInfo
->
param
=
p
P
aram
;
sendInfo
->
fp
=
tmqPollCb
;
sendInfo
->
fp
=
tmqPollCb
;
sendInfo
->
msgType
=
TDMT_VND_CONSUME
;
int64_t
transporterId
=
0
;
int64_t
transporterId
=
0
;
printf
(
"send poll
\n
"
);
/*printf("send poll\n");*/
atomic_add_fetch_32
(
&
tmq
->
waitingRequest
,
1
);
asyncSendMsgToServer
(
tmq
->
pTscObj
->
pAppInfo
->
pTransporter
,
&
pVg
->
epSet
,
&
transporterId
,
sendInfo
);
asyncSendMsgToServer
(
tmq
->
pTscObj
->
pAppInfo
->
pTransporter
,
&
pVg
->
epSet
,
&
transporterId
,
sendInfo
);
pVg
->
pollCnt
++
;
pVg
->
pollCnt
++
;
tmq
->
pollCnt
++
;
tmq
->
pollCnt
++
;
...
@@ -912,7 +1034,7 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t blockingTime) {
...
@@ -912,7 +1034,7 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t blockingTime) {
// return
// return
int32_t
tmqHandleRes
(
tmq_t
*
tmq
,
tmq_message_t
*
rspMsg
,
bool
*
pReset
)
{
int32_t
tmqHandleRes
(
tmq_t
*
tmq
,
tmq_message_t
*
rspMsg
,
bool
*
pReset
)
{
if
(
rspMsg
->
head
.
mqMsgType
==
TMQ_MSG_TYPE__EP_RSP
)
{
if
(
rspMsg
->
head
.
mqMsgType
==
TMQ_MSG_TYPE__EP_RSP
)
{
printf
(
"ep %d %d
\n
"
,
rspMsg
->
head
.
epoch
,
tmq
->
epoch
);
/*printf("ep %d %d\n", rspMsg->head.epoch, tmq->epoch);*/
if
(
rspMsg
->
head
.
epoch
>
atomic_load_32
(
&
tmq
->
epoch
))
{
if
(
rspMsg
->
head
.
epoch
>
atomic_load_32
(
&
tmq
->
epoch
))
{
tmqUpdateEp
(
tmq
,
rspMsg
->
head
.
epoch
,
&
rspMsg
->
getEpRsp
);
tmqUpdateEp
(
tmq
,
rspMsg
->
head
.
epoch
,
&
rspMsg
->
getEpRsp
);
tmqClearUnhandleMsg
(
tmq
);
tmqClearUnhandleMsg
(
tmq
);
...
@@ -931,23 +1053,26 @@ tmq_message_t* tmqHandleAllRsp(tmq_t* tmq, int64_t blockingTime, bool pollIfRese
...
@@ -931,23 +1053,26 @@ tmq_message_t* tmqHandleAllRsp(tmq_t* tmq, int64_t blockingTime, bool pollIfRese
tmq_message_t
*
rspMsg
=
NULL
;
tmq_message_t
*
rspMsg
=
NULL
;
taosGetQitem
(
tmq
->
qall
,
(
void
**
)
&
rspMsg
);
taosGetQitem
(
tmq
->
qall
,
(
void
**
)
&
rspMsg
);
if
(
rspMsg
==
NULL
)
{
if
(
rspMsg
==
NULL
)
{
break
;
taosReadAllQitems
(
tmq
->
mqueue
,
tmq
->
qall
);
taosGetQitem
(
tmq
->
qall
,
(
void
**
)
&
rspMsg
);
if
(
rspMsg
==
NULL
)
return
NULL
;
}
}
if
(
rspMsg
->
head
.
mqMsgType
==
TMQ_MSG_TYPE__POLL_RSP
)
{
if
(
rspMsg
->
head
.
mqMsgType
==
TMQ_MSG_TYPE__POLL_RSP
)
{
printf
(
"handle poll rsp %d
\n
"
,
rspMsg
->
head
.
mqMsgType
);
atomic_sub_fetch_32
(
&
tmq
->
readyRequest
,
1
);
/*printf("handle poll rsp %d\n", rspMsg->head.mqMsgType);*/
if
(
rspMsg
->
head
.
epoch
==
atomic_load_32
(
&
tmq
->
epoch
))
{
if
(
rspMsg
->
head
.
epoch
==
atomic_load_32
(
&
tmq
->
epoch
))
{
printf
(
"epoch match
\n
"
);
/*printf("epoch match\n");*/
SMqClientVg
*
pVg
=
rspMsg
->
extra
;
SMqClientVg
*
pVg
=
rspMsg
->
extra
;
pVg
->
currentOffset
=
rspMsg
->
consumeRsp
.
rspOffset
;
pVg
->
currentOffset
=
rspMsg
->
consumeRsp
.
rspOffset
;
atomic_store_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
);
atomic_store_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
);
return
rspMsg
;
return
rspMsg
;
}
else
{
}
else
{
printf
(
"epoch mismatch
\n
"
);
/*printf("epoch mismatch\n");*/
taosFreeQitem
(
rspMsg
);
taosFreeQitem
(
rspMsg
);
}
}
}
else
{
}
else
{
printf
(
"handle ep rsp %d
\n
"
,
rspMsg
->
head
.
mqMsgType
);
/*printf("handle ep rsp %d\n", rspMsg->head.mqMsgType);*/
bool
reset
=
false
;
bool
reset
=
false
;
tmqHandleRes
(
tmq
,
rspMsg
,
&
reset
);
tmqHandleRes
(
tmq
,
rspMsg
,
&
reset
);
taosFreeQitem
(
rspMsg
);
taosFreeQitem
(
rspMsg
);
...
@@ -957,36 +1082,57 @@ tmq_message_t* tmqHandleAllRsp(tmq_t* tmq, int64_t blockingTime, bool pollIfRese
...
@@ -957,36 +1082,57 @@ tmq_message_t* tmqHandleAllRsp(tmq_t* tmq, int64_t blockingTime, bool pollIfRese
}
}
}
}
}
}
}
tmq_message_t
*
tmq_consumer_poll_v1
(
tmq_t
*
tmq
,
int64_t
blocking_time
)
{
tmq_message_t
*
rspMsg
=
NULL
;
int64_t
startTime
=
taosGetTimestampMs
();
int64_t
status
=
atomic_load_64
(
&
tmq
->
status
);
tmqAskEp
(
tmq
,
status
==
TMQ_CONSUMER_STATUS__INIT
);
while
(
1
)
{
rspMsg
=
tmqSyncPollImpl
(
tmq
,
blocking_time
);
if
(
rspMsg
&&
rspMsg
->
consumeRsp
.
numOfTopics
)
{
return
rspMsg
;
}
if
(
blocking_time
!=
0
)
{
int64_t
endTime
=
taosGetTimestampMs
();
if
(
endTime
-
startTime
>
blocking_time
)
{
return
NULL
;
return
NULL
;
}
}
else
return
NULL
;
}
}
}
tmq_message_t
*
tmq_consumer_poll
(
tmq_t
*
tmq
,
int64_t
blocking_time
)
{
tmq_message_t
*
tmq_consumer_poll
(
tmq_t
*
tmq
,
int64_t
blocking_time
)
{
tmq_message_t
*
rspMsg
=
NULL
;
tmq_message_t
*
rspMsg
;
int64_t
startTime
=
taosGetTimestampMs
();
int64_t
startTime
=
taosGetTimestampMs
();
// TODO: put into another thread or delayed queue
// TODO: put into another thread or delayed queue
int64_t
status
=
atomic_load_64
(
&
tmq
->
status
);
int64_t
status
=
atomic_load_64
(
&
tmq
->
status
);
tmqAskEp
(
tmq
,
status
==
TMQ_CONSUMER_STATUS__INIT
);
tmqAskEp
(
tmq
,
status
==
TMQ_CONSUMER_STATUS__INIT
);
taosGetQitem
(
tmq
->
qall
,
(
void
**
)
&
rspMsg
);
rspMsg
=
tmqHandleAllRsp
(
tmq
,
blocking_time
,
false
);
if
(
rspMsg
==
NULL
)
{
if
(
rspMsg
)
{
taosReadAllQitems
(
tmq
->
mqueue
,
tmq
->
qall
)
;
return
rspMsg
;
}
}
tmqHandleAllRsp
(
tmq
,
blocking_time
,
false
);
tmqPollImpl
(
tmq
,
blocking_time
);
while
(
1
)
{
while
(
1
)
{
/*printf("cycle\n");*/
/*printf("cycle\n");*/
taosReadAllQitems
(
tmq
->
mqueue
,
tmq
->
qall
);
tmqPollImpl
(
tmq
,
blocking_time
);
rspMsg
=
tmqHandleAllRsp
(
tmq
,
blocking_time
,
true
);
tsem_wait
(
&
tmq
->
rspSem
);
rspMsg
=
tmqHandleAllRsp
(
tmq
,
blocking_time
,
false
);
if
(
rspMsg
)
{
if
(
rspMsg
)
{
return
rspMsg
;
return
rspMsg
;
}
}
if
(
blocking_time
!=
0
)
{
if
(
blocking_time
!=
0
)
{
int64_t
endTime
=
taosGetTimestampMs
();
int64_t
endTime
=
taosGetTimestampMs
();
if
(
endTime
-
startTime
>
blocking_time
)
{
if
(
endTime
-
startTime
>
blocking_time
)
{
printf
(
"normal exit
\n
"
);
return
NULL
;
return
NULL
;
}
}
}
}
...
@@ -1127,6 +1273,7 @@ void tmq_message_destroy(tmq_message_t* tmq_message) {
...
@@ -1127,6 +1273,7 @@ void tmq_message_destroy(tmq_message_t* tmq_message) {
if
(
tmq_message
==
NULL
)
return
;
if
(
tmq_message
==
NULL
)
return
;
SMqConsumeRsp
*
pRsp
=
&
tmq_message
->
consumeRsp
;
SMqConsumeRsp
*
pRsp
=
&
tmq_message
->
consumeRsp
;
tDeleteSMqConsumeRsp
(
pRsp
);
tDeleteSMqConsumeRsp
(
pRsp
);
/*free(tmq_message);*/
taosFreeQitem
(
tmq_message
);
taosFreeQitem
(
tmq_message
);
}
}
...
@@ -1138,6 +1285,7 @@ const char* tmq_err2str(tmq_resp_err_t err) {
...
@@ -1138,6 +1285,7 @@ const char* tmq_err2str(tmq_resp_err_t err) {
}
}
return
"fail"
;
return
"fail"
;
}
}
#if 0
#if 0
tmq_t* tmqCreateConsumerImpl(TAOS* conn, tmq_conf_t* conf) {
tmq_t* tmqCreateConsumerImpl(TAOS* conn, tmq_conf_t* conf) {
tmq_t* pTmq = malloc(sizeof(tmq_t));
tmq_t* pTmq = malloc(sizeof(tmq_t));
...
...
source/common/src/t
ep
.c
→
source/common/src/t
datablock
.c
浏览文件 @
a11a2f37
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
*/
*/
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "t
ep
.h"
#include "t
datablock
.h"
#include "tcompare.h"
#include "tcompare.h"
#include "tglobal.h"
#include "tglobal.h"
...
...
source/common/src/tglobal.c
浏览文件 @
a11a2f37
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
#include "tglobal.h"
#include "tglobal.h"
#include "tcompare.h"
#include "tcompare.h"
#include "tconfig.h"
#include "tconfig.h"
#include "t
ep
.h"
#include "t
datablock
.h"
#include "tlog.h"
#include "tlog.h"
SConfig
*
tsCfg
=
NULL
;
SConfig
*
tsCfg
=
NULL
;
...
...
source/common/src/ttszip.c
浏览文件 @
a11a2f37
...
@@ -46,7 +46,7 @@ STSBuf* tsBufCreate(bool autoDelete, int32_t order) {
...
@@ -46,7 +46,7 @@ STSBuf* tsBufCreate(bool autoDelete, int32_t order) {
}
}
if
(
!
autoDelete
)
{
if
(
!
autoDelete
)
{
remov
e
(
pTSBuf
->
path
);
taosRemoveFil
e
(
pTSBuf
->
path
);
}
}
if
(
NULL
==
allocResForTSBuf
(
pTSBuf
))
{
if
(
NULL
==
allocResForTSBuf
(
pTSBuf
))
{
...
@@ -178,7 +178,7 @@ void* tsBufDestroy(STSBuf* pTSBuf) {
...
@@ -178,7 +178,7 @@ void* tsBufDestroy(STSBuf* pTSBuf) {
if
(
pTSBuf
->
autoDelete
)
{
if
(
pTSBuf
->
autoDelete
)
{
// ("tsBuf %p destroyed, delete tmp file:%s", pTSBuf, pTSBuf->path);
// ("tsBuf %p destroyed, delete tmp file:%s", pTSBuf, pTSBuf->path);
remov
e
(
pTSBuf
->
path
);
taosRemoveFil
e
(
pTSBuf
->
path
);
}
else
{
}
else
{
// tscDebug("tsBuf %p destroyed, tmp file:%s, remains", pTSBuf, pTSBuf->path);
// tscDebug("tsBuf %p destroyed, tmp file:%s, remains", pTSBuf, pTSBuf->path);
}
}
...
...
source/common/test/commonTests.cpp
浏览文件 @
a11a2f37
...
@@ -8,7 +8,8 @@
...
@@ -8,7 +8,8 @@
#pragma GCC diagnostic ignored "-Wsign-compare"
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "os.h"
#include "os.h"
#include "tep.h"
#include "tcommon.h"
#include "tdatablock.h"
#include "tcommon.h"
#include "tcommon.h"
#include "taos.h"
#include "taos.h"
#include "tvariant.h"
#include "tvariant.h"
...
...
source/dnode/mgmt/impl/inc/dndInt.h
浏览文件 @
a11a2f37
...
@@ -23,9 +23,11 @@ extern "C" {
...
@@ -23,9 +23,11 @@ extern "C" {
#include "os.h"
#include "os.h"
#include "cJSON.h"
#include "cJSON.h"
#include "monitor.h"
#include "tcache.h"
#include "tcache.h"
#include "tcrc32c.h"
#include "tcrc32c.h"
#include "tep.h"
#include "tdatablock.h"
#include "tglobal.h"
#include "thash.h"
#include "thash.h"
#include "tlockfree.h"
#include "tlockfree.h"
#include "tlog.h"
#include "tlog.h"
...
@@ -35,8 +37,6 @@ extern "C" {
...
@@ -35,8 +37,6 @@ extern "C" {
#include "tthread.h"
#include "tthread.h"
#include "ttime.h"
#include "ttime.h"
#include "tworker.h"
#include "tworker.h"
#include "tglobal.h"
#include "monitor.h"
#include "dnode.h"
#include "dnode.h"
...
...
source/dnode/mgmt/impl/test/sut/src/client.cpp
浏览文件 @
a11a2f37
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
*/
*/
#include "sut.h"
#include "sut.h"
#include "t
ep
.h"
#include "t
datablock
.h"
static
void
processClientRsp
(
void
*
parent
,
SRpcMsg
*
pRsp
,
SEpSet
*
pEpSet
)
{
static
void
processClientRsp
(
void
*
parent
,
SRpcMsg
*
pRsp
,
SEpSet
*
pEpSet
)
{
TestClient
*
client
=
(
TestClient
*
)
parent
;
TestClient
*
client
=
(
TestClient
*
)
parent
;
...
...
source/dnode/mnode/impl/inc/mndInt.h
浏览文件 @
a11a2f37
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
#include "sdb.h"
#include "sdb.h"
#include "tcache.h"
#include "tcache.h"
#include "t
ep
.h"
#include "t
datablock
.h"
#include "tglobal.h"
#include "tglobal.h"
#include "tqueue.h"
#include "tqueue.h"
#include "ttime.h"
#include "ttime.h"
...
...
source/dnode/vnode/inc/meta.h
浏览文件 @
a11a2f37
...
@@ -50,14 +50,14 @@ int metaDropTable(SMeta *pMeta, tb_uid_t uid);
...
@@ -50,14 +50,14 @@ int metaDropTable(SMeta *pMeta, tb_uid_t uid);
int
metaCommit
(
SMeta
*
pMeta
);
int
metaCommit
(
SMeta
*
pMeta
);
// For Query
// For Query
STbCfg
*
metaGetTbInfoByUid
(
SMeta
*
pMeta
,
tb_uid_t
uid
);
STbCfg
*
metaGetTbInfoByUid
(
SMeta
*
pMeta
,
tb_uid_t
uid
);
STbCfg
*
metaGetTbInfoByName
(
SMeta
*
pMeta
,
char
*
tbname
,
tb_uid_t
*
uid
);
STbCfg
*
metaGetTbInfoByName
(
SMeta
*
pMeta
,
char
*
tbname
,
tb_uid_t
*
uid
);
SSchemaWrapper
*
metaGetTableSchema
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
,
bool
isinline
);
SSchemaWrapper
*
metaGetTableSchema
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
,
bool
isinline
);
STSchema
*
metaGetTbTSchema
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
);
STSchema
*
metaGetTbTSchema
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
);
SMTbCursor
*
metaOpenTbCursor
(
SMeta
*
pMeta
);
SMTbCursor
*
metaOpenTbCursor
(
SMeta
*
pMeta
);
void
metaCloseTbCursor
(
SMTbCursor
*
pTbCur
);
void
metaCloseTbCursor
(
SMTbCursor
*
pTbCur
);
char
*
metaTbCursorNext
(
SMTbCursor
*
pTbCur
);
char
*
metaTbCursorNext
(
SMTbCursor
*
pTbCur
);
SMCtbCursor
*
metaOpenCtbCursor
(
SMeta
*
pMeta
,
tb_uid_t
uid
);
SMCtbCursor
*
metaOpenCtbCursor
(
SMeta
*
pMeta
,
tb_uid_t
uid
);
void
metaCloseCtbCurosr
(
SMCtbCursor
*
pCtbCur
);
void
metaCloseCtbCurosr
(
SMCtbCursor
*
pCtbCur
);
...
...
source/dnode/vnode/inc/vnode.h
浏览文件 @
a11a2f37
...
@@ -213,11 +213,32 @@ static FORCE_INLINE void tqReadHandleSetColIdList(STqReadHandle *pReadHandle, SA
...
@@ -213,11 +213,32 @@ static FORCE_INLINE void tqReadHandleSetColIdList(STqReadHandle *pReadHandle, SA
//}
//}
static
FORCE_INLINE
int
tqReadHandleSetTbUidList
(
STqReadHandle
*
pHandle
,
const
SArray
*
tbUidList
)
{
static
FORCE_INLINE
int
tqReadHandleSetTbUidList
(
STqReadHandle
*
pHandle
,
const
SArray
*
tbUidList
)
{
if
(
pHandle
->
tbIdHash
)
{
taosHashClear
(
pHandle
->
tbIdHash
);
}
pHandle
->
tbIdHash
=
taosHashInit
(
64
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
true
,
HASH_NO_LOCK
);
if
(
pHandle
->
tbIdHash
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
tbUidList
);
i
++
)
{
int64_t
*
pKey
=
(
int64_t
*
)
taosArrayGet
(
tbUidList
,
i
);
taosHashPut
(
pHandle
->
tbIdHash
,
pKey
,
sizeof
(
int64_t
),
NULL
,
0
);
}
return
0
;
}
static
FORCE_INLINE
int
tqReadHandleAddTbUidList
(
STqReadHandle
*
pHandle
,
const
SArray
*
tbUidList
)
{
if
(
pHandle
->
tbIdHash
==
NULL
)
{
pHandle
->
tbIdHash
=
taosHashInit
(
64
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
true
,
HASH_NO_LOCK
);
pHandle
->
tbIdHash
=
taosHashInit
(
64
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
true
,
HASH_NO_LOCK
);
if
(
pHandle
->
tbIdHash
==
NULL
)
{
if
(
pHandle
->
tbIdHash
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
return
-
1
;
}
}
}
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
tbUidList
);
i
++
)
{
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
tbUidList
);
i
++
)
{
int64_t
*
pKey
=
(
int64_t
*
)
taosArrayGet
(
tbUidList
,
i
);
int64_t
*
pKey
=
(
int64_t
*
)
taosArrayGet
(
tbUidList
,
i
);
...
...
source/dnode/vnode/src/inc/metaDef.h
浏览文件 @
a11a2f37
source/dnode/vnode/src/meta/metaBDBImpl.c
浏览文件 @
a11a2f37
...
@@ -62,10 +62,10 @@ static int metaStbIdxCb(DB *pIdx, const DBT *pKey, const DBT *pValue, DBT *
...
@@ -62,10 +62,10 @@ static int metaStbIdxCb(DB *pIdx, const DBT *pKey, const DBT *pValue, DBT *
static
int
metaNtbIdxCb
(
DB
*
pIdx
,
const
DBT
*
pKey
,
const
DBT
*
pValue
,
DBT
*
pSKey
);
static
int
metaNtbIdxCb
(
DB
*
pIdx
,
const
DBT
*
pKey
,
const
DBT
*
pValue
,
DBT
*
pSKey
);
static
int
metaCtbIdxCb
(
DB
*
pIdx
,
const
DBT
*
pKey
,
const
DBT
*
pValue
,
DBT
*
pSKey
);
static
int
metaCtbIdxCb
(
DB
*
pIdx
,
const
DBT
*
pKey
,
const
DBT
*
pValue
,
DBT
*
pSKey
);
static
int
metaEncodeTbInfo
(
void
**
buf
,
STbCfg
*
pTbCfg
);
static
int
metaEncodeTbInfo
(
void
**
buf
,
STbCfg
*
pTbCfg
);
static
void
*
metaDecodeTbInfo
(
void
*
buf
,
STbCfg
*
pTbCfg
);
static
void
*
metaDecodeTbInfo
(
void
*
buf
,
STbCfg
*
pTbCfg
);
static
void
metaClearTbCfg
(
STbCfg
*
pTbCfg
);
static
void
metaClearTbCfg
(
STbCfg
*
pTbCfg
);
static
int
metaEncodeSchema
(
void
**
buf
,
SSchemaWrapper
*
pSW
);
static
int
metaEncodeSchema
(
void
**
buf
,
SSchemaWrapper
*
pSW
);
static
void
*
metaDecodeSchema
(
void
*
buf
,
SSchemaWrapper
*
pSW
);
static
void
*
metaDecodeSchema
(
void
*
buf
,
SSchemaWrapper
*
pSW
);
static
void
metaDBWLock
(
SMetaDB
*
pDB
);
static
void
metaDBWLock
(
SMetaDB
*
pDB
);
static
void
metaDBRLock
(
SMetaDB
*
pDB
);
static
void
metaDBRLock
(
SMetaDB
*
pDB
);
static
void
metaDBULock
(
SMetaDB
*
pDB
);
static
void
metaDBULock
(
SMetaDB
*
pDB
);
...
@@ -142,7 +142,7 @@ int metaSaveTableToDB(SMeta *pMeta, STbCfg *pTbCfg) {
...
@@ -142,7 +142,7 @@ int metaSaveTableToDB(SMeta *pMeta, STbCfg *pTbCfg) {
tb_uid_t
uid
;
tb_uid_t
uid
;
char
buf
[
512
];
char
buf
[
512
];
char
buf1
[
512
];
char
buf1
[
512
];
void
*
pBuf
;
void
*
pBuf
;
DBT
key1
,
value1
;
DBT
key1
,
value1
;
DBT
key2
,
value2
;
DBT
key2
,
value2
;
SSchema
*
pSchema
=
NULL
;
SSchema
*
pSchema
=
NULL
;
...
@@ -394,7 +394,7 @@ static int metaNtbIdxCb(DB *pIdx, const DBT *pKey, const DBT *pValue, DBT *pSKey
...
@@ -394,7 +394,7 @@ static int metaNtbIdxCb(DB *pIdx, const DBT *pKey, const DBT *pValue, DBT *pSKey
static
int
metaCtbIdxCb
(
DB
*
pIdx
,
const
DBT
*
pKey
,
const
DBT
*
pValue
,
DBT
*
pSKey
)
{
static
int
metaCtbIdxCb
(
DB
*
pIdx
,
const
DBT
*
pKey
,
const
DBT
*
pValue
,
DBT
*
pSKey
)
{
STbCfg
*
pTbCfg
=
(
STbCfg
*
)(
pValue
->
app_data
);
STbCfg
*
pTbCfg
=
(
STbCfg
*
)(
pValue
->
app_data
);
DBT
*
pDbt
;
DBT
*
pDbt
;
if
(
pTbCfg
->
type
==
META_CHILD_TABLE
)
{
if
(
pTbCfg
->
type
==
META_CHILD_TABLE
)
{
// pDbt = calloc(2, sizeof(DBT));
// pDbt = calloc(2, sizeof(DBT));
...
@@ -479,7 +479,7 @@ static void metaClearTbCfg(STbCfg *pTbCfg) {
...
@@ -479,7 +479,7 @@ static void metaClearTbCfg(STbCfg *pTbCfg) {
/* ------------------------ FOR QUERY ------------------------ */
/* ------------------------ FOR QUERY ------------------------ */
STbCfg
*
metaGetTbInfoByUid
(
SMeta
*
pMeta
,
tb_uid_t
uid
)
{
STbCfg
*
metaGetTbInfoByUid
(
SMeta
*
pMeta
,
tb_uid_t
uid
)
{
STbCfg
*
pTbCfg
=
NULL
;
STbCfg
*
pTbCfg
=
NULL
;
SMetaDB
*
pDB
=
pMeta
->
pDB
;
SMetaDB
*
pDB
=
pMeta
->
pDB
;
DBT
key
=
{
0
};
DBT
key
=
{
0
};
DBT
value
=
{
0
};
DBT
value
=
{
0
};
...
@@ -509,7 +509,7 @@ STbCfg *metaGetTbInfoByUid(SMeta *pMeta, tb_uid_t uid) {
...
@@ -509,7 +509,7 @@ STbCfg *metaGetTbInfoByUid(SMeta *pMeta, tb_uid_t uid) {
}
}
STbCfg
*
metaGetTbInfoByName
(
SMeta
*
pMeta
,
char
*
tbname
,
tb_uid_t
*
uid
)
{
STbCfg
*
metaGetTbInfoByName
(
SMeta
*
pMeta
,
char
*
tbname
,
tb_uid_t
*
uid
)
{
STbCfg
*
pTbCfg
=
NULL
;
STbCfg
*
pTbCfg
=
NULL
;
SMetaDB
*
pDB
=
pMeta
->
pDB
;
SMetaDB
*
pDB
=
pMeta
->
pDB
;
DBT
key
=
{
0
};
DBT
key
=
{
0
};
DBT
pkey
=
{
0
};
DBT
pkey
=
{
0
};
...
@@ -543,10 +543,10 @@ STbCfg *metaGetTbInfoByName(SMeta *pMeta, char *tbname, tb_uid_t *uid) {
...
@@ -543,10 +543,10 @@ STbCfg *metaGetTbInfoByName(SMeta *pMeta, char *tbname, tb_uid_t *uid) {
SSchemaWrapper
*
metaGetTableSchema
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
,
bool
isinline
)
{
SSchemaWrapper
*
metaGetTableSchema
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
,
bool
isinline
)
{
uint32_t
nCols
;
uint32_t
nCols
;
SSchemaWrapper
*
pSW
=
NULL
;
SSchemaWrapper
*
pSW
=
NULL
;
SMetaDB
*
pDB
=
pMeta
->
pDB
;
SMetaDB
*
pDB
=
pMeta
->
pDB
;
int
ret
;
int
ret
;
void
*
pBuf
;
void
*
pBuf
;
SSchema
*
pSchema
;
SSchema
*
pSchema
;
SSchemaKey
schemaKey
=
{
uid
,
sver
,
0
};
SSchemaKey
schemaKey
=
{
uid
,
sver
,
0
};
DBT
key
=
{
0
};
DBT
key
=
{
0
};
DBT
value
=
{
0
};
DBT
value
=
{
0
};
...
@@ -578,7 +578,7 @@ struct SMTbCursor {
...
@@ -578,7 +578,7 @@ struct SMTbCursor {
SMTbCursor
*
metaOpenTbCursor
(
SMeta
*
pMeta
)
{
SMTbCursor
*
metaOpenTbCursor
(
SMeta
*
pMeta
)
{
SMTbCursor
*
pTbCur
=
NULL
;
SMTbCursor
*
pTbCur
=
NULL
;
SMetaDB
*
pDB
=
pMeta
->
pDB
;
SMetaDB
*
pDB
=
pMeta
->
pDB
;
pTbCur
=
(
SMTbCursor
*
)
calloc
(
1
,
sizeof
(
*
pTbCur
));
pTbCur
=
(
SMTbCursor
*
)
calloc
(
1
,
sizeof
(
*
pTbCur
));
if
(
pTbCur
==
NULL
)
{
if
(
pTbCur
==
NULL
)
{
...
@@ -609,7 +609,7 @@ char *metaTbCursorNext(SMTbCursor *pTbCur) {
...
@@ -609,7 +609,7 @@ char *metaTbCursorNext(SMTbCursor *pTbCur) {
DBT
key
=
{
0
};
DBT
key
=
{
0
};
DBT
value
=
{
0
};
DBT
value
=
{
0
};
STbCfg
tbCfg
;
STbCfg
tbCfg
;
void
*
pBuf
;
void
*
pBuf
;
for
(;;)
{
for
(;;)
{
if
(
pTbCur
->
pCur
->
get
(
pTbCur
->
pCur
,
&
key
,
&
value
,
DB_NEXT
)
==
0
)
{
if
(
pTbCur
->
pCur
->
get
(
pTbCur
->
pCur
,
&
key
,
&
value
,
DB_NEXT
)
==
0
)
{
...
@@ -631,10 +631,10 @@ char *metaTbCursorNext(SMTbCursor *pTbCur) {
...
@@ -631,10 +631,10 @@ char *metaTbCursorNext(SMTbCursor *pTbCur) {
STSchema
*
metaGetTbTSchema
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
)
{
STSchema
*
metaGetTbTSchema
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
)
{
STSchemaBuilder
sb
;
STSchemaBuilder
sb
;
STSchema
*
pTSchema
=
NULL
;
STSchema
*
pTSchema
=
NULL
;
SSchema
*
pSchema
;
SSchema
*
pSchema
;
SSchemaWrapper
*
pSW
;
SSchemaWrapper
*
pSW
;
STbCfg
*
pTbCfg
;
STbCfg
*
pTbCfg
;
tb_uid_t
quid
;
tb_uid_t
quid
;
pTbCfg
=
metaGetTbInfoByUid
(
pMeta
,
uid
);
pTbCfg
=
metaGetTbInfoByUid
(
pMeta
,
uid
);
...
@@ -662,13 +662,13 @@ STSchema *metaGetTbTSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver) {
...
@@ -662,13 +662,13 @@ STSchema *metaGetTbTSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver) {
}
}
struct
SMCtbCursor
{
struct
SMCtbCursor
{
DBC
*
pCur
;
DBC
*
pCur
;
tb_uid_t
suid
;
tb_uid_t
suid
;
};
};
SMCtbCursor
*
metaOpenCtbCursor
(
SMeta
*
pMeta
,
tb_uid_t
uid
)
{
SMCtbCursor
*
metaOpenCtbCursor
(
SMeta
*
pMeta
,
tb_uid_t
uid
)
{
SMCtbCursor
*
pCtbCur
=
NULL
;
SMCtbCursor
*
pCtbCur
=
NULL
;
SMetaDB
*
pDB
=
pMeta
->
pDB
;
SMetaDB
*
pDB
=
pMeta
->
pDB
;
int
ret
;
int
ret
;
pCtbCur
=
(
SMCtbCursor
*
)
calloc
(
1
,
sizeof
(
*
pCtbCur
));
pCtbCur
=
(
SMCtbCursor
*
)
calloc
(
1
,
sizeof
(
*
pCtbCur
));
...
@@ -700,7 +700,7 @@ tb_uid_t metaCtbCursorNext(SMCtbCursor *pCtbCur) {
...
@@ -700,7 +700,7 @@ tb_uid_t metaCtbCursorNext(SMCtbCursor *pCtbCur) {
DBT
skey
=
{
0
};
DBT
skey
=
{
0
};
DBT
pkey
=
{
0
};
DBT
pkey
=
{
0
};
DBT
pval
=
{
0
};
DBT
pval
=
{
0
};
void
*
pBuf
;
void
*
pBuf
;
STbCfg
tbCfg
;
STbCfg
tbCfg
;
// Set key
// Set key
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
a11a2f37
...
@@ -72,6 +72,8 @@ void tqClose(STQ* pTq) {
...
@@ -72,6 +72,8 @@ void tqClose(STQ* pTq) {
}
}
int
tqPushMsg
(
STQ
*
pTq
,
void
*
msg
,
tmsg_t
msgType
,
int64_t
version
)
{
int
tqPushMsg
(
STQ
*
pTq
,
void
*
msg
,
tmsg_t
msgType
,
int64_t
version
)
{
// if waiting
// memcpy and send msg to fetch thread
// TODO: add reference
// TODO: add reference
// if handle waiting, launch query and response to consumer
// if handle waiting, launch query and response to consumer
//
//
...
@@ -210,7 +212,7 @@ int32_t tqProcessConsumeReq(STQ* pTq, SRpcMsg* pMsg) {
...
@@ -210,7 +212,7 @@ int32_t tqProcessConsumeReq(STQ* pTq, SRpcMsg* pMsg) {
SMqConsumeReq
*
pReq
=
pMsg
->
pCont
;
SMqConsumeReq
*
pReq
=
pMsg
->
pCont
;
int64_t
consumerId
=
pReq
->
consumerId
;
int64_t
consumerId
=
pReq
->
consumerId
;
int64_t
fetchOffset
;
int64_t
fetchOffset
;
/*int64_t blockingTime = pReq->blockingTime;*/
int64_t
blockingTime
=
pReq
->
blockingTime
;
if
(
pReq
->
currentOffset
==
TMQ_CONF__RESET_OFFSET__EARLIEAST
)
{
if
(
pReq
->
currentOffset
==
TMQ_CONF__RESET_OFFSET__EARLIEAST
)
{
fetchOffset
=
0
;
fetchOffset
=
0
;
...
...
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
a11a2f37
...
@@ -1054,7 +1054,7 @@ int tsdbWriteBlockIdx(SDFile *pHeadf, SArray *pIdxA, void **ppBuf) {
...
@@ -1054,7 +1054,7 @@ int tsdbWriteBlockIdx(SDFile *pHeadf, SArray *pIdxA, void **ppBuf) {
// pfs->metaCacheComp = NULL;
// pfs->metaCacheComp = NULL;
// } else {
// } else {
// // remove meta.tmp file
// // remove meta.tmp file
//
remov
e(mf.f.aname);
//
taosRemoveFil
e(mf.f.aname);
// taosHashCleanup(pfs->metaCacheComp);
// taosHashCleanup(pfs->metaCacheComp);
// pfs->metaCacheComp = NULL;
// pfs->metaCacheComp = NULL;
// }
// }
...
...
source/dnode/vnode/src/tsdb/tsdbFS.c
浏览文件 @
a11a2f37
...
@@ -439,7 +439,7 @@ static int tsdbSaveFSStatus(STsdb *pRepo, SFSStatus *pStatus) {
...
@@ -439,7 +439,7 @@ static int tsdbSaveFSStatus(STsdb *pRepo, SFSStatus *pStatus) {
if
(
taosWriteFile
(
pFile
,
hbuf
,
TSDB_FILE_HEAD_SIZE
)
<
TSDB_FILE_HEAD_SIZE
)
{
if
(
taosWriteFile
(
pFile
,
hbuf
,
TSDB_FILE_HEAD_SIZE
)
<
TSDB_FILE_HEAD_SIZE
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
taosCloseFile
(
&
pFile
);
taosCloseFile
(
&
pFile
);
remov
e
(
tfname
);
taosRemoveFil
e
(
tfname
);
return
-
1
;
return
-
1
;
}
}
...
@@ -447,7 +447,7 @@ static int tsdbSaveFSStatus(STsdb *pRepo, SFSStatus *pStatus) {
...
@@ -447,7 +447,7 @@ static int tsdbSaveFSStatus(STsdb *pRepo, SFSStatus *pStatus) {
if
(
fsheader
.
len
>
0
)
{
if
(
fsheader
.
len
>
0
)
{
if
(
tsdbMakeRoom
(
&
(
pBuf
),
fsheader
.
len
)
<
0
)
{
if
(
tsdbMakeRoom
(
&
(
pBuf
),
fsheader
.
len
)
<
0
)
{
taosCloseFile
(
&
pFile
);
taosCloseFile
(
&
pFile
);
remov
e
(
tfname
);
taosRemoveFil
e
(
tfname
);
return
-
1
;
return
-
1
;
}
}
...
@@ -458,7 +458,7 @@ static int tsdbSaveFSStatus(STsdb *pRepo, SFSStatus *pStatus) {
...
@@ -458,7 +458,7 @@ static int tsdbSaveFSStatus(STsdb *pRepo, SFSStatus *pStatus) {
if
(
taosWriteFile
(
pFile
,
pBuf
,
fsheader
.
len
)
<
fsheader
.
len
)
{
if
(
taosWriteFile
(
pFile
,
pBuf
,
fsheader
.
len
)
<
fsheader
.
len
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
taosCloseFile
(
&
pFile
);
taosCloseFile
(
&
pFile
);
(
void
)
remov
e
(
tfname
);
(
void
)
taosRemoveFil
e
(
tfname
);
taosTZfree
(
pBuf
);
taosTZfree
(
pBuf
);
return
-
1
;
return
-
1
;
}
}
...
@@ -468,7 +468,7 @@ static int tsdbSaveFSStatus(STsdb *pRepo, SFSStatus *pStatus) {
...
@@ -468,7 +468,7 @@ static int tsdbSaveFSStatus(STsdb *pRepo, SFSStatus *pStatus) {
if
(
taosFsyncFile
(
pFile
)
<
0
)
{
if
(
taosFsyncFile
(
pFile
)
<
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
taosCloseFile
(
&
pFile
);
taosCloseFile
(
&
pFile
);
remov
e
(
tfname
);
taosRemoveFil
e
(
tfname
);
taosTZfree
(
pBuf
);
taosTZfree
(
pBuf
);
return
-
1
;
return
-
1
;
}
}
...
...
source/libs/catalog/test/catalogTests.cpp
浏览文件 @
a11a2f37
...
@@ -27,13 +27,13 @@
...
@@ -27,13 +27,13 @@
#include "os.h"
#include "os.h"
#include "tglobal.h"
#include "tglobal.h"
#include "catalog.h"
#include "catalog.h"
#include "catalogInt.h"
#include "stub.h"
#include "stub.h"
#include "taos.h"
#include "taos.h"
#include "tdatablock.h"
#include "tdef.h"
#include "tdef.h"
#include "tep.h"
#include "trpc.h"
#include "trpc.h"
#include "tvariant.h"
#include "tvariant.h"
#include "catalogInt.h"
namespace
{
namespace
{
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
a11a2f37
...
@@ -15,12 +15,12 @@
...
@@ -15,12 +15,12 @@
#ifndef TDENGINE_EXECUTORIMPL_H
#ifndef TDENGINE_EXECUTORIMPL_H
#define TDENGINE_EXECUTORIMPL_H
#define TDENGINE_EXECUTORIMPL_H
#include "tsort.h"
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
#endif
#endif
#include "os.h"
#include "os.h"
#include "tsort.h"
#include "tcommon.h"
#include "tcommon.h"
#include "tlosertree.h"
#include "tlosertree.h"
#include "ttszip.h"
#include "ttszip.h"
...
@@ -157,6 +157,13 @@ typedef struct STaskCostInfo {
...
@@ -157,6 +157,13 @@ typedef struct STaskCostInfo {
SHashObj
*
operatorProfResults
;
// map<operator_type, SQueryProfEvent>
SHashObj
*
operatorProfResults
;
// map<operator_type, SQueryProfEvent>
}
STaskCostInfo
;
}
STaskCostInfo
;
typedef
struct
SOperatorCostInfo
{
uint64_t
openCost
;
uint64_t
execCost
;
uint64_t
totalRows
;
uint64_t
totalBytes
;
}
SOperatorCostInfo
;
typedef
struct
{
typedef
struct
{
int64_t
vgroupLimit
;
int64_t
vgroupLimit
;
int64_t
ts
;
int64_t
ts
;
...
...
source/libs/executor/src/executor.c
浏览文件 @
a11a2f37
...
@@ -95,17 +95,17 @@ qTaskInfo_t qCreateStreamExecTaskInfo(void* msg, void* streamReadHandle) {
...
@@ -95,17 +95,17 @@ qTaskInfo_t qCreateStreamExecTaskInfo(void* msg, void* streamReadHandle) {
}
}
int32_t
qUpdateQualifiedTableId
(
qTaskInfo_t
tinfo
,
SArray
*
tableIdList
,
bool
isAdd
)
{
int32_t
qUpdateQualifiedTableId
(
qTaskInfo_t
tinfo
,
SArray
*
tableIdList
,
bool
isAdd
)
{
SExecTaskInfo
*
pTaskInfo
=
(
SExecTaskInfo
*
)
tinfo
;
SExecTaskInfo
*
pTaskInfo
=
(
SExecTaskInfo
*
)
tinfo
;
// traverse to the streamscan node to add this table id
// traverse to the streamscan node to add this table id
SOperatorInfo
*
pInfo
=
pTaskInfo
->
pRoot
;
SOperatorInfo
*
pInfo
=
pTaskInfo
->
pRoot
;
while
(
pInfo
->
operatorType
!=
OP_StreamScan
)
{
while
(
pInfo
->
operatorType
!=
OP_StreamScan
)
{
pInfo
=
pInfo
->
pDownstream
[
0
];
pInfo
=
pInfo
->
pDownstream
[
0
];
}
}
SStreamBlockScanInfo
*
pScanInfo
=
pInfo
->
info
;
SStreamBlockScanInfo
*
pScanInfo
=
pInfo
->
info
;
if
(
isAdd
)
{
if
(
isAdd
)
{
int32_t
code
=
tqReadHandle
Set
TbUidList
(
pScanInfo
->
readerHandle
,
tableIdList
);
int32_t
code
=
tqReadHandle
Add
TbUidList
(
pScanInfo
->
readerHandle
,
tableIdList
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
return
code
;
}
}
...
...
source/libs/executor/src/executorMain.c
浏览文件 @
a11a2f37
...
@@ -179,13 +179,6 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t *useconds) {
...
@@ -179,13 +179,6 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t *useconds) {
return
pTaskInfo
->
code
;
return
pTaskInfo
->
code
;
}
}
void
*
qGetResultRetrieveMsg
(
qTaskInfo_t
qinfo
)
{
SQInfo
*
pQInfo
=
(
SQInfo
*
)
qinfo
;
assert
(
pQInfo
!=
NULL
);
return
pQInfo
->
rspContext
;
}
int32_t
qKillTask
(
qTaskInfo_t
qinfo
)
{
int32_t
qKillTask
(
qTaskInfo_t
qinfo
)
{
SExecTaskInfo
*
pTaskInfo
=
(
SExecTaskInfo
*
)
qinfo
;
SExecTaskInfo
*
pTaskInfo
=
(
SExecTaskInfo
*
)
qinfo
;
...
@@ -221,7 +214,7 @@ int32_t qAsyncKillTask(qTaskInfo_t qinfo) {
...
@@ -221,7 +214,7 @@ int32_t qAsyncKillTask(qTaskInfo_t qinfo) {
int32_t
qIsTaskCompleted
(
qTaskInfo_t
qinfo
)
{
int32_t
qIsTaskCompleted
(
qTaskInfo_t
qinfo
)
{
SExecTaskInfo
*
pTaskInfo
=
(
SExecTaskInfo
*
)
qinfo
;
SExecTaskInfo
*
pTaskInfo
=
(
SExecTaskInfo
*
)
qinfo
;
if
(
pTaskInfo
==
NULL
/*|| !isValidQInfo(pTaskInfo)*/
)
{
if
(
pTaskInfo
==
NULL
)
{
return
TSDB_CODE_QRY_INVALID_QHANDLE
;
return
TSDB_CODE_QRY_INVALID_QHANDLE
;
}
}
...
@@ -235,33 +228,3 @@ void qDestroyTask(qTaskInfo_t qTaskHandle) {
...
@@ -235,33 +228,3 @@ void qDestroyTask(qTaskInfo_t qTaskHandle) {
queryCostStatis
(
pTaskInfo
);
// print the query cost summary
queryCostStatis
(
pTaskInfo
);
// print the query cost summary
doDestroyTask
(
pTaskInfo
);
doDestroyTask
(
pTaskInfo
);
}
}
#if 0
//kill by qid
int32_t qKillQueryByQId(void* pMgmt, int64_t qId, int32_t waitMs, int32_t waitCount) {
int32_t error = TSDB_CODE_SUCCESS;
void** handle = qAcquireTask(pMgmt, qId);
if(handle == NULL) return terrno;
SQInfo* pQInfo = (SQInfo*)(*handle);
if (pQInfo == NULL || !isValidQInfo(pQInfo)) {
return TSDB_CODE_QRY_INVALID_QHANDLE;
}
qWarn("%s be killed(no memory commit).", pQInfo->qId);
setTaskKilled(pQInfo);
// wait query stop
int32_t loop = 0;
while (pQInfo->owner != 0) {
taosMsleep(waitMs);
if(loop++ > waitCount){
error = TSDB_CODE_FAILED;
break;
}
}
qReleaseTask(pMgmt, (void **)&handle, true);
return error;
}
#endif
source/libs/executor/src/executorimpl.c
浏览文件 @
a11a2f37
...
@@ -15,12 +15,12 @@
...
@@ -15,12 +15,12 @@
#include "os.h"
#include "os.h"
#include "tep.h"
#include "tsort.h"
#include "texception.h"
#include "parser.h"
#include "parser.h"
#include "tdatablock.h"
#include "texception.h"
#include "tglobal.h"
#include "tglobal.h"
#include "tmsg.h"
#include "tmsg.h"
#include "tsort.h"
#include "ttime.h"
#include "ttime.h"
#include "executorimpl.h"
#include "executorimpl.h"
...
@@ -8730,10 +8730,8 @@ static void doSetTagValueToResultBuf(char* output, const char* val, int16_t type
...
@@ -8730,10 +8730,8 @@ static void doSetTagValueToResultBuf(char* output, const char* val, int16_t type
static
int64_t
getQuerySupportBufSize
(
size_t
numOfTables
)
{
static
int64_t
getQuerySupportBufSize
(
size_t
numOfTables
)
{
size_t
s1
=
sizeof
(
STableQueryInfo
);
size_t
s1
=
sizeof
(
STableQueryInfo
);
size_t
s2
=
sizeof
(
SHashNode
);
// size_t s3 = sizeof(STableCheckInfo); buffer consumption in tsdb
// size_t s3 = sizeof(STableCheckInfo); buffer consumption in tsdb
return
(
int64_t
)(
(
s1
+
s2
)
*
1
.
5
*
numOfTables
);
return
(
int64_t
)(
s1
*
1
.
5
*
numOfTables
);
}
}
int32_t
checkForQueryBuf
(
size_t
numOfTables
)
{
int32_t
checkForQueryBuf
(
size_t
numOfTables
)
{
...
...
source/libs/executor/src/tsort.c
浏览文件 @
a11a2f37
...
@@ -16,11 +16,11 @@
...
@@ -16,11 +16,11 @@
#include "tcommon.h"
#include "tcommon.h"
#include "query.h"
#include "query.h"
#include "tsort.h"
#include "tdatablock.h"
#include "tep.h"
#include "tdef.h"
#include "tdef.h"
#include "tlosertree.h"
#include "tlosertree.h"
#include "tpagedbuf.h"
#include "tpagedbuf.h"
#include "tsort.h"
#include "tutil.h"
#include "tutil.h"
typedef
struct
STupleHandle
{
typedef
struct
STupleHandle
{
...
...
source/libs/executor/test/executorTests.cpp
浏览文件 @
a11a2f37
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
#include "taos.h"
#include "taos.h"
#include "tdef.h"
#include "tdef.h"
#include "tvariant.h"
#include "tvariant.h"
#include "t
ep
.h"
#include "t
datablock
.h"
#include "trpc.h"
#include "trpc.h"
#include "stub.h"
#include "stub.h"
#include "executor.h"
#include "executor.h"
...
...
source/libs/executor/test/sortTests.cpp
浏览文件 @
a11a2f37
...
@@ -29,8 +29,8 @@
...
@@ -29,8 +29,8 @@
#include "executor.h"
#include "executor.h"
#include "stub.h"
#include "stub.h"
#include "taos.h"
#include "taos.h"
#include "tdatablock.h"
#include "tdef.h"
#include "tdef.h"
#include "tep.h"
#include "trpc.h"
#include "trpc.h"
#include "tvariant.h"
#include "tvariant.h"
...
...
source/libs/function/src/taggfunction.c
浏览文件 @
a11a2f37
...
@@ -28,8 +28,8 @@
...
@@ -28,8 +28,8 @@
#include "tbuffer.h"
#include "tbuffer.h"
#include "tcompression.h"
#include "tcompression.h"
//#include "queryLog.h"
//#include "queryLog.h"
#include "tdatablock.h"
#include "tudf.h"
#include "tudf.h"
#include "tep.h"
#define GET_INPUT_DATA_LIST(x) ((char *)((x)->pInput))
#define GET_INPUT_DATA_LIST(x) ((char *)((x)->pInput))
#define GET_INPUT_DATA(x, y) ((char*) colDataGetData((x)->pInput, (y)))
#define GET_INPUT_DATA(x, y) ((char*) colDataGetData((x)->pInput, (y)))
...
...
source/libs/index/inc/indexInt.h
浏览文件 @
a11a2f37
...
@@ -96,7 +96,7 @@ typedef struct SIndexTermQuery {
...
@@ -96,7 +96,7 @@ typedef struct SIndexTermQuery {
typedef
struct
Iterate
Iterate
;
typedef
struct
Iterate
Iterate
;
typedef
struct
IterateValue
{
typedef
struct
IterateValue
{
int8_t
type
;
int8_t
type
;
// opera type, ADD_VALUE/DELETE_VALUE
char
*
colVal
;
char
*
colVal
;
SArray
*
val
;
SArray
*
val
;
}
IterateValue
;
}
IterateValue
;
...
...
source/libs/index/inc/index_util.h
浏览文件 @
a11a2f37
...
@@ -54,7 +54,22 @@ extern "C" {
...
@@ -54,7 +54,22 @@ extern "C" {
* output:[4, 5]
* output:[4, 5]
*/
*/
void
iIntersection
(
SArray
*
interResults
,
SArray
*
finalResult
);
void
iIntersection
(
SArray
*
interResults
,
SArray
*
finalResult
);
/* multi sorted result intersection
* input: [1, 2, 4, 5]
* [2, 3, 4, 5]
* [1, 4, 5]
* output:[1, 2, 3, 4, 5]
*/
void
iUnion
(
SArray
*
interResults
,
SArray
*
finalResult
);
void
iUnion
(
SArray
*
interResults
,
SArray
*
finalResult
);
/* sorted array
* total: [1, 2, 4, 5, 7, 8]
* except: [4, 5]
* return: [1, 2, 7, 8]
*/
void
iExcept
(
SArray
*
total
,
SArray
*
except
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/libs/index/src/index.c
浏览文件 @
a11a2f37
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#include "index.h"
#include "index.h"
#include "indexInt.h"
#include "indexInt.h"
#include "index_cache.h"
#include "index_cache.h"
#include "index_comm.h"
#include "index_tfile.h"
#include "index_tfile.h"
#include "index_util.h"
#include "index_util.h"
#include "tdef.h"
#include "tdef.h"
...
@@ -30,8 +31,18 @@
...
@@ -30,8 +31,18 @@
void
*
indexQhandle
=
NULL
;
void
*
indexQhandle
=
NULL
;
static
char
JSON_COLUMN
[]
=
"JSON"
;
#define INDEX_MERGE_ADD_DEL(src, dst, tgt) \
{ \
bool f = false; \
for (int i = 0; i < taosArrayGetSize(src); i++) { \
if (*(uint64_t*)taosArrayGet(src, i) == tgt) { \
f = true; \
} \
} \
if (f == false) { \
taosArrayPush(dst, &tgt); \
} \
}
void
indexInit
()
{
void
indexInit
()
{
// refactor later
// refactor later
indexQhandle
=
taosInitScheduler
(
INDEX_QUEUE_SIZE
,
INDEX_NUM_OF_THREADS
,
"index"
);
indexQhandle
=
taosInitScheduler
(
INDEX_QUEUE_SIZE
,
INDEX_NUM_OF_THREADS
,
"index"
);
...
@@ -52,6 +63,12 @@ typedef struct SIdxColInfo {
...
@@ -52,6 +63,12 @@ typedef struct SIdxColInfo {
int
cVersion
;
int
cVersion
;
}
SIdxColInfo
;
}
SIdxColInfo
;
typedef
struct
SIdxTempResult
{
SArray
*
total
;
SArray
*
added
;
SArray
*
deled
;
}
SIdxTempResult
;
static
pthread_once_t
isInit
=
PTHREAD_ONCE_INIT
;
static
pthread_once_t
isInit
=
PTHREAD_ONCE_INIT
;
// static void indexInit();
// static void indexInit();
static
int
indexTermSearch
(
SIndex
*
sIdx
,
SIndexTermQuery
*
term
,
SArray
**
result
);
static
int
indexTermSearch
(
SIndex
*
sIdx
,
SIndexTermQuery
*
term
,
SArray
**
result
);
...
@@ -62,8 +79,7 @@ static int indexMergeFinalResults(SArray* interResults, EIndexOperatorType oTyp
...
@@ -62,8 +79,7 @@ static int indexMergeFinalResults(SArray* interResults, EIndexOperatorType oTyp
static
int
indexGenTFile
(
SIndex
*
index
,
IndexCache
*
cache
,
SArray
*
batch
);
static
int
indexGenTFile
(
SIndex
*
index
,
IndexCache
*
cache
,
SArray
*
batch
);
// merge cache and tfile by opera type
// merge cache and tfile by opera type
static
void
indexMergeCacheAndTFile
(
SArray
*
result
,
IterateValue
*
icache
,
IterateValue
*
iTfv
);
static
void
indexMergeCacheAndTFile
(
SArray
*
result
,
IterateValue
*
icache
,
IterateValue
*
iTfv
,
SIdxTempResult
*
helper
);
static
void
indexMergeSameKey
(
SArray
*
result
,
TFileValue
*
tv
);
// static int32_t indexSerialTermKey(SIndexTerm* itm, char* buf);
// static int32_t indexSerialTermKey(SIndexTerm* itm, char* buf);
// int32_t indexSerialKey(ICacheKey* key, char* buf);
// int32_t indexSerialKey(ICacheKey* key, char* buf);
...
@@ -379,7 +395,6 @@ static void indexInterResultsDestroy(SArray* results) {
...
@@ -379,7 +395,6 @@ static void indexInterResultsDestroy(SArray* results) {
static
int
indexMergeFinalResults
(
SArray
*
interResults
,
EIndexOperatorType
oType
,
SArray
*
fResults
)
{
static
int
indexMergeFinalResults
(
SArray
*
interResults
,
EIndexOperatorType
oType
,
SArray
*
fResults
)
{
// refactor, merge interResults into fResults by oType
// refactor, merge interResults into fResults by oType
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
interResults
);
i
--
)
{
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
interResults
);
i
--
)
{
SArray
*
t
=
taosArrayGetP
(
interResults
,
i
);
SArray
*
t
=
taosArrayGetP
(
interResults
,
i
);
taosArraySort
(
t
,
uidCompare
);
taosArraySort
(
t
,
uidCompare
);
...
@@ -398,44 +413,82 @@ static int indexMergeFinalResults(SArray* interResults, EIndexOperatorType oType
...
@@ -398,44 +413,82 @@ static int indexMergeFinalResults(SArray* interResults, EIndexOperatorType oType
return
0
;
return
0
;
}
}
static
void
indexMergeSameKey
(
SArray
*
result
,
TFileValue
*
tv
)
{
SIdxTempResult
*
sIdxTempResultCreate
()
{
int32_t
sz
=
result
?
taosArrayGetSize
(
result
)
:
0
;
SIdxTempResult
*
tr
=
calloc
(
1
,
sizeof
(
SIdxTempResult
));
tr
->
total
=
taosArrayInit
(
4
,
sizeof
(
uint64_t
));
tr
->
added
=
taosArrayInit
(
4
,
sizeof
(
uint64_t
));
tr
->
deled
=
taosArrayInit
(
4
,
sizeof
(
uint64_t
));
return
tr
;
}
void
sIdxTempResultClear
(
SIdxTempResult
*
tr
)
{
if
(
tr
==
NULL
)
{
return
;
}
taosArrayClear
(
tr
->
total
);
taosArrayClear
(
tr
->
added
);
taosArrayClear
(
tr
->
deled
);
}
void
sIdxTempResultDestroy
(
SIdxTempResult
*
tr
)
{
if
(
tr
==
NULL
)
{
return
;
}
taosArrayDestroy
(
tr
->
total
);
taosArrayDestroy
(
tr
->
added
);
taosArrayDestroy
(
tr
->
deled
);
}
static
void
sIdxTempResultMergeTo
(
SArray
*
result
,
SIdxTempResult
*
tr
)
{
taosArraySort
(
tr
->
total
,
uidCompare
);
taosArraySort
(
tr
->
added
,
uidCompare
);
taosArraySort
(
tr
->
deled
,
uidCompare
);
SArray
*
arrs
=
taosArrayInit
(
2
,
sizeof
(
void
*
));
taosArrayPush
(
arrs
,
&
tr
->
total
);
taosArrayPush
(
arrs
,
&
tr
->
added
);
iUnion
(
arrs
,
result
);
taosArrayDestroy
(
arrs
);
iExcept
(
result
,
tr
->
deled
);
}
static
void
indexMayMergeTempToFinalResult
(
SArray
*
result
,
TFileValue
*
tfv
,
SIdxTempResult
*
tr
)
{
int32_t
sz
=
taosArrayGetSize
(
result
);
if
(
sz
>
0
)
{
if
(
sz
>
0
)
{
// TODO(yihao): remove duplicate tableid
TFileValue
*
lv
=
taosArrayGetP
(
result
,
sz
-
1
);
TFileValue
*
lv
=
taosArrayGetP
(
result
,
sz
-
1
);
// indexError("merge colVal: %s", lv->colVal);
if
(
tfv
!=
NULL
&&
strcmp
(
lv
->
colVal
,
tfv
->
colVal
)
!=
0
)
{
if
(
strcmp
(
lv
->
colVal
,
tv
->
colVal
)
==
0
)
{
sIdxTempResultMergeTo
(
lv
->
tableId
,
tr
);
taosArrayAddAll
(
lv
->
tableId
,
tv
->
tableId
);
sIdxTempResultClear
(
tr
);
tfileValueDestroy
(
tv
);
taosArrayPush
(
result
,
&
tfv
);
}
else
if
(
tfv
==
NULL
)
{
// handle last iterator
sIdxTempResultMergeTo
(
lv
->
tableId
,
tr
);
}
else
{
}
else
{
taosArrayPush
(
result
,
&
tv
);
// temp result saved in help
tfileValueDestroy
(
tfv
);
}
}
}
else
{
}
else
{
taosArrayPush
(
result
,
&
tv
);
taosArrayPush
(
result
,
&
t
f
v
);
}
}
}
}
static
void
indexMergeCacheAndTFile
(
SArray
*
result
,
IterateValue
*
cv
,
IterateValue
*
tv
)
{
static
void
indexMergeCacheAndTFile
(
SArray
*
result
,
IterateValue
*
cv
,
IterateValue
*
tv
,
SIdxTempResult
*
tr
)
{
// opt
char
*
colVal
=
(
cv
!=
NULL
)
?
cv
->
colVal
:
tv
->
colVal
;
char
*
colVal
=
(
cv
!=
NULL
)
?
cv
->
colVal
:
tv
->
colVal
;
// design merge-algorithm later, too complicated to handle all kind of situation
TFileValue
*
tfv
=
tfileValueCreate
(
colVal
);
TFileValue
*
tfv
=
tfileValueCreate
(
colVal
);
indexMayMergeTempToFinalResult
(
result
,
tfv
,
tr
);
if
(
cv
!=
NULL
)
{
if
(
cv
!=
NULL
)
{
uint64_t
id
=
*
(
uint64_t
*
)
taosArrayGet
(
cv
->
val
,
0
);
if
(
cv
->
type
==
ADD_VALUE
)
{
if
(
cv
->
type
==
ADD_VALUE
)
{
taosArrayAddAll
(
tfv
->
tableId
,
cv
->
val
);
INDEX_MERGE_ADD_DEL
(
tr
->
deled
,
tr
->
added
,
id
)
}
else
if
(
cv
->
type
==
DEL_VALUE
)
{
}
else
if
(
cv
->
type
==
DEL_VALUE
)
{
}
else
if
(
cv
->
type
==
UPDATE_VALUE
)
{
INDEX_MERGE_ADD_DEL
(
tr
->
added
,
tr
->
deled
,
id
)
}
else
{
// do nothing
}
}
}
}
if
(
tv
!=
NULL
)
{
if
(
tv
!=
NULL
)
{
// opt later
taosArrayAddAll
(
tr
->
total
,
tv
->
val
);
taosArrayAddAll
(
tfv
->
tableId
,
tv
->
val
);
}
}
indexMergeSameKey
(
result
,
tfv
);
}
}
static
void
indexDestroy
Temp
Result
(
SArray
*
result
)
{
static
void
indexDestroy
Final
Result
(
SArray
*
result
)
{
int32_t
sz
=
result
?
taosArrayGetSize
(
result
)
:
0
;
int32_t
sz
=
result
?
taosArrayGetSize
(
result
)
:
0
;
for
(
size_t
i
=
0
;
i
<
sz
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
sz
;
i
++
)
{
TFileValue
*
tv
=
taosArrayGetP
(
result
,
i
);
TFileValue
*
tv
=
taosArrayGetP
(
result
,
i
);
...
@@ -443,6 +496,7 @@ static void indexDestroyTempResult(SArray* result) {
...
@@ -443,6 +496,7 @@ static void indexDestroyTempResult(SArray* result) {
}
}
taosArrayDestroy
(
result
);
taosArrayDestroy
(
result
);
}
}
int
indexFlushCacheToTFile
(
SIndex
*
sIdx
,
void
*
cache
)
{
int
indexFlushCacheToTFile
(
SIndex
*
sIdx
,
void
*
cache
)
{
if
(
sIdx
==
NULL
)
{
if
(
sIdx
==
NULL
)
{
return
-
1
;
return
-
1
;
...
@@ -467,6 +521,8 @@ int indexFlushCacheToTFile(SIndex* sIdx, void* cache) {
...
@@ -467,6 +521,8 @@ int indexFlushCacheToTFile(SIndex* sIdx, void* cache) {
bool
cn
=
cacheIter
?
cacheIter
->
next
(
cacheIter
)
:
false
;
bool
cn
=
cacheIter
?
cacheIter
->
next
(
cacheIter
)
:
false
;
bool
tn
=
tfileIter
?
tfileIter
->
next
(
tfileIter
)
:
false
;
bool
tn
=
tfileIter
?
tfileIter
->
next
(
tfileIter
)
:
false
;
SIdxTempResult
*
tr
=
sIdxTempResultCreate
();
while
(
cn
==
true
||
tn
==
true
)
{
while
(
cn
==
true
||
tn
==
true
)
{
IterateValue
*
cv
=
(
cn
==
true
)
?
cacheIter
->
getValue
(
cacheIter
)
:
NULL
;
IterateValue
*
cv
=
(
cn
==
true
)
?
cacheIter
->
getValue
(
cacheIter
)
:
NULL
;
IterateValue
*
tv
=
(
tn
==
true
)
?
tfileIter
->
getValue
(
tfileIter
)
:
NULL
;
IterateValue
*
tv
=
(
tn
==
true
)
?
tfileIter
->
getValue
(
tfileIter
)
:
NULL
;
...
@@ -480,19 +536,22 @@ int indexFlushCacheToTFile(SIndex* sIdx, void* cache) {
...
@@ -480,19 +536,22 @@ int indexFlushCacheToTFile(SIndex* sIdx, void* cache) {
comp
=
1
;
comp
=
1
;
}
}
if
(
comp
==
0
)
{
if
(
comp
==
0
)
{
indexMergeCacheAndTFile
(
result
,
cv
,
tv
);
indexMergeCacheAndTFile
(
result
,
cv
,
tv
,
tr
);
cn
=
cacheIter
->
next
(
cacheIter
);
cn
=
cacheIter
->
next
(
cacheIter
);
tn
=
tfileIter
->
next
(
tfileIter
);
tn
=
tfileIter
->
next
(
tfileIter
);
}
else
if
(
comp
<
0
)
{
}
else
if
(
comp
<
0
)
{
indexMergeCacheAndTFile
(
result
,
cv
,
NULL
);
indexMergeCacheAndTFile
(
result
,
cv
,
NULL
,
tr
);
cn
=
cacheIter
->
next
(
cacheIter
);
cn
=
cacheIter
->
next
(
cacheIter
);
}
else
{
}
else
{
indexMergeCacheAndTFile
(
result
,
NULL
,
tv
);
indexMergeCacheAndTFile
(
result
,
NULL
,
tv
,
tr
);
tn
=
tfileIter
->
next
(
tfileIter
);
tn
=
tfileIter
->
next
(
tfileIter
);
}
}
}
}
indexMayMergeTempToFinalResult
(
result
,
NULL
,
tr
);
sIdxTempResultDestroy
(
tr
);
int
ret
=
indexGenTFile
(
sIdx
,
pCache
,
result
);
int
ret
=
indexGenTFile
(
sIdx
,
pCache
,
result
);
indexDestroy
Temp
Result
(
result
);
indexDestroy
Final
Result
(
result
);
indexCacheDestroyImm
(
pCache
);
indexCacheDestroyImm
(
pCache
);
...
...
source/libs/index/src/index_cache.c
浏览文件 @
a11a2f37
...
@@ -267,6 +267,10 @@ static int indexQueryMem(MemTable* mem, CacheTerm* ct, EIndexQueryType qtype, SA
...
@@ -267,6 +267,10 @@ static int indexQueryMem(MemTable* mem, CacheTerm* ct, EIndexQueryType qtype, SA
SSkipListNode
*
node
=
tSkipListIterGet
(
iter
);
SSkipListNode
*
node
=
tSkipListIterGet
(
iter
);
if
(
node
!=
NULL
)
{
if
(
node
!=
NULL
)
{
CacheTerm
*
c
=
(
CacheTerm
*
)
SL_GET_NODE_DATA
(
node
);
CacheTerm
*
c
=
(
CacheTerm
*
)
SL_GET_NODE_DATA
(
node
);
// if (c->operaType == ADD_VALUE) {
//} else if (c->operaType == DEL_VALUE) {
//}
if
(
c
->
operaType
==
ADD_VALUE
||
qtype
==
QUERY_TERM
)
{
if
(
c
->
operaType
==
ADD_VALUE
||
qtype
==
QUERY_TERM
)
{
if
(
strcmp
(
c
->
colVal
,
ct
->
colVal
)
==
0
)
{
if
(
strcmp
(
c
->
colVal
,
ct
->
colVal
)
==
0
)
{
taosArrayPush
(
result
,
&
c
->
uid
);
taosArrayPush
(
result
,
&
c
->
uid
);
...
@@ -411,17 +415,8 @@ static bool indexCacheIteratorNext(Iterate* itera) {
...
@@ -411,17 +415,8 @@ static bool indexCacheIteratorNext(Iterate* itera) {
SSkipListNode
*
node
=
tSkipListIterGet
(
iter
);
SSkipListNode
*
node
=
tSkipListIterGet
(
iter
);
CacheTerm
*
ct
=
(
CacheTerm
*
)
SL_GET_NODE_DATA
(
node
);
CacheTerm
*
ct
=
(
CacheTerm
*
)
SL_GET_NODE_DATA
(
node
);
// equal func
// if (iv->colVal != NULL && ct->colVal != NULL) {
// if (0 == strcmp(iv->colVal, ct->colVal)) { if (iv->type == ADD_VALUE) }
//} else {
// tIterVal.colVal = calloc(1, strlen(ct->colVal) + 1);
// tIterval.colVal = tstrdup(ct->colVal);
//}
iv
->
type
=
ct
->
operaType
;
iv
->
type
=
ct
->
operaType
;
iv
->
colVal
=
tstrdup
(
ct
->
colVal
);
iv
->
colVal
=
tstrdup
(
ct
->
colVal
);
// iv->colVal = calloc(1, strlen(ct->colVal) + 1);
// memcpy(iv->colVal, ct->colVal, strlen(ct->colVal));
taosArrayPush
(
iv
->
val
,
&
ct
->
uid
);
taosArrayPush
(
iv
->
val
,
&
ct
->
uid
);
}
}
...
...
source/libs/index/src/index_tfile.c
浏览文件 @
a11a2f37
...
@@ -102,7 +102,6 @@ void tfileCacheDestroy(TFileCache* tcache) {
...
@@ -102,7 +102,6 @@ void tfileCacheDestroy(TFileCache* tcache) {
if
(
tcache
==
NULL
)
{
if
(
tcache
==
NULL
)
{
return
;
return
;
}
}
// free table cache
// free table cache
TFileReader
**
reader
=
taosHashIterate
(
tcache
->
tableCache
,
NULL
);
TFileReader
**
reader
=
taosHashIterate
(
tcache
->
tableCache
,
NULL
);
while
(
reader
)
{
while
(
reader
)
{
...
@@ -429,6 +428,7 @@ static bool tfileIteratorNext(Iterate* iiter) {
...
@@ -429,6 +428,7 @@ static bool tfileIteratorNext(Iterate* iiter) {
return
false
;
return
false
;
}
}
iv
->
type
=
ADD_VALUE
;
// value in tfile always ADD_VALUE
iv
->
colVal
=
colVal
;
iv
->
colVal
=
colVal
;
return
true
;
return
true
;
// std::string key(ch, sz);
// std::string key(ch, sz);
...
...
source/libs/index/src/index_util.c
浏览文件 @
a11a2f37
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
*/
*/
#include "index_util.h"
#include "index_util.h"
#include "index.h"
#include "index.h"
typedef
struct
MergeIndex
{
typedef
struct
MergeIndex
{
int
idx
;
int
idx
;
int
len
;
int
len
;
...
@@ -111,6 +112,26 @@ void iUnion(SArray *inters, SArray *final) {
...
@@ -111,6 +112,26 @@ void iUnion(SArray *inters, SArray *final) {
break
;
break
;
}
}
}
}
tfree
(
mi
);
tfree
(
mi
);
}
}
void
iExcept
(
SArray
*
total
,
SArray
*
except
)
{
int32_t
tsz
=
taosArrayGetSize
(
total
);
int32_t
esz
=
taosArrayGetSize
(
except
);
if
(
esz
==
0
||
tsz
==
0
)
{
return
;
}
int
vIdx
=
0
;
for
(
int
i
=
0
;
i
<
tsz
;
i
++
)
{
uint64_t
val
=
*
(
uint64_t
*
)
taosArrayGet
(
total
,
i
);
int
idx
=
iBinarySearch
(
except
,
0
,
esz
-
1
,
val
);
if
(
idx
>=
0
&&
idx
<
esz
&&
*
(
uint64_t
*
)
taosArrayGet
(
except
,
idx
)
==
val
)
{
continue
;
}
taosArraySet
(
total
,
vIdx
,
&
val
);
vIdx
+=
1
;
}
taosArrayPopTailBatch
(
total
,
tsz
-
vIdx
);
}
source/libs/index/test/fstTest.cc
浏览文件 @
a11a2f37
...
@@ -19,7 +19,7 @@ static std::string fileName = "/tmp/tindex.tindex";
...
@@ -19,7 +19,7 @@ static std::string fileName = "/tmp/tindex.tindex";
class
FstWriter
{
class
FstWriter
{
public:
public:
FstWriter
()
{
FstWriter
()
{
remov
e
(
fileName
.
c_str
());
taosRemoveFil
e
(
fileName
.
c_str
());
_wc
=
writerCtxCreate
(
TFile
,
fileName
.
c_str
(),
false
,
64
*
1024
*
1024
);
_wc
=
writerCtxCreate
(
TFile
,
fileName
.
c_str
(),
false
,
64
*
1024
*
1024
);
_b
=
fstBuilderCreate
(
_wc
,
0
);
_b
=
fstBuilderCreate
(
_wc
,
0
);
}
}
...
...
source/libs/index/test/jsonUT.cc
浏览文件 @
a11a2f37
...
@@ -105,6 +105,22 @@ TEST_F(JsonEnv, testWriteMillonData) {
...
@@ -105,6 +105,22 @@ TEST_F(JsonEnv, testWriteMillonData) {
}
}
indexMultiTermDestroy
(
terms
);
indexMultiTermDestroy
(
terms
);
}
}
{
std
::
string
colName
(
"voltagefdadfa"
);
std
::
string
colVal
(
"abxxxxxxxxxxxx"
);
for
(
uint
i
=
0
;
i
<
1000
;
i
++
)
{
colVal
[
i
%
colVal
.
size
()]
=
'0'
+
i
%
128
;
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
indexMultiTermAdd
(
terms
,
term
);
for
(
size_t
i
=
0
;
i
<
1000
;
i
++
)
{
tIndexJsonPut
(
index
,
terms
,
i
);
}
indexMultiTermDestroy
(
terms
);
}
}
{
{
std
::
string
colName
(
"voltagefdadfa"
);
std
::
string
colName
(
"voltagefdadfa"
);
std
::
string
colVal
(
"abxxxxxxxxxxxx"
);
std
::
string
colVal
(
"abxxxxxxxxxxxx"
);
...
...
source/libs/index/test/utilUT.cc
浏览文件 @
a11a2f37
...
@@ -224,3 +224,84 @@ TEST_F(UtilEnv, 04union) {
...
@@ -224,3 +224,84 @@ TEST_F(UtilEnv, 04union) {
iUnion
(
src
,
rslt
);
iUnion
(
src
,
rslt
);
assert
(
taosArrayGetSize
(
rslt
)
==
12
);
assert
(
taosArrayGetSize
(
rslt
)
==
12
);
}
}
TEST_F
(
UtilEnv
,
01
Except
)
{
SArray
*
total
=
taosArrayInit
(
4
,
sizeof
(
uint64_t
));
{
uint64_t
arr1
[]
=
{
1
,
4
,
5
,
6
};
for
(
int
i
=
0
;
i
<
sizeof
(
arr1
)
/
sizeof
(
arr1
[
0
]);
i
++
)
{
taosArrayPush
(
total
,
&
arr1
[
i
]);
}
}
SArray
*
except
=
taosArrayInit
(
4
,
sizeof
(
uint64_t
));
{
uint64_t
arr1
[]
=
{
1
,
4
,
5
,
6
};
for
(
int
i
=
0
;
i
<
sizeof
(
arr1
)
/
sizeof
(
arr1
[
0
]);
i
++
)
{
taosArrayPush
(
except
,
&
arr1
[
i
]);
}
}
iExcept
(
total
,
except
);
ASSERT_EQ
(
taosArrayGetSize
(
total
),
0
);
taosArrayClear
(
total
);
taosArrayClear
(
except
);
{
uint64_t
arr1
[]
=
{
1
,
4
,
5
,
6
,
7
,
8
};
for
(
int
i
=
0
;
i
<
sizeof
(
arr1
)
/
sizeof
(
arr1
[
0
]);
i
++
)
{
taosArrayPush
(
total
,
&
arr1
[
i
]);
}
}
{
uint64_t
arr1
[]
=
{
2
,
4
,
5
,
6
};
for
(
int
i
=
0
;
i
<
sizeof
(
arr1
)
/
sizeof
(
arr1
[
0
]);
i
++
)
{
taosArrayPush
(
except
,
&
arr1
[
i
]);
}
}
iExcept
(
total
,
except
);
ASSERT_EQ
(
taosArrayGetSize
(
total
),
3
);
taosArrayClear
(
total
);
taosArrayClear
(
except
);
{
uint64_t
arr1
[]
=
{
1
,
4
,
5
,
6
,
7
,
8
,
10
,
100
};
for
(
int
i
=
0
;
i
<
sizeof
(
arr1
)
/
sizeof
(
arr1
[
0
]);
i
++
)
{
taosArrayPush
(
total
,
&
arr1
[
i
]);
}
}
{
uint64_t
arr1
[]
=
{
2
,
4
,
5
,
6
};
for
(
int
i
=
0
;
i
<
sizeof
(
arr1
)
/
sizeof
(
arr1
[
0
]);
i
++
)
{
taosArrayPush
(
except
,
&
arr1
[
i
]);
}
}
iExcept
(
total
,
except
);
ASSERT_EQ
(
taosArrayGetSize
(
total
),
5
);
ASSERT_EQ
(
*
(
uint64_t
*
)
taosArrayGet
(
total
,
0
),
1
);
ASSERT_EQ
(
*
(
uint64_t
*
)
taosArrayGet
(
total
,
1
),
7
);
ASSERT_EQ
(
*
(
uint64_t
*
)
taosArrayGet
(
total
,
2
),
8
);
ASSERT_EQ
(
*
(
uint64_t
*
)
taosArrayGet
(
total
,
3
),
10
);
ASSERT_EQ
(
*
(
uint64_t
*
)
taosArrayGet
(
total
,
4
),
100
);
taosArrayClear
(
total
);
taosArrayClear
(
except
);
{
uint64_t
arr1
[]
=
{
1
,
100
};
for
(
int
i
=
0
;
i
<
sizeof
(
arr1
)
/
sizeof
(
arr1
[
0
]);
i
++
)
{
taosArrayPush
(
total
,
&
arr1
[
i
]);
}
}
{
uint64_t
arr1
[]
=
{
2
,
4
,
5
,
6
};
for
(
int
i
=
0
;
i
<
sizeof
(
arr1
)
/
sizeof
(
arr1
[
0
]);
i
++
)
{
taosArrayPush
(
except
,
&
arr1
[
i
]);
}
}
iExcept
(
total
,
except
);
ASSERT_EQ
(
taosArrayGetSize
(
total
),
2
);
ASSERT_EQ
(
*
(
uint64_t
*
)
taosArrayGet
(
total
,
0
),
1
);
ASSERT_EQ
(
*
(
uint64_t
*
)
taosArrayGet
(
total
,
1
),
100
);
}
source/libs/parser/test/mockCatalogService.cpp
浏览文件 @
a11a2f37
...
@@ -15,10 +15,10 @@
...
@@ -15,10 +15,10 @@
#include "mockCatalogService.h"
#include "mockCatalogService.h"
#include "tep.h"
#include <iomanip>
#include <iomanip>
#include <iostream>
#include <iostream>
#include <map>
#include <map>
#include "tdatablock.h"
#include "tname.h"
#include "tname.h"
#include "ttypes.h"
#include "ttypes.h"
...
...
source/libs/qcom/src/queryUtil.c
浏览文件 @
a11a2f37
/*
* 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/>.
*/
#include "os.h"
#include "os.h"
#include "tmsg.h"
#include "query.h"
#include "query.h"
#include "tglobal.h"
#include "tglobal.h"
#include "t
sched
.h"
#include "t
msg
.h"
#include "trpc.h"
#include "trpc.h"
#include "tsched.h"
#define VALIDNUMOFCOLS(x) ((x) >= TSDB_MIN_COLUMNS && (x) <= TSDB_MAX_COLUMNS)
#define VALIDNUMOFCOLS(x) ((x) >= TSDB_MIN_COLUMNS && (x) <= TSDB_MAX_COLUMNS)
#define VALIDNUMOFTAGS(x) ((x) >= 0 && (x) <= TSDB_MAX_TAGS)
#define VALIDNUMOFTAGS(x) ((x) >= 0 && (x) <= TSDB_MAX_TAGS)
...
@@ -15,9 +30,7 @@ static struct SSchema _s = {
...
@@ -15,9 +30,7 @@ static struct SSchema _s = {
.
name
=
"tbname"
,
.
name
=
"tbname"
,
};
};
const
SSchema
*
tGetTbnameColumnSchema
()
{
const
SSchema
*
tGetTbnameColumnSchema
()
{
return
&
_s
;
}
return
&
_s
;
}
static
bool
doValidateSchema
(
SSchema
*
pSchema
,
int32_t
numOfCols
,
int32_t
maxLen
)
{
static
bool
doValidateSchema
(
SSchema
*
pSchema
,
int32_t
numOfCols
,
int32_t
maxLen
)
{
int32_t
rowLen
=
0
;
int32_t
rowLen
=
0
;
...
@@ -96,19 +109,21 @@ int32_t initTaskQueue() {
...
@@ -96,19 +109,21 @@ int32_t initTaskQueue() {
}
}
qDebug
(
"task queue is initialized, numOfThreads: %d"
,
numOfThreads
);
qDebug
(
"task queue is initialized, numOfThreads: %d"
,
numOfThreads
);
return
0
;
}
}
int32_t
cleanupTaskQueue
()
{
int32_t
cleanupTaskQueue
()
{
taosCleanUpScheduler
(
pTaskQueue
);
taosCleanUpScheduler
(
pTaskQueue
);
return
0
;
}
}
static
void
execHelper
(
struct
SSchedMsg
*
pSchedMsg
)
{
static
void
execHelper
(
struct
SSchedMsg
*
pSchedMsg
)
{
assert
(
pSchedMsg
!=
NULL
&&
pSchedMsg
->
ahandle
!=
NULL
);
assert
(
pSchedMsg
!=
NULL
&&
pSchedMsg
->
ahandle
!=
NULL
);
__async_exec_fn_t
execFn
=
(
__async_exec_fn_t
)
pSchedMsg
->
ahandle
;
__async_exec_fn_t
execFn
=
(
__async_exec_fn_t
)
pSchedMsg
->
ahandle
;
int32_t
code
=
execFn
(
pSchedMsg
->
thandle
);
int32_t
code
=
execFn
(
pSchedMsg
->
thandle
);
if
(
code
!=
0
&&
pSchedMsg
->
msg
!=
NULL
)
{
if
(
code
!=
0
&&
pSchedMsg
->
msg
!=
NULL
)
{
*
(
int32_t
*
)
pSchedMsg
->
msg
=
code
;
*
(
int32_t
*
)
pSchedMsg
->
msg
=
code
;
}
}
}
}
...
@@ -122,25 +137,24 @@ int32_t taosAsyncExec(__async_exec_fn_t execFn, void* execParam, int32_t* code)
...
@@ -122,25 +137,24 @@ int32_t taosAsyncExec(__async_exec_fn_t execFn, void* execParam, int32_t* code)
schedMsg
.
msg
=
code
;
schedMsg
.
msg
=
code
;
taosScheduleTask
(
pTaskQueue
,
&
schedMsg
);
taosScheduleTask
(
pTaskQueue
,
&
schedMsg
);
return
0
;
}
}
int32_t
asyncSendMsgToServer
(
void
*
pTransporter
,
SEpSet
*
epSet
,
int64_t
*
pTransporterId
,
const
SMsgSendInfo
*
pInfo
)
{
int32_t
asyncSendMsgToServer
(
void
*
pTransporter
,
SEpSet
*
epSet
,
int64_t
*
pTransporterId
,
const
SMsgSendInfo
*
pInfo
)
{
char
*
pMsg
=
rpcMallocCont
(
pInfo
->
msgInfo
.
len
);
char
*
pMsg
=
rpcMallocCont
(
pInfo
->
msgInfo
.
len
);
if
(
NULL
==
pMsg
)
{
if
(
NULL
==
pMsg
)
{
qError
(
"0x%"
PRIx64
" msg:%s malloc failed"
,
pInfo
->
requestId
,
TMSG_INFO
(
pInfo
->
msgType
));
qError
(
"0x%"
PRIx64
" msg:%s malloc failed"
,
pInfo
->
requestId
,
TMSG_INFO
(
pInfo
->
msgType
));
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
terrno
;
return
terrno
;
}
}
memcpy
(
pMsg
,
pInfo
->
msgInfo
.
pData
,
pInfo
->
msgInfo
.
len
);
memcpy
(
pMsg
,
pInfo
->
msgInfo
.
pData
,
pInfo
->
msgInfo
.
len
);
SRpcMsg
rpcMsg
=
{
SRpcMsg
rpcMsg
=
{.
msgType
=
pInfo
->
msgType
,
.
msgType
=
pInfo
->
msgType
,
.
pCont
=
pMsg
,
.
pCont
=
pMsg
,
.
contLen
=
pInfo
->
msgInfo
.
len
,
.
contLen
=
pInfo
->
msgInfo
.
len
,
.
ahandle
=
(
void
*
)
pInfo
,
.
ahandle
=
(
void
*
)
pInfo
,
.
handle
=
pInfo
->
msgInfo
.
handle
,
.
handle
=
pInfo
->
msgInfo
.
handle
,
.
code
=
0
.
code
=
0
};
};
assert
(
pInfo
->
fp
!=
NULL
);
assert
(
pInfo
->
fp
!=
NULL
);
...
...
source/libs/qworker/test/qworkerTests.cpp
浏览文件 @
a11a2f37
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
#include "taos.h"
#include "taos.h"
#include "tdef.h"
#include "tdef.h"
#include "tvariant.h"
#include "tvariant.h"
#include "t
ep
.h"
#include "t
datablock
.h"
#include "trpc.h"
#include "trpc.h"
#include "planner.h"
#include "planner.h"
#include "qworker.h"
#include "qworker.h"
...
...
source/libs/scalar/inc/filterInt.h
浏览文件 @
a11a2f37
...
@@ -20,13 +20,13 @@
...
@@ -20,13 +20,13 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
#include "query.h"
#include "querynodes.h"
#include "scalar.h"
#include "tcommon.h"
#include "tdatablock.h"
#include "thash.h"
#include "thash.h"
#include "tname.h"
#include "tname.h"
#include "tcommon.h"
#include "scalar.h"
#include "querynodes.h"
#include "query.h"
#include "tep.h"
#define FILTER_DEFAULT_GROUP_SIZE 4
#define FILTER_DEFAULT_GROUP_SIZE 4
#define FILTER_DEFAULT_UNIT_SIZE 4
#define FILTER_DEFAULT_UNIT_SIZE 4
...
...
source/libs/scalar/src/filter.c
浏览文件 @
a11a2f37
...
@@ -16,11 +16,11 @@
...
@@ -16,11 +16,11 @@
#include <tlog.h>
#include <tlog.h>
#include "thash.h"
#include "thash.h"
//#include "queryLog.h"
//#include "queryLog.h"
#include "
tcompare
.h"
#include "
filter
.h"
#include "filterInt.h"
#include "filterInt.h"
#include "sclInt.h"
#include "sclInt.h"
#include "
filter
.h"
#include "
tcompare
.h"
#include "t
ep
.h"
#include "t
datablock
.h"
OptrStr
gOptrStr
[]
=
{
OptrStr
gOptrStr
[]
=
{
{
0
,
"invalid"
},
{
0
,
"invalid"
},
...
...
source/libs/scalar/src/scalar.c
浏览文件 @
a11a2f37
#include "nodes.h"
#include "tcommon.h"
#include "querynodes.h"
#include "function.h"
#include "function.h"
#include "functionMgt.h"
#include "functionMgt.h"
#include "sclvector.h"
#include "nodes.h"
#include "querynodes.h"
#include "sclInt.h"
#include "sclInt.h"
#include "tep.h"
#include "sclvector.h"
#include "tcommon.h"
#include "tdatablock.h"
int32_t
scalarGetOperatorParamNum
(
EOperatorType
type
)
{
int32_t
scalarGetOperatorParamNum
(
EOperatorType
type
)
{
if
(
OP_TYPE_IS_NULL
==
type
||
OP_TYPE_IS_NOT_NULL
==
type
||
OP_TYPE_IS_TRUE
==
type
||
OP_TYPE_IS_NOT_TRUE
==
type
if
(
OP_TYPE_IS_NULL
==
type
||
OP_TYPE_IS_NOT_NULL
==
type
||
OP_TYPE_IS_TRUE
==
type
||
OP_TYPE_IS_NOT_TRUE
==
type
...
...
source/libs/scalar/src/sclvector.c
浏览文件 @
a11a2f37
...
@@ -15,15 +15,15 @@
...
@@ -15,15 +15,15 @@
#include "os.h"
#include "os.h"
#include "ttypes.h"
#include "filter.h"
#include "sclvector.h"
#include "tcompare.h"
#include "querynodes.h"
#include "filterInt.h"
#include "filterInt.h"
#include "query.h"
#include "query.h"
#include "querynodes.h"
#include "sclInt.h"
#include "sclInt.h"
#include "tep.h"
#include "sclvector.h"
#include "filter.h"
#include "tcompare.h"
#include "tdatablock.h"
#include "ttypes.h"
//GET_TYPED_DATA(v, double, pRight->type, (char *)&((right)[i]));
//GET_TYPED_DATA(v, double, pRight->type, (char *)&((right)[i]));
...
...
source/libs/scalar/test/filter/filterTests.cpp
浏览文件 @
a11a2f37
...
@@ -33,12 +33,18 @@
...
@@ -33,12 +33,18 @@
#include "taos.h"
#include "taos.h"
#include "tdef.h"
#include "tdef.h"
#include "tvariant.h"
#include "tvariant.h"
#include "t
ep
.h"
#include "t
datablock
.h"
#include "stub.h"
#include "stub.h"
#include "scalar.h"
#include "scalar.h"
#include "filter.h"
#include "nodes.h"
#include "nodes.h"
#include "scalar.h"
#include "stub.h"
#include "taos.h"
#include "tdatablock.h"
#include "tdef.h"
#include "tlog.h"
#include "tlog.h"
#include "
filter
.h"
#include "
tvariant
.h"
namespace
{
namespace
{
...
...
source/libs/scalar/test/scalar/scalarTests.cpp
浏览文件 @
a11a2f37
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
#include "taos.h"
#include "taos.h"
#include "tdef.h"
#include "tdef.h"
#include "tvariant.h"
#include "tvariant.h"
#include "t
ep
.h"
#include "t
datablock
.h"
#include "stub.h"
#include "stub.h"
#include "scalar.h"
#include "scalar.h"
#include "nodes.h"
#include "nodes.h"
...
...
source/libs/scheduler/test/schedulerTests.cpp
浏览文件 @
a11a2f37
...
@@ -34,8 +34,20 @@
...
@@ -34,8 +34,20 @@
#include "tvariant.h"
#include "tvariant.h"
#include "catalog.h"
#include "catalog.h"
#include "scheduler.h"
#include "scheduler.h"
#include "tep.h"
#include "taos.h"
#include "tdatablock.h"
#include "tdef.h"
#include "trpc.h"
#include "trpc.h"
#include "tvariant.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wwrite-strings"
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wsign-compare"
#pragma GCC diagnostic ignored "-Wreturn-type"
#pragma GCC diagnostic ignored "-Wformat"
#include "schedulerInt.h"
#include "schedulerInt.h"
#include "stub.h"
#include "stub.h"
#include "tref.h"
#include "tref.h"
...
...
source/libs/sync/src/syncIO.c
浏览文件 @
a11a2f37
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
*/
*/
#include "syncIO.h"
#include "syncIO.h"
#include <t
ep
.h>
#include <t
datablock
.h>
#include "syncOnMessage.h"
#include "syncOnMessage.h"
#include "tglobal.h"
#include "tglobal.h"
#include "ttimer.h"
#include "ttimer.h"
...
...
source/libs/tfs/src/tfs.c
浏览文件 @
a11a2f37
...
@@ -202,7 +202,7 @@ void tfsDirname(const STfsFile *pFile, char *dest) {
...
@@ -202,7 +202,7 @@ void tfsDirname(const STfsFile *pFile, char *dest) {
tstrncpy
(
dest
,
dirname
(
tname
),
TSDB_FILENAME_LEN
);
tstrncpy
(
dest
,
dirname
(
tname
),
TSDB_FILENAME_LEN
);
}
}
int32_t
tfsRemoveFile
(
const
STfsFile
*
pFile
)
{
return
remov
e
(
pFile
->
aname
);
}
int32_t
tfsRemoveFile
(
const
STfsFile
*
pFile
)
{
return
taosRemoveFil
e
(
pFile
->
aname
);
}
int32_t
tfsCopyFile
(
const
STfsFile
*
pFile1
,
const
STfsFile
*
pFile2
)
{
int32_t
tfsCopyFile
(
const
STfsFile
*
pFile1
,
const
STfsFile
*
pFile2
)
{
return
taosCopyFile
(
pFile1
->
aname
,
pFile2
->
aname
);
return
taosCopyFile
(
pFile1
->
aname
,
pFile2
->
aname
);
...
...
source/libs/transport/test/pushClient.c
浏览文件 @
a11a2f37
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
*/
*/
#include <sys/time.h>
#include <sys/time.h>
#include <t
ep
.h>
#include <t
datablock
.h>
#include "os.h"
#include "os.h"
#include "rpcLog.h"
#include "rpcLog.h"
#include "taoserror.h"
#include "taoserror.h"
...
...
source/libs/transport/test/pushServer.c
浏览文件 @
a11a2f37
...
@@ -192,7 +192,7 @@ int main(int argc, char *argv[]) {
...
@@ -192,7 +192,7 @@ int main(int argc, char *argv[]) {
if
(
pDataFile
!=
NULL
)
{
if
(
pDataFile
!=
NULL
)
{
taosCloseFile
(
&
pDataFile
);
taosCloseFile
(
&
pDataFile
);
remov
e
(
dataName
);
taosRemoveFil
e
(
dataName
);
}
}
return
0
;
return
0
;
...
...
source/libs/transport/test/rclient.c
浏览文件 @
a11a2f37
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
*/
*/
#include <sys/time.h>
#include <sys/time.h>
#include <t
ep
.h>
#include <t
datablock
.h>
#include "os.h"
#include "os.h"
#include "rpcLog.h"
#include "rpcLog.h"
#include "taoserror.h"
#include "taoserror.h"
...
...
source/libs/transport/test/rserver.c
浏览文件 @
a11a2f37
...
@@ -181,7 +181,7 @@ int main(int argc, char *argv[]) {
...
@@ -181,7 +181,7 @@ int main(int argc, char *argv[]) {
if
(
pDataFile
!=
NULL
)
{
if
(
pDataFile
!=
NULL
)
{
taosCloseFile
(
&
pDataFile
);
taosCloseFile
(
&
pDataFile
);
remov
e
(
dataName
);
taosRemoveFil
e
(
dataName
);
}
}
return
0
;
return
0
;
...
...
source/libs/transport/test/syncClient.c
浏览文件 @
a11a2f37
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
*/
*/
#include <sys/time.h>
#include <sys/time.h>
#include <t
ep
.h>
#include <t
datablock
.h>
#include "os.h"
#include "os.h"
#include "rpcLog.h"
#include "rpcLog.h"
#include "taoserror.h"
#include "taoserror.h"
...
...
source/libs/transport/test/transUT.cc
浏览文件 @
a11a2f37
...
@@ -15,10 +15,10 @@
...
@@ -15,10 +15,10 @@
#include <gtest/gtest.h>
#include <gtest/gtest.h>
#include <cstdio>
#include <cstdio>
#include <cstring>
#include <cstring>
#include "t
ep
.h"
#include "t
datablock
.h"
#include "tglobal.h"
#include "tglobal.h"
#include "trpc.h"
#include "tlog.h"
#include "tlog.h"
#include "trpc.h"
using
namespace
std
;
using
namespace
std
;
const
char
*
label
=
"APP"
;
const
char
*
label
=
"APP"
;
...
...
source/libs/wal/src/walMeta.c
浏览文件 @
a11a2f37
...
@@ -379,7 +379,7 @@ int walSaveMeta(SWal* pWal) {
...
@@ -379,7 +379,7 @@ int walSaveMeta(SWal* pWal) {
// delete old file
// delete old file
if
(
metaVer
>
-
1
)
{
if
(
metaVer
>
-
1
)
{
walBuildMetaName
(
pWal
,
metaVer
,
fnameStr
);
walBuildMetaName
(
pWal
,
metaVer
,
fnameStr
);
remov
e
(
fnameStr
);
taosRemoveFil
e
(
fnameStr
);
}
}
free
(
serialized
);
free
(
serialized
);
return
0
;
return
0
;
...
...
source/libs/wal/src/walWrite.c
浏览文件 @
a11a2f37
...
@@ -55,9 +55,9 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
...
@@ -55,9 +55,9 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
int
fileSetSize
=
taosArrayGetSize
(
pWal
->
fileInfoSet
);
int
fileSetSize
=
taosArrayGetSize
(
pWal
->
fileInfoSet
);
for
(
int
i
=
pWal
->
writeCur
;
i
<
fileSetSize
;
i
++
)
{
for
(
int
i
=
pWal
->
writeCur
;
i
<
fileSetSize
;
i
++
)
{
walBuildLogName
(
pWal
,
((
SWalFileInfo
*
)
taosArrayGet
(
pWal
->
fileInfoSet
,
i
))
->
firstVer
,
fnameStr
);
walBuildLogName
(
pWal
,
((
SWalFileInfo
*
)
taosArrayGet
(
pWal
->
fileInfoSet
,
i
))
->
firstVer
,
fnameStr
);
remov
e
(
fnameStr
);
taosRemoveFil
e
(
fnameStr
);
walBuildIdxName
(
pWal
,
((
SWalFileInfo
*
)
taosArrayGet
(
pWal
->
fileInfoSet
,
i
))
->
firstVer
,
fnameStr
);
walBuildIdxName
(
pWal
,
((
SWalFileInfo
*
)
taosArrayGet
(
pWal
->
fileInfoSet
,
i
))
->
firstVer
,
fnameStr
);
remov
e
(
fnameStr
);
taosRemoveFil
e
(
fnameStr
);
}
}
// pop from fileInfoSet
// pop from fileInfoSet
taosArraySetSize
(
pWal
->
fileInfoSet
,
pWal
->
writeCur
+
1
);
taosArraySetSize
(
pWal
->
fileInfoSet
,
pWal
->
writeCur
+
1
);
...
@@ -162,8 +162,8 @@ int32_t walEndSnapshot(SWal *pWal) {
...
@@ -162,8 +162,8 @@ int32_t walEndSnapshot(SWal *pWal) {
}
}
// iterate files, until the searched result
// iterate files, until the searched result
for
(
SWalFileInfo
*
iter
=
pWal
->
fileInfoSet
->
pData
;
iter
<
pInfo
;
iter
++
)
{
for
(
SWalFileInfo
*
iter
=
pWal
->
fileInfoSet
->
pData
;
iter
<
pInfo
;
iter
++
)
{
if
((
pWal
->
cfg
.
retentionSize
!=
-
1
&&
pWal
->
totSize
>
pWal
->
cfg
.
retentionSize
)
if
((
pWal
->
cfg
.
retentionSize
!=
-
1
&&
pWal
->
totSize
>
pWal
->
cfg
.
retentionSize
)
||
||
(
pWal
->
cfg
.
retentionPeriod
!=
-
1
&&
iter
->
closeTs
+
pWal
->
cfg
.
retentionPeriod
>
ts
))
{
(
pWal
->
cfg
.
retentionPeriod
!=
-
1
&&
iter
->
closeTs
+
pWal
->
cfg
.
retentionPeriod
>
ts
))
{
// delete according to file size or close time
// delete according to file size or close time
deleteCnt
++
;
deleteCnt
++
;
newTotSize
-=
iter
->
fileSize
;
newTotSize
-=
iter
->
fileSize
;
...
@@ -174,9 +174,9 @@ int32_t walEndSnapshot(SWal *pWal) {
...
@@ -174,9 +174,9 @@ int32_t walEndSnapshot(SWal *pWal) {
for
(
int
i
=
0
;
i
<
deleteCnt
;
i
++
)
{
for
(
int
i
=
0
;
i
<
deleteCnt
;
i
++
)
{
SWalFileInfo
*
pInfo
=
taosArrayGet
(
pWal
->
fileInfoSet
,
i
);
SWalFileInfo
*
pInfo
=
taosArrayGet
(
pWal
->
fileInfoSet
,
i
);
walBuildLogName
(
pWal
,
pInfo
->
firstVer
,
fnameStr
);
walBuildLogName
(
pWal
,
pInfo
->
firstVer
,
fnameStr
);
remov
e
(
fnameStr
);
taosRemoveFil
e
(
fnameStr
);
walBuildIdxName
(
pWal
,
pInfo
->
firstVer
,
fnameStr
);
walBuildIdxName
(
pWal
,
pInfo
->
firstVer
,
fnameStr
);
remov
e
(
fnameStr
);
taosRemoveFil
e
(
fnameStr
);
}
}
// make new array, remove files
// make new array, remove files
...
@@ -279,6 +279,7 @@ int64_t walWrite(SWal *pWal, int64_t index, tmsg_t msgType, const void *body, in
...
@@ -279,6 +279,7 @@ int64_t walWrite(SWal *pWal, int64_t index, tmsg_t msgType, const void *body, in
}
else
{
}
else
{
// reject skip log or rewrite log
// reject skip log or rewrite log
// must truncate explicitly first
// must truncate explicitly first
terrno
=
TSDB_CODE_WAL_INVALID_VER
;
return
-
1
;
return
-
1
;
}
}
/*if (!tfValid(pWal->pWriteLogTFile)) return -1;*/
/*if (!tfValid(pWal->pWriteLogTFile)) return -1;*/
...
@@ -303,16 +304,18 @@ int64_t walWrite(SWal *pWal, int64_t index, tmsg_t msgType, const void *body, in
...
@@ -303,16 +304,18 @@ int64_t walWrite(SWal *pWal, int64_t index, tmsg_t msgType, const void *body, in
if
(
taosWriteFile
(
pWal
->
pWriteLogTFile
,
&
pWal
->
writeHead
,
sizeof
(
SWalHead
))
!=
sizeof
(
SWalHead
))
{
if
(
taosWriteFile
(
pWal
->
pWriteLogTFile
,
&
pWal
->
writeHead
,
sizeof
(
SWalHead
))
!=
sizeof
(
SWalHead
))
{
// ftruncate
// ftruncate
code
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
wError
(
"vgId:%d, file:%"
PRId64
".log, failed to write since %s"
,
pWal
->
cfg
.
vgId
,
walGetLastFileFirstVer
(
pWal
),
wError
(
"vgId:%d, file:%"
PRId64
".log, failed to write since %s"
,
pWal
->
cfg
.
vgId
,
walGetLastFileFirstVer
(
pWal
),
strerror
(
errno
));
strerror
(
errno
));
return
-
1
;
}
}
if
(
taosWriteFile
(
pWal
->
pWriteLogTFile
,
(
char
*
)
body
,
bodyLen
)
!=
bodyLen
)
{
if
(
taosWriteFile
(
pWal
->
pWriteLogTFile
,
(
char
*
)
body
,
bodyLen
)
!=
bodyLen
)
{
// ftruncate
// ftruncate
code
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
wError
(
"vgId:%d, file:%"
PRId64
".log, failed to write since %s"
,
pWal
->
cfg
.
vgId
,
walGetLastFileFirstVer
(
pWal
),
wError
(
"vgId:%d, file:%"
PRId64
".log, failed to write since %s"
,
pWal
->
cfg
.
vgId
,
walGetLastFileFirstVer
(
pWal
),
strerror
(
errno
));
strerror
(
errno
));
return
-
1
;
}
}
code
=
walWriteIndex
(
pWal
,
index
,
offset
);
code
=
walWriteIndex
(
pWal
,
index
,
offset
);
...
@@ -329,7 +332,7 @@ int64_t walWrite(SWal *pWal, int64_t index, tmsg_t msgType, const void *body, in
...
@@ -329,7 +332,7 @@ int64_t walWrite(SWal *pWal, int64_t index, tmsg_t msgType, const void *body, in
pthread_mutex_unlock
(
&
pWal
->
mutex
);
pthread_mutex_unlock
(
&
pWal
->
mutex
);
return
code
;
return
0
;
}
}
void
walFsync
(
SWal
*
pWal
,
bool
forceFsync
)
{
void
walFsync
(
SWal
*
pWal
,
bool
forceFsync
)
{
...
...
source/libs/wal/test/walMetaTest.cpp
浏览文件 @
a11a2f37
...
@@ -339,9 +339,9 @@ TEST_F(WalRetentionEnv, repairMeta1) {
...
@@ -339,9 +339,9 @@ TEST_F(WalRetentionEnv, repairMeta1) {
//getchar();
//getchar();
char
buf
[
100
];
char
buf
[
100
];
sprintf
(
buf
,
"%s/meta-ver%d"
,
pathName
,
0
);
sprintf
(
buf
,
"%s/meta-ver%d"
,
pathName
,
0
);
remov
e
(
buf
);
taosRemoveFil
e
(
buf
);
sprintf
(
buf
,
"%s/meta-ver%d"
,
pathName
,
1
);
sprintf
(
buf
,
"%s/meta-ver%d"
,
pathName
,
1
);
remov
e
(
buf
);
taosRemoveFil
e
(
buf
);
SetUp
();
SetUp
();
//getchar();
//getchar();
...
...
source/os/src/osDir.c
浏览文件 @
a11a2f37
...
@@ -49,7 +49,7 @@ void taosRemoveDir(const char *dirname) {
...
@@ -49,7 +49,7 @@ void taosRemoveDir(const char *dirname) {
if
(
de
->
d_type
&
DT_DIR
)
{
if
(
de
->
d_type
&
DT_DIR
)
{
taosRemoveDir
(
filename
);
taosRemoveDir
(
filename
);
}
else
{
}
else
{
(
void
)
remov
e
(
filename
);
(
void
)
taosRemoveFil
e
(
filename
);
//printf("file:%s is removed\n", filename);
//printf("file:%s is removed\n", filename);
}
}
}
}
...
@@ -102,7 +102,7 @@ void taosRemoveOldFiles(const char *dirname, int32_t keepDays) {
...
@@ -102,7 +102,7 @@ void taosRemoveOldFiles(const char *dirname, int32_t keepDays) {
if
(
fileSec
<=
100
)
continue
;
if
(
fileSec
<=
100
)
continue
;
int32_t
days
=
(
int32_t
)(
TABS
(
sec
-
fileSec
)
/
86400
+
1
);
int32_t
days
=
(
int32_t
)(
TABS
(
sec
-
fileSec
)
/
86400
+
1
);
if
(
days
>
keepDays
)
{
if
(
days
>
keepDays
)
{
(
void
)
remov
e
(
filename
);
(
void
)
taosRemoveFil
e
(
filename
);
//printf("file:%s is removed, days:%d keepDays:%d", filename, days, keepDays);
//printf("file:%s is removed, days:%d keepDays:%d", filename, days, keepDays);
}
else
{
}
else
{
//printf("file:%s won't be removed, days:%d keepDays:%d", filename, days, keepDays);
//printf("file:%s won't be removed, days:%d keepDays:%d", filename, days, keepDays);
...
...
source/os/src/osFile.c
浏览文件 @
a11a2f37
...
@@ -142,11 +142,13 @@ int64_t taosCopyFile(const char *from, const char *to) {
...
@@ -142,11 +142,13 @@ int64_t taosCopyFile(const char *from, const char *to) {
_err:
_err:
if
(
pFileFrom
!=
NULL
)
taosCloseFile
(
&
pFileFrom
);
if
(
pFileFrom
!=
NULL
)
taosCloseFile
(
&
pFileFrom
);
if
(
pFileTo
!=
NULL
)
taosCloseFile
(
&
pFileTo
);
if
(
pFileTo
!=
NULL
)
taosCloseFile
(
&
pFileTo
);
remov
e
(
to
);
taosRemoveFil
e
(
to
);
return
-
1
;
return
-
1
;
#endif
#endif
}
}
int32_t
taosRemoveFile
(
const
char
*
path
)
{
return
remove
(
path
);
}
int32_t
taosRenameFile
(
const
char
*
oldName
,
const
char
*
newName
)
{
int32_t
taosRenameFile
(
const
char
*
oldName
,
const
char
*
newName
)
{
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
int32_t
code
=
MoveFileEx
(
oldName
,
newName
,
MOVEFILE_REPLACE_EXISTING
|
MOVEFILE_COPY_ALLOWED
);
int32_t
code
=
MoveFileEx
(
oldName
,
newName
,
MOVEFILE_REPLACE_EXISTING
|
MOVEFILE_COPY_ALLOWED
);
...
...
source/util/src/terror.c
浏览文件 @
a11a2f37
...
@@ -13,6 +13,8 @@
...
@@ -13,6 +13,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
// clang-format off
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "os.h"
#include "os.h"
#include "taoserror.h"
#include "taoserror.h"
...
@@ -408,6 +410,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_SYN_INVALID_MSGTYPE, "Invalid msg type")
...
@@ -408,6 +410,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_SYN_INVALID_MSGTYPE, "Invalid msg type")
TAOS_DEFINE_ERROR
(
TSDB_CODE_WAL_APP_ERROR
,
"Unexpected generic error in wal"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_WAL_APP_ERROR
,
"Unexpected generic error in wal"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_WAL_FILE_CORRUPTED
,
"WAL file is corrupted"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_WAL_FILE_CORRUPTED
,
"WAL file is corrupted"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_WAL_SIZE_LIMIT
,
"WAL size exceeds limit"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_WAL_SIZE_LIMIT
,
"WAL size exceeds limit"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_WAL_INVALID_VER
,
"WAL use invalid version"
)
// tfs
// tfs
TAOS_DEFINE_ERROR
(
TSDB_CODE_FS_APP_ERROR
,
"tfs out of memory"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_FS_APP_ERROR
,
"tfs out of memory"
)
...
...
source/util/src/thash.c
浏览文件 @
a11a2f37
...
@@ -36,14 +36,24 @@
...
@@ -36,14 +36,24 @@
tfree(_n); \
tfree(_n); \
} while (0);
} while (0);
struct
SHashNode
{
SHashNode
*
next
;
uint32_t
hashVal
;
// the hash value of key
uint32_t
dataLen
;
// length of data
uint32_t
keyLen
;
// length of the key
uint16_t
refCount
;
// reference count
int8_t
removed
;
// flag to indicate removed
char
data
[];
};
typedef
struct
SHashEntry
{
typedef
struct
SHashEntry
{
int32_t
num
;
// number of elements in current entry
int32_t
num
;
// number of elements in current entry
SRWLatch
latch
;
// entry latch
SRWLatch
latch
;
// entry latch
SHashNode
*
next
;
SHashNode
*
next
;
}
SHashEntry
;
}
SHashEntry
;
typedef
struct
SHashObj
{
struct
SHashObj
{
SHashEntry
**
hashList
;
SHashEntry
**
hashList
;
size_t
capacity
;
// number of slots
size_t
capacity
;
// number of slots
size_t
size
;
// number of elements in hash table
size_t
size
;
// number of elements in hash table
_hash_fn_t
hashFp
;
// hash function
_hash_fn_t
hashFp
;
// hash function
...
@@ -52,9 +62,9 @@ typedef struct SHashObj {
...
@@ -52,9 +62,9 @@ typedef struct SHashObj {
SRWLatch
lock
;
// read-write spin lock
SRWLatch
lock
;
// read-write spin lock
SHashLockTypeE
type
;
// lock type
SHashLockTypeE
type
;
// lock type
bool
enableUpdate
;
// enable update
bool
enableUpdate
;
// enable update
SArray
*
pMemBlock
;
// memory block allocated for SHashEntry
SArray
*
pMemBlock
;
// memory block allocated for SHashEntry
_hash_before_fn_t
callbackFp
;
// function invoked before return the value to caller
_hash_before_fn_t
callbackFp
;
// function invoked before return the value to caller
}
SHashObj
;
};
/*
/*
* Function definition
* Function definition
...
@@ -367,7 +377,7 @@ int32_t taosHashPut(SHashObj *pHashObj, const void *key, size_t keyLen, void *da
...
@@ -367,7 +377,7 @@ int32_t taosHashPut(SHashObj *pHashObj, const void *key, size_t keyLen, void *da
// enable resize
// enable resize
taosHashRUnlock
(
pHashObj
);
taosHashRUnlock
(
pHashObj
);
return
pHashObj
->
enableUpdate
?
0
:
-
1
;
return
pHashObj
->
enableUpdate
?
0
:
-
2
;
}
}
}
}
...
@@ -464,7 +474,7 @@ void* taosHashGetImpl(SHashObj *pHashObj, const void *key, size_t keyLen, void**
...
@@ -464,7 +474,7 @@ void* taosHashGetImpl(SHashObj *pHashObj, const void *key, size_t keyLen, void**
return
data
;
return
data
;
}
}
int32_t
taosHashRemove
WithData
(
SHashObj
*
pHashObj
,
const
void
*
key
,
size_t
keyLen
,
void
*
data
,
size_t
dsize
)
{
int32_t
taosHashRemove
(
SHashObj
*
pHashObj
,
const
void
*
key
,
size_t
keyLen
)
{
if
(
pHashObj
==
NULL
||
taosHashTableEmpty
(
pHashObj
)
||
key
==
NULL
||
keyLen
==
0
)
{
if
(
pHashObj
==
NULL
||
taosHashTableEmpty
(
pHashObj
)
||
key
==
NULL
||
keyLen
==
0
)
{
return
-
1
;
return
-
1
;
}
}
...
@@ -507,8 +517,6 @@ int32_t taosHashRemoveWithData(SHashObj *pHashObj, const void *key, size_t keyLe
...
@@ -507,8 +517,6 @@ int32_t taosHashRemoveWithData(SHashObj *pHashObj, const void *key, size_t keyLe
prevNode
->
next
=
pNode
->
next
;
prevNode
->
next
=
pNode
->
next
;
}
}
if
(
data
)
memcpy
(
data
,
GET_HASH_NODE_DATA
(
pNode
),
dsize
);
pe
->
num
--
;
pe
->
num
--
;
atomic_sub_fetch_64
(
&
pHashObj
->
size
,
1
);
atomic_sub_fetch_64
(
&
pHashObj
->
size
,
1
);
FREE_HASH_NODE
(
pNode
);
FREE_HASH_NODE
(
pNode
);
...
@@ -525,10 +533,6 @@ int32_t taosHashRemoveWithData(SHashObj *pHashObj, const void *key, size_t keyLe
...
@@ -525,10 +533,6 @@ int32_t taosHashRemoveWithData(SHashObj *pHashObj, const void *key, size_t keyLe
return
code
;
return
code
;
}
}
int32_t
taosHashRemove
(
SHashObj
*
pHashObj
,
const
void
*
key
,
size_t
keyLen
)
{
return
taosHashRemoveWithData
(
pHashObj
,
key
,
keyLen
,
NULL
,
0
);
}
void
taosHashClear
(
SHashObj
*
pHashObj
)
{
void
taosHashClear
(
SHashObj
*
pHashObj
)
{
if
(
pHashObj
==
NULL
)
{
if
(
pHashObj
==
NULL
)
{
return
;
return
;
...
...
source/util/src/tlog.c
浏览文件 @
a11a2f37
...
@@ -180,7 +180,7 @@ static void taosKeepOldLog(char *oldName) {
...
@@ -180,7 +180,7 @@ static void taosKeepOldLog(char *oldName) {
char
compressFileName
[
LOG_FILE_NAME_LEN
+
20
];
char
compressFileName
[
LOG_FILE_NAME_LEN
+
20
];
snprintf
(
compressFileName
,
LOG_FILE_NAME_LEN
+
20
,
"%s.%"
PRId64
".gz"
,
tsLogObj
.
logName
,
fileSec
);
snprintf
(
compressFileName
,
LOG_FILE_NAME_LEN
+
20
,
"%s.%"
PRId64
".gz"
,
tsLogObj
.
logName
,
fileSec
);
if
(
taosCompressFile
(
fileName
,
compressFileName
)
==
0
)
{
if
(
taosCompressFile
(
fileName
,
compressFileName
)
==
0
)
{
(
void
)
remov
e
(
fileName
);
(
void
)
taosRemoveFil
e
(
fileName
);
}
}
}
}
...
@@ -251,7 +251,7 @@ void taosResetLog() {
...
@@ -251,7 +251,7 @@ void taosResetLog() {
tsLogObj
.
lines
=
tsLogObj
.
maxLines
+
10
;
tsLogObj
.
lines
=
tsLogObj
.
maxLines
+
10
;
taosOpenNewLogFile
();
taosOpenNewLogFile
();
(
void
)
remov
e
(
lastName
);
(
void
)
taosRemoveFil
e
(
lastName
);
uInfo
(
"=================================="
);
uInfo
(
"=================================="
);
uInfo
(
" reset log file "
);
uInfo
(
" reset log file "
);
...
...
source/util/src/tpagedbuf.c
浏览文件 @
a11a2f37
...
@@ -563,7 +563,7 @@ void destroyDiskbasedBuf(SDiskbasedBuf* pBuf) {
...
@@ -563,7 +563,7 @@ void destroyDiskbasedBuf(SDiskbasedBuf* pBuf) {
ps
->
loadPages
,
ps
->
loadBytes
/
(
1024
.
0
*
ps
->
loadPages
));
ps
->
loadPages
,
ps
->
loadBytes
/
(
1024
.
0
*
ps
->
loadPages
));
}
}
remov
e
(
pBuf
->
path
);
taosRemoveFil
e
(
pBuf
->
path
);
tfree
(
pBuf
->
path
);
tfree
(
pBuf
->
path
);
SArray
**
p
=
taosHashIterate
(
pBuf
->
groupSet
,
NULL
);
SArray
**
p
=
taosHashIterate
(
pBuf
->
groupSet
,
NULL
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录