Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ddc5d955
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ddc5d955
编写于
9月 15, 2022
作者:
Z
zhihaop
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: move global variable tscDispatcher to tscSystem.c
上级
67db8da1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
49 addition
and
51 deletion
+49
-51
src/client/inc/tscBulkWrite.h
src/client/inc/tscBulkWrite.h
+2
-29
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+3
-0
src/client/src/tscAsync.c
src/client/src/tscAsync.c
+0
-20
src/client/src/tscBulkWrite.c
src/client/src/tscBulkWrite.c
+24
-2
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+20
-0
未找到文件。
src/client/inc/tscBulkWrite.h
浏览文件 @
ddc5d955
...
...
@@ -22,7 +22,6 @@ extern "C" {
#include "tlist.h"
#include "tarray.h"
#include "tsclient.h"
#include "tthread.h"
typedef
struct
SAsyncBulkWriteDispatcher
{
...
...
@@ -54,26 +53,8 @@ typedef struct SAsyncBulkWriteDispatcher {
volatile
bool
shutdown
;
}
SAsyncBulkWriteDispatcher
;
/**
* Return the error result to the callback function, and release the sql object.
*
* @param pSql the sql object.
* @param code the error code of the error result.
*/
void
tscReturnsError
(
SSqlObj
*
pSql
,
int
code
);
/**
* Proxy function to perform sequentially insert operation.
*
* @param param the context of `batchResultCallback`.
* @param tres the result object.
* @param code the error code.
*/
void
batchResultCallback
(
void
*
param
,
TAOS_RES
*
tres
,
int32_t
code
);
// forward declaration.
typedef
struct
SSqlObj
SSqlObj
;
/**
* Merge the statements into single SSqlObj.
*
...
...
@@ -84,14 +65,6 @@ void batchResultCallback(void* param, TAOS_RES* tres, int32_t code);
*/
int32_t
dispatcherStatementMerge
(
SArray
*
statements
,
SSqlObj
**
result
);
/**
* Get the number of insertion row in the sql statement.
*
* @param pSql the sql statement.
* @return int32_t the number of insertion row.
*/
inline
static
int32_t
statementGetInsertionRows
(
SSqlObj
*
pSql
)
{
return
pSql
->
cmd
.
insertParam
.
numOfRows
;
}
/**
* Poll all the SSqlObj* in the dispatcher's buffer.
*
...
...
src/client/inc/tsclient.h
浏览文件 @
ddc5d955
...
...
@@ -544,6 +544,9 @@ extern SHashObj *tscVgroupMap;
extern
SHashObj
*
tscTableMetaMap
;
extern
SCacheObj
*
tscVgroupListBuf
;
// forward declaration.
typedef
struct
SAsyncBulkWriteDispatcher
SAsyncBulkWriteDispatcher
;
extern
SAsyncBulkWriteDispatcher
*
tscDispatcher
;
extern
int
tscObjRef
;
extern
void
*
tscTmr
;
extern
void
*
tscQhandle
;
...
...
src/client/src/tscAsync.c
浏览文件 @
ddc5d955
...
...
@@ -37,26 +37,6 @@ static void tscAsyncQueryRowsForNextVnode(void *param, TAOS_RES *tres, int numOf
*/
static
void
tscAsyncFetchRowsProxy
(
void
*
param
,
TAOS_RES
*
tres
,
int
numOfRows
);
static
SAsyncBulkWriteDispatcher
*
tscDispatcher
;
/**
* Init the taosc async bulk write dispatcher.
*
* @param batchSize the batchSize of async bulk write dispatcher.
* @param timeoutMs the timeout of batching in milliseconds.
*/
void
tscInitAsyncDispatcher
(
int32_t
batchSize
,
int32_t
timeoutMs
)
{
tscDispatcher
=
createAsyncBulkWriteDispatcher
(
batchSize
,
timeoutMs
);
}
/**
* Destroy the taosc async bulk write dispatcher.
*/
void
tscDestroyAsyncDispatcher
()
{
destroyAsyncDispatcher
(
tscDispatcher
);
tscDispatcher
=
NULL
;
}
void
doAsyncQuery
(
STscObj
*
pObj
,
SSqlObj
*
pSql
,
__async_cb_func_t
fp
,
void
*
param
,
const
char
*
sqlstr
,
size_t
sqlLen
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
...
...
src/client/src/tscBulkWrite.c
浏览文件 @
ddc5d955
...
...
@@ -15,6 +15,7 @@
#include "osAtomic.h"
#include "tsclient.h"
#include "tscBulkWrite.h"
#include "tscSubquery.h"
#include "tscLog.h"
...
...
@@ -35,7 +36,21 @@ typedef struct {
Runnable
runnable
[];
}
BatchCallBackContext
;
void
tscReturnsError
(
SSqlObj
*
pSql
,
int
code
)
{
/**
* Get the number of insertion row in the sql statement.
*
* @param pSql the sql statement.
* @return int32_t the number of insertion row.
*/
inline
static
int32_t
statementGetInsertionRows
(
SSqlObj
*
pSql
)
{
return
pSql
->
cmd
.
insertParam
.
numOfRows
;
}
/**
* Return the error result to the callback function, and release the sql object.
*
* @param pSql the sql object.
* @param code the error code of the error result.
*/
inline
static
void
tscReturnsError
(
SSqlObj
*
pSql
,
int
code
)
{
if
(
pSql
==
NULL
)
{
return
;
}
...
...
@@ -44,7 +59,14 @@ void tscReturnsError(SSqlObj *pSql, int code) {
tscAsyncResultOnError
(
pSql
);
}
void
batchResultCallback
(
void
*
param
,
TAOS_RES
*
tres
,
int32_t
code
)
{
/**
* Proxy function to perform sequentially insert operation.
*
* @param param the context of `batchResultCallback`.
* @param tres the result object.
* @param code the error code.
*/
static
void
batchResultCallback
(
void
*
param
,
TAOS_RES
*
tres
,
int32_t
code
)
{
BatchCallBackContext
*
context
=
param
;
SSqlObj
*
res
=
tres
;
...
...
src/client/src/tscSystem.c
浏览文件 @
ddc5d955
...
...
@@ -26,6 +26,7 @@
#include "tconfig.h"
#include "ttimezone.h"
#include "qScript.h"
#include "tscBulkWrite.h"
// global, not configurable
#define TSC_VAR_NOT_RELEASE 1
...
...
@@ -49,6 +50,7 @@ void *tscRpcCache; // cache to keep rpc obj
int32_t
tscNumOfThreads
=
1
;
// num of rpc threads
char
tscLogFileName
[]
=
"taoslog"
;
int
tscLogFileNum
=
10
;
SAsyncBulkWriteDispatcher
*
tscDispatcher
=
NULL
;
static
pthread_mutex_t
rpcObjMutex
;
// mutex to protect open the rpc obj concurrently
static
pthread_once_t
tscinit
=
PTHREAD_ONCE_INIT
;
...
...
@@ -57,6 +59,24 @@ static pthread_mutex_t setConfMutex = PTHREAD_MUTEX_INITIALIZER;
// pthread_once can not return result code, so result code is set to a global variable.
static
volatile
int
tscInitRes
=
0
;
/**
* Init the taosc async bulk write dispatcher.
*
* @param batchSize the batchSize of async bulk write dispatcher.
* @param timeoutMs the timeout of batching in milliseconds.
*/
void
tscInitAsyncDispatcher
(
int32_t
batchSize
,
int32_t
timeoutMs
)
{
tscDispatcher
=
createAsyncBulkWriteDispatcher
(
batchSize
,
timeoutMs
);
}
/**
* Destroy the taosc async bulk write dispatcher.
*/
void
tscDestroyAsyncDispatcher
()
{
destroyAsyncDispatcher
(
tscDispatcher
);
tscDispatcher
=
NULL
;
}
void
tscCheckDiskUsage
(
void
*
UNUSED_PARAM
(
para
),
void
*
UNUSED_PARAM
(
param
))
{
taosGetDisk
();
taosTmrReset
(
tscCheckDiskUsage
,
20
*
1000
,
NULL
,
tscTmr
,
&
tscCheckDiskUsageTmr
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录