Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
5e07893a
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
5e07893a
编写于
7月 20, 2021
作者:
X
XYWang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-5234]<feature>: added name for threads
上级
e8b3fde4
变更
45
显示空白变更内容
内联
并排
Showing
45 changed file
with
142 addition
and
9 deletion
+142
-9
src/balance/src/bnThread.c
src/balance/src/bnThread.c
+2
-0
src/dnode/src/dnodeMPeer.c
src/dnode/src/dnodeMPeer.c
+2
-0
src/dnode/src/dnodeMRead.c
src/dnode/src/dnodeMRead.c
+2
-0
src/dnode/src/dnodeMWrite.c
src/dnode/src/dnodeMWrite.c
+3
-1
src/dnode/src/dnodeTelemetry.c
src/dnode/src/dnodeTelemetry.c
+2
-0
src/dnode/src/dnodeVMgmt.c
src/dnode/src/dnodeVMgmt.c
+2
-0
src/dnode/src/dnodeVRead.c
src/dnode/src/dnodeVRead.c
+5
-0
src/dnode/src/dnodeVWrite.c
src/dnode/src/dnodeVWrite.c
+2
-0
src/dnode/src/dnodeVnodes.c
src/dnode/src/dnodeVnodes.c
+2
-0
src/kit/shell/src/shellCheck.c
src/kit/shell/src/shellCheck.c
+2
-0
src/kit/shell/src/shellDarwin.c
src/kit/shell/src/shellDarwin.c
+2
-0
src/kit/shell/src/shellImport.c
src/kit/shell/src/shellImport.c
+2
-0
src/kit/shell/src/shellLinux.c
src/kit/shell/src/shellLinux.c
+2
-0
src/kit/shell/src/shellMain.c
src/kit/shell/src/shellMain.c
+2
-0
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+17
-2
src/kit/taosdump/taosdump.c
src/kit/taosdump/taosdump.c
+4
-0
src/mnode/src/mnodeSdb.c
src/mnode/src/mnodeSdb.c
+1
-0
src/os/inc/osDef.h
src/os/inc/osDef.h
+19
-0
src/os/inc/osInc.h
src/os/inc/osInc.h
+1
-0
src/os/src/darwin/dwSemaphore.c
src/os/src/darwin/dwSemaphore.c
+2
-0
src/os/src/darwin/dwTimer.c
src/os/src/darwin/dwTimer.c
+1
-0
src/os/src/detail/osTimer.c
src/os/src/detail/osTimer.c
+2
-0
src/plugins/http/src/httpQueue.c
src/plugins/http/src/httpQueue.c
+2
-0
src/plugins/http/src/httpServer.c
src/plugins/http/src/httpServer.c
+2
-0
src/plugins/monitor/src/monMain.c
src/plugins/monitor/src/monMain.c
+1
-0
src/plugins/mqtt/src/mqttSystem.c
src/plugins/mqtt/src/mqttSystem.c
+3
-1
src/rpc/src/rpcTcp.c
src/rpc/src/rpcTcp.c
+6
-0
src/rpc/src/rpcUdp.c
src/rpc/src/rpcUdp.c
+2
-0
src/rpc/test/rclient.c
src/rpc/test/rclient.c
+2
-0
src/rpc/test/rsclient.c
src/rpc/test/rsclient.c
+3
-1
src/sync/src/syncRestore.c
src/sync/src/syncRestore.c
+1
-0
src/sync/src/syncRetrieve.c
src/sync/src/syncRetrieve.c
+1
-0
src/sync/src/syncTcp.c
src/sync/src/syncTcp.c
+3
-0
src/sync/test/syncClient.c
src/sync/test/syncClient.c
+2
-0
src/sync/test/syncServer.c
src/sync/test/syncServer.c
+2
-0
src/tsdb/src/tsdbCommitQueue.c
src/tsdb/src/tsdbCommitQueue.c
+3
-1
src/util/src/tcache.c
src/util/src/tcache.c
+2
-0
src/util/src/tlog.c
src/util/src/tlog.c
+4
-0
src/util/src/tnettest.c
src/util/src/tnettest.c
+6
-2
src/util/src/tnote.c
src/util/src/tnote.c
+2
-0
src/util/src/tsched.c
src/util/src/tsched.c
+3
-1
src/util/tests/trefTest.c
src/util/tests/trefTest.c
+8
-0
src/vnode/src/vnodeBackup.c
src/vnode/src/vnodeBackup.c
+2
-0
src/vnode/src/vnodeWorker.c
src/vnode/src/vnodeWorker.c
+2
-0
src/wal/src/walMgmt.c
src/wal/src/walMgmt.c
+1
-0
未找到文件。
src/balance/src/bnThread.c
浏览文件 @
5e07893a
...
...
@@ -23,6 +23,8 @@
static
SBnThread
tsBnThread
;
static
void
*
bnThreadFunc
(
void
*
arg
)
{
setThreadName
(
"bnThreadd"
);
while
(
1
)
{
pthread_mutex_lock
(
&
tsBnThread
.
mutex
);
if
(
tsBnThread
.
stop
)
{
...
...
src/dnode/src/dnodeMPeer.c
浏览文件 @
5e07893a
...
...
@@ -151,6 +151,8 @@ static void *dnodeProcessMPeerQueue(void *param) {
int32_t
type
;
void
*
unUsed
;
setThreadName
(
"dnodeMPeerQ"
);
while
(
1
)
{
if
(
taosReadQitemFromQset
(
tsMPeerQset
,
&
type
,
(
void
**
)
&
pPeerMsg
,
&
unUsed
)
==
0
)
{
dDebug
(
"qset:%p, mnode peer got no message from qset, exiting"
,
tsMPeerQset
);
...
...
src/dnode/src/dnodeMRead.c
浏览文件 @
5e07893a
...
...
@@ -155,6 +155,8 @@ static void *dnodeProcessMReadQueue(void *param) {
int32_t
type
;
void
*
unUsed
;
setThreadName
(
"dnodeMReadQ"
);
while
(
1
)
{
if
(
taosReadQitemFromQset
(
tsMReadQset
,
&
type
,
(
void
**
)
&
pRead
,
&
unUsed
)
==
0
)
{
dDebug
(
"qset:%p, mnode read got no message from qset, exiting"
,
tsMReadQset
);
...
...
src/dnode/src/dnodeMWrite.c
浏览文件 @
5e07893a
...
...
@@ -169,6 +169,8 @@ static void *dnodeProcessMWriteQueue(void *param) {
int32_t
type
;
void
*
unUsed
;
setThreadName
(
"dnodeMWriteQ"
);
while
(
1
)
{
if
(
taosReadQitemFromQset
(
tsMWriteQset
,
&
type
,
(
void
**
)
&
pWrite
,
&
unUsed
)
==
0
)
{
dDebug
(
"qset:%p, mnode write got no message from qset, exiting"
,
tsMWriteQset
);
...
...
src/dnode/src/dnodeTelemetry.c
浏览文件 @
5e07893a
...
...
@@ -245,6 +245,8 @@ static void* telemetryThread(void* param) {
clock_gettime
(
CLOCK_REALTIME
,
&
end
);
end
.
tv_sec
+=
300
;
// wait 5 minutes before send first report
setThreadName
(
"telemetryThrd"
);
while
(
!
tsExit
)
{
int
r
=
0
;
struct
timespec
ts
=
end
;
...
...
src/dnode/src/dnodeVMgmt.c
浏览文件 @
5e07893a
...
...
@@ -103,6 +103,8 @@ static void *dnodeProcessMgmtQueue(void *wparam) {
int32_t
qtype
;
void
*
handle
;
setThreadName
(
"dnodeMgmtQ"
);
while
(
1
)
{
if
(
taosReadQitemFromQset
(
pPool
->
qset
,
&
qtype
,
(
void
**
)
&
pMgmt
,
&
handle
)
==
0
)
{
dDebug
(
"qdnode mgmt got no message from qset:%p, , exit"
,
pPool
->
qset
);
...
...
src/dnode/src/dnodeVRead.c
浏览文件 @
5e07893a
...
...
@@ -118,6 +118,11 @@ static void *dnodeProcessReadQueue(void *wparam) {
SVReadMsg
*
pRead
;
int32_t
qtype
;
void
*
pVnode
;
char
name
[
16
];
memset
(
name
,
0
,
16
);
snprintf
(
name
,
16
,
"%s-dnReadQ"
,
pPool
->
name
);
setThreadName
(
name
);
while
(
1
)
{
if
(
taosReadQitemFromQset
(
pPool
->
qset
,
&
qtype
,
(
void
**
)
&
pRead
,
&
pVnode
)
==
0
)
{
...
...
src/dnode/src/dnodeVWrite.c
浏览文件 @
5e07893a
...
...
@@ -191,6 +191,8 @@ static void *dnodeProcessVWriteQueue(void *wparam) {
taosBlockSIGPIPE
();
dDebug
(
"dnode vwrite worker:%d is running"
,
pWorker
->
workerId
);
setThreadName
(
"dnodeWriteQ"
);
while
(
1
)
{
numOfMsgs
=
taosReadAllQitemsFromQset
(
pWorker
->
qset
,
pWorker
->
qall
,
&
pVnode
);
if
(
numOfMsgs
==
0
)
{
...
...
src/dnode/src/dnodeVnodes.c
浏览文件 @
5e07893a
...
...
@@ -91,6 +91,8 @@ static void *dnodeOpenVnode(void *param) {
dDebug
(
"thread:%d, start to open %d vnodes"
,
pThread
->
threadIndex
,
pThread
->
vnodeNum
);
setThreadName
(
"dnodeOpenVnode"
);
for
(
int32_t
v
=
0
;
v
<
pThread
->
vnodeNum
;
++
v
)
{
int32_t
vgId
=
pThread
->
vnodeList
[
v
];
snprintf
(
stepDesc
,
TSDB_STEP_DESC_LEN
,
"vgId:%d, start to restore, %d of %d have been opened"
,
vgId
,
tsOpenVnodes
,
tsTotalVnodes
);
...
...
src/kit/shell/src/shellCheck.c
浏览文件 @
5e07893a
...
...
@@ -104,6 +104,8 @@ static void shellFreeTbnames() {
static
void
*
shellCheckThreadFp
(
void
*
arg
)
{
ShellThreadObj
*
pThread
=
(
ShellThreadObj
*
)
arg
;
setThreadName
(
"shellCheckThrd"
);
int32_t
interval
=
tbNum
/
pThread
->
totalThreads
+
1
;
int32_t
start
=
pThread
->
threadIndex
*
interval
;
int32_t
end
=
(
pThread
->
threadIndex
+
1
)
*
interval
;
...
...
src/kit/shell/src/shellDarwin.c
浏览文件 @
5e07893a
...
...
@@ -336,6 +336,8 @@ void *shellLoopQuery(void *arg) {
TAOS
*
con
=
(
TAOS
*
)
arg
;
setThreadName
(
"shellLoopQuery"
);
pthread_cleanup_push
(
cleanup_handler
,
NULL
);
char
*
command
=
malloc
(
MAX_COMMAND_SIZE
);
...
...
src/kit/shell/src/shellImport.c
浏览文件 @
5e07893a
...
...
@@ -223,6 +223,8 @@ static void shellSourceFile(TAOS *con, char *fptr) {
void
*
shellImportThreadFp
(
void
*
arg
)
{
ShellThreadObj
*
pThread
=
(
ShellThreadObj
*
)
arg
;
setThreadName
(
"shellImportThrd"
);
for
(
int
f
=
0
;
f
<
shellSQLFileNum
;
++
f
)
{
if
(
f
%
pThread
->
totalThreads
==
pThread
->
threadIndex
)
{
char
*
SQLFileName
=
shellSQLFiles
[
f
];
...
...
src/kit/shell/src/shellLinux.c
浏览文件 @
5e07893a
...
...
@@ -336,6 +336,8 @@ void *shellLoopQuery(void *arg) {
TAOS
*
con
=
(
TAOS
*
)
arg
;
setThreadName
(
"shellLoopQuery"
);
pthread_cleanup_push
(
cleanup_handler
,
NULL
);
char
*
command
=
malloc
(
MAX_COMMAND_SIZE
);
...
...
src/kit/shell/src/shellMain.c
浏览文件 @
5e07893a
...
...
@@ -26,6 +26,8 @@ void shellQueryInterruptHandler(int32_t signum, void *sigInfo, void *context) {
}
void
*
cancelHandler
(
void
*
arg
)
{
setThreadName
(
"cancelHandler"
);
while
(
1
)
{
if
(
tsem_wait
(
&
cancelSem
)
!=
0
)
{
taosMsleep
(
10
);
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
5e07893a
...
...
@@ -3025,10 +3025,11 @@ static void* createTable(void *sarg)
threadInfo
*
pThreadInfo
=
(
threadInfo
*
)
sarg
;
SSuperTable
*
superTblInfo
=
pThreadInfo
->
superTblInfo
;
setThreadName
(
"createTable"
);
uint64_t
lastPrintTime
=
taosGetTimestampMs
();
int
buff_len
;
buff_len
=
BUFFER_SIZE
;
int
buff_len
=
BUFFER_SIZE
;
pThreadInfo
->
buffer
=
calloc
(
buff_len
,
1
);
if
(
pThreadInfo
->
buffer
==
NULL
)
{
...
...
@@ -6428,6 +6429,8 @@ static void* syncWrite(void *sarg) {
threadInfo
*
pThreadInfo
=
(
threadInfo
*
)
sarg
;
SSuperTable
*
superTblInfo
=
pThreadInfo
->
superTblInfo
;
setThreadName
(
"syncWrite"
);
uint32_t
interlaceRows
;
if
(
superTblInfo
)
{
...
...
@@ -6513,6 +6516,8 @@ static void *asyncWrite(void *sarg) {
threadInfo
*
pThreadInfo
=
(
threadInfo
*
)
sarg
;
SSuperTable
*
superTblInfo
=
pThreadInfo
->
superTblInfo
;
setThreadName
(
"asyncWrite"
);
pThreadInfo
->
st
=
0
;
pThreadInfo
->
et
=
0
;
pThreadInfo
->
lastTs
=
pThreadInfo
->
start_time
;
...
...
@@ -6911,6 +6916,7 @@ static void *readTable(void *sarg) {
#if 1
threadInfo
*
pThreadInfo
=
(
threadInfo
*
)
sarg
;
TAOS
*
taos
=
pThreadInfo
->
taos
;
setThreadName
(
"readTable"
);
char
command
[
BUFFER_SIZE
]
=
"
\0
"
;
uint64_t
sTime
=
pThreadInfo
->
start_time
;
char
*
tb_prefix
=
pThreadInfo
->
tb_prefix
;
...
...
@@ -6983,6 +6989,7 @@ static void *readMetric(void *sarg) {
#if 1
threadInfo
*
pThreadInfo
=
(
threadInfo
*
)
sarg
;
TAOS
*
taos
=
pThreadInfo
->
taos
;
setThreadName
(
"readMetric"
);
char
command
[
BUFFER_SIZE
]
=
"
\0
"
;
FILE
*
fp
=
fopen
(
pThreadInfo
->
filePath
,
"a"
);
if
(
NULL
==
fp
)
{
...
...
@@ -7159,6 +7166,8 @@ static int insertTestProcess() {
static
void
*
specifiedTableQuery
(
void
*
sarg
)
{
threadInfo
*
pThreadInfo
=
(
threadInfo
*
)
sarg
;
setThreadName
(
"specTableQuery"
);
if
(
pThreadInfo
->
taos
==
NULL
)
{
TAOS
*
taos
=
NULL
;
taos
=
taos_connect
(
g_queryInfo
.
host
,
...
...
@@ -7258,6 +7267,8 @@ static void *superTableQuery(void *sarg) {
char
sqlstr
[
MAX_QUERY_SQL_LENGTH
];
threadInfo
*
pThreadInfo
=
(
threadInfo
*
)
sarg
;
setThreadName
(
"superTableQuery"
);
if
(
pThreadInfo
->
taos
==
NULL
)
{
TAOS
*
taos
=
NULL
;
taos
=
taos_connect
(
g_queryInfo
.
host
,
...
...
@@ -7560,6 +7571,8 @@ static void *superSubscribe(void *sarg) {
TAOS_SUB
*
tsub
[
MAX_QUERY_SQL_COUNT
]
=
{
0
};
uint64_t
tsubSeq
;
setThreadName
(
"superSub"
);
if
(
pThreadInfo
->
ntables
>
MAX_QUERY_SQL_COUNT
)
{
errorPrint
(
"The table number(%"
PRId64
") of the thread is more than max query sql count: %d
\n
"
,
pThreadInfo
->
ntables
,
MAX_QUERY_SQL_COUNT
);
...
...
@@ -7706,6 +7719,8 @@ static void *specifiedSubscribe(void *sarg) {
threadInfo
*
pThreadInfo
=
(
threadInfo
*
)
sarg
;
// TAOS_SUB* tsub = NULL;
setThreadName
(
"specSub"
);
if
(
pThreadInfo
->
taos
==
NULL
)
{
pThreadInfo
->
taos
=
taos_connect
(
g_queryInfo
.
host
,
g_queryInfo
.
user
,
...
...
src/kit/taosdump/taosdump.c
浏览文件 @
5e07893a
...
...
@@ -1474,6 +1474,8 @@ static void* taosDumpOutWorkThreadFp(void *arg)
STableRecord
tableRecord
;
int
fd
;
setThreadName
(
"dumpOutWorkThrd"
);
char
tmpBuf
[
4096
]
=
{
0
};
sprintf
(
tmpBuf
,
".tables.tmp.%d"
,
pThread
->
threadIndex
);
fd
=
open
(
tmpBuf
,
O_RDWR
|
O_CREAT
,
S_IRWXU
|
S_IRGRP
|
S_IXGRP
|
S_IROTH
);
...
...
@@ -2571,6 +2573,8 @@ static int taosDumpInOneFile(TAOS* taos, FILE* fp, char* fcharset,
static
void
*
taosDumpInWorkThreadFp
(
void
*
arg
)
{
SThreadParaObj
*
pThread
=
(
SThreadParaObj
*
)
arg
;
setThreadName
(
"dumpInWorkThrd"
);
for
(
int32_t
f
=
0
;
f
<
g_tsSqlFileNum
;
++
f
)
{
if
(
f
%
pThread
->
totalThreads
==
pThread
->
threadIndex
)
{
char
*
SQLFileName
=
g_tsDumpInSqlFiles
[
f
];
...
...
src/mnode/src/mnodeSdb.c
浏览文件 @
5e07893a
...
...
@@ -1113,6 +1113,7 @@ static void *sdbWorkerFp(void *pWorker) {
void
*
unUsed
;
taosBlockSIGPIPE
();
setThreadName
(
"sdbWorker"
);
while
(
1
)
{
int32_t
numOfMsgs
=
taosReadAllQitemsFromQset
(
tsSdbWQset
,
tsSdbWQall
,
&
unUsed
);
...
...
src/os/inc/osDef.h
浏览文件 @
5e07893a
...
...
@@ -210,6 +210,25 @@ extern "C" {
#define PRIzu "zu"
#endif
#if defined(_TD_LINUX_64) || defined(_TD_LINUX_32) || defined(_TD_MIPS_64) || defined(_TD_ARM_32) || defined(_TD_ARM_64) || defined(_TD_DARWIN_64)
#if defined(_TD_DARWIN_64)
// MacOS
#if !defined(_GNU_SOURCE)
#define setThreadName(name) do { pthread_setname_np((name)); } while (0)
#else
// pthread_setname_np not defined
#define setThreadName(name)
#endif
#else
// Linux, length of name must <= 16 (the last '\0' included)
#define setThreadName(name) do { prctl(PR_SET_NAME, (name)); } while (0)
#endif
#else
// Windows
#define setThreadName(name)
#endif
#ifdef __cplusplus
}
#endif
...
...
src/os/inc/osInc.h
浏览文件 @
5e07893a
...
...
@@ -85,6 +85,7 @@ extern "C" {
#include <sys/eventfd.h>
#include <sys/resource.h>
#include <sys/sendfile.h>
#include <sys/prctl.h>
#if !(defined(_ALPINE))
#include <error.h>
...
...
src/os/src/darwin/dwSemaphore.c
浏览文件 @
5e07893a
...
...
@@ -41,6 +41,8 @@ static semaphore_t sem_exit;
static
void
*
sem_thread_routine
(
void
*
arg
)
{
(
void
)
arg
;
setThreadName
(
"sem_thrd"
);
sem_port
=
mach_task_self
();
kern_return_t
ret
=
semaphore_create
(
sem_port
,
&
sem_exit
,
SYNC_POLICY_FIFO
,
0
);
if
(
ret
!=
KERN_SUCCESS
)
{
...
...
src/os/src/darwin/dwTimer.c
浏览文件 @
5e07893a
...
...
@@ -32,6 +32,7 @@ static volatile int timer_stop = 0;
static
void
*
timer_routine
(
void
*
arg
)
{
(
void
)
arg
;
setThreadName
(
"timer"
);
int
r
=
0
;
struct
timespec
to
=
{
0
};
...
...
src/os/src/detail/osTimer.c
浏览文件 @
5e07893a
...
...
@@ -38,6 +38,8 @@ static void *taosProcessAlarmSignal(void *tharg) {
struct
sigevent
sevent
=
{{
0
}};
setThreadName
(
"alarmSignal"
);
#ifdef _ALPINE
sevent
.
sigev_notify
=
SIGEV_THREAD
;
sevent
.
sigev_value
.
sival_int
=
syscall
(
__NR_gettid
);
...
...
src/plugins/http/src/httpQueue.c
浏览文件 @
5e07893a
...
...
@@ -70,6 +70,8 @@ static void *httpProcessResultQueue(void *param) {
int32_t
type
;
void
*
unUsed
;
setThreadName
(
"httpResultQ"
);
while
(
1
)
{
if
(
taosReadQitemFromQset
(
tsHttpQset
,
&
type
,
(
void
**
)
&
pMsg
,
&
unUsed
)
==
0
)
{
httpDebug
(
"qset:%p, http queue got no message from qset, exiting"
,
tsHttpQset
);
...
...
src/plugins/http/src/httpServer.c
浏览文件 @
5e07893a
...
...
@@ -117,6 +117,7 @@ static void httpProcessHttpData(void *param) {
int32_t
fdNum
;
taosSetMaskSIGPIPE
();
setThreadName
(
"httpData"
);
while
(
1
)
{
struct
epoll_event
events
[
HTTP_MAX_EVENTS
];
...
...
@@ -208,6 +209,7 @@ static void *httpAcceptHttpConnection(void *arg) {
int32_t
totalFds
=
0
;
taosSetMaskSIGPIPE
();
setThreadName
(
"httpAcceptConn"
);
pServer
->
fd
=
taosOpenTcpServerSocket
(
pServer
->
serverIp
,
pServer
->
serverPort
);
...
...
src/plugins/monitor/src/monMain.c
浏览文件 @
5e07893a
...
...
@@ -114,6 +114,7 @@ int32_t monStartSystem() {
static
void
*
monThreadFunc
(
void
*
param
)
{
monDebug
(
"starting to initialize monitor module ..."
);
setThreadName
(
"monThrd"
);
while
(
1
)
{
static
int32_t
accessTimes
=
0
;
...
...
src/plugins/mqtt/src/mqttSystem.c
浏览文件 @
5e07893a
...
...
@@ -100,6 +100,8 @@ void mqttPublishCallback(void** unused, struct mqtt_response_publish* published)
}
void
*
mqttClientRefresher
(
void
*
client
)
{
setThreadName
(
"mqttCliRefresh"
);
while
(
tsMqttIsRuning
)
{
mqtt_sync
((
struct
mqtt_client
*
)
client
);
taosMsleep
(
100
);
...
...
src/rpc/src/rpcTcp.c
浏览文件 @
5e07893a
...
...
@@ -242,6 +242,7 @@ static void *taosAcceptTcpConnection(void *arg) {
pServerObj
=
(
SServerObj
*
)
arg
;
tDebug
(
"%s TCP server is ready, ip:0x%x:%hu"
,
pServerObj
->
label
,
pServerObj
->
ip
,
pServerObj
->
port
);
setThreadName
(
"acceptTcpConn"
);
while
(
1
)
{
socklen_t
addrlen
=
sizeof
(
caddr
);
...
...
@@ -528,6 +529,11 @@ static void *taosProcessTcpData(void *param) {
SFdObj
*
pFdObj
;
struct
epoll_event
events
[
maxEvents
];
SRecvInfo
recvInfo
;
char
name
[
16
];
memset
(
name
,
0
,
sizeof
(
name
));
snprintf
(
name
,
16
,
"%s-tcpData"
,
pThreadObj
->
label
);
setThreadName
(
name
);
while
(
1
)
{
int
fdNum
=
epoll_wait
(
pThreadObj
->
pollFd
,
events
,
maxEvents
,
TAOS_EPOLL_WAIT_TIME
);
...
...
src/rpc/src/rpcUdp.c
浏览文件 @
5e07893a
...
...
@@ -195,6 +195,8 @@ static void *taosRecvUdpData(void *param) {
tDebug
(
"%s UDP thread is created, index:%d"
,
pConn
->
label
,
pConn
->
index
);
char
*
msg
=
pConn
->
buffer
;
setThreadName
(
"recvUdpData"
);
while
(
1
)
{
dataLen
=
recvfrom
(
pConn
->
fd
,
pConn
->
buffer
,
RPC_MAX_UDP_SIZE
,
0
,
(
struct
sockaddr
*
)
&
sourceAdd
,
&
addLen
);
if
(
dataLen
<=
0
)
{
...
...
src/rpc/test/rclient.c
浏览文件 @
5e07893a
...
...
@@ -48,6 +48,8 @@ static void *sendRequest(void *param) {
SInfo
*
pInfo
=
(
SInfo
*
)
param
;
SRpcMsg
rpcMsg
=
{
0
};
setThreadName
(
"sendCliReq"
);
tDebug
(
"thread:%d, start to send request"
,
pInfo
->
index
);
while
(
pInfo
->
numOfReqs
==
0
||
pInfo
->
num
<
pInfo
->
numOfReqs
)
{
...
...
src/rpc/test/rsclient.c
浏览文件 @
5e07893a
...
...
@@ -41,6 +41,8 @@ static void *sendRequest(void *param) {
SInfo
*
pInfo
=
(
SInfo
*
)
param
;
SRpcMsg
rpcMsg
,
rspMsg
;
setThreadName
(
"sendSrvReq"
);
tDebug
(
"thread:%d, start to send request"
,
pInfo
->
index
);
while
(
pInfo
->
numOfReqs
==
0
||
pInfo
->
num
<
pInfo
->
numOfReqs
)
{
...
...
src/sync/src/syncRestore.c
浏览文件 @
5e07893a
...
...
@@ -263,6 +263,7 @@ static int32_t syncRestoreDataStepByStep(SSyncPeer *pPeer) {
}
void
*
syncRestoreData
(
void
*
param
)
{
setThreadName
(
"syncRestoreData"
);
int64_t
rid
=
(
int64_t
)
param
;
SSyncPeer
*
pPeer
=
syncAcquirePeer
(
rid
);
if
(
pPeer
==
NULL
)
{
...
...
src/sync/src/syncRetrieve.c
浏览文件 @
5e07893a
...
...
@@ -415,6 +415,7 @@ static int32_t syncRetrieveDataStepByStep(SSyncPeer *pPeer) {
}
void
*
syncRetrieveData
(
void
*
param
)
{
setThreadName
(
"syncRetrievData"
);
int64_t
rid
=
(
int64_t
)
param
;
SSyncPeer
*
pPeer
=
syncAcquirePeer
(
rid
);
if
(
pPeer
==
NULL
)
{
...
...
src/sync/src/syncTcp.c
浏览文件 @
5e07893a
...
...
@@ -195,6 +195,8 @@ static void *syncProcessTcpData(void *param) {
SConnObj
*
pConn
=
NULL
;
struct
epoll_event
events
[
maxEvents
];
setThreadName
(
"syncTcpData"
);
void
*
buffer
=
malloc
(
pInfo
->
bufferSize
);
taosBlockSIGPIPE
();
...
...
@@ -257,6 +259,7 @@ static void *syncAcceptPeerTcpConnection(void *argv) {
SPoolInfo
*
pInfo
=
&
pPool
->
info
;
taosBlockSIGPIPE
();
setThreadName
(
"acceptTcpConn"
);
while
(
1
)
{
struct
sockaddr_in
clientAddr
;
...
...
src/sync/test/syncClient.c
浏览文件 @
5e07893a
...
...
@@ -48,6 +48,8 @@ void *sendRequest(void *param) {
SInfo
*
pInfo
=
(
SInfo
*
)
param
;
SRpcMsg
rpcMsg
=
{
0
};
setThreadName
(
"sendCliReq"
);
uDebug
(
"thread:%d, start to send request"
,
pInfo
->
index
);
while
(
pInfo
->
numOfReqs
==
0
||
pInfo
->
num
<
pInfo
->
numOfReqs
)
{
...
...
src/sync/test/syncServer.c
浏览文件 @
5e07893a
...
...
@@ -178,6 +178,8 @@ void *processWriteQueue(void *param) {
int
type
;
void
*
item
;
setThreadName
(
"writeQ"
);
while
(
1
)
{
int
ret
=
taosReadQitem
(
qhandle
,
&
type
,
&
item
);
if
(
ret
<=
0
)
{
...
...
src/tsdb/src/tsdbCommitQueue.c
浏览文件 @
5e07893a
...
...
@@ -158,6 +158,8 @@ static void *tsdbLoopCommit(void *arg) {
STsdbRepo
*
pRepo
=
NULL
;
TSDB_REQ_T
req
;
setThreadName
(
"tsdbCommit"
);
while
(
true
)
{
pthread_mutex_lock
(
&
(
pQueue
->
lock
));
...
...
src/util/src/tcache.c
浏览文件 @
5e07893a
...
...
@@ -656,6 +656,8 @@ void* taosCacheTimedRefresh(void *handle) {
return
NULL
;
}
setThreadName
(
"cacheTimedRefre"
);
const
int32_t
SLEEP_DURATION
=
500
;
//500 ms
int64_t
totalTick
=
pCacheObj
->
refreshTime
/
SLEEP_DURATION
;
...
...
src/util/src/tlog.c
浏览文件 @
5e07893a
...
...
@@ -178,6 +178,8 @@ static void *taosThreadToOpenNewFile(void *param) {
char
keepName
[
LOG_FILE_NAME_LEN
+
20
];
sprintf
(
keepName
,
"%s.%d"
,
tsLogObj
.
logName
,
tsLogObj
.
flag
);
setThreadName
(
"openNewFile"
);
tsLogObj
.
flag
^=
1
;
tsLogObj
.
lines
=
0
;
char
name
[
LOG_FILE_NAME_LEN
+
20
];
...
...
@@ -688,6 +690,8 @@ static void taosWriteLog(SLogBuff *tLogBuff) {
static
void
*
taosAsyncOutputLog
(
void
*
param
)
{
SLogBuff
*
tLogBuff
=
(
SLogBuff
*
)
param
;
setThreadName
(
"asyncOutputLog"
);
while
(
1
)
{
//tsem_wait(&(tLogBuff->buffNotEmpty));
...
...
src/util/src/tnettest.c
浏览文件 @
5e07893a
...
...
@@ -50,6 +50,8 @@ static void *taosNetBindUdpPort(void *sarg) {
struct
sockaddr_in
server_addr
;
struct
sockaddr_in
clientAddr
;
setThreadName
(
"netBindUdpPort"
);
if
((
serverSocket
=
socket
(
AF_INET
,
SOCK_DGRAM
,
IPPROTO_UDP
))
<
0
)
{
uError
(
"failed to create UDP socket since %s"
,
strerror
(
errno
));
return
NULL
;
...
...
@@ -113,6 +115,8 @@ static void *taosNetBindTcpPort(void *sarg) {
SOCKET
client
;
char
buffer
[
BUFFER_SIZE
];
setThreadName
(
"netBindTcpPort"
);
if
((
serverSocket
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
))
<
0
)
{
uError
(
"failed to create TCP socket since %s"
,
strerror
(
errno
));
return
NULL
;
...
...
src/util/src/tnote.c
浏览文件 @
5e07893a
...
...
@@ -84,6 +84,8 @@ static void *taosThreadToOpenNewNote(void *param) {
char
name
[
NOTE_FILE_NAME_LEN
*
2
];
SNoteObj
*
pNote
=
(
SNoteObj
*
)
param
;
setThreadName
(
"openNewNote"
);
pNote
->
flag
^=
1
;
pNote
->
lines
=
0
;
sprintf
(
name
,
"%s.%d"
,
pNote
->
name
,
pNote
->
flag
);
...
...
src/util/src/tsched.c
浏览文件 @
5e07893a
...
...
@@ -122,6 +122,8 @@ void *taosProcessSchedQueue(void *scheduler) {
SSchedQueue
*
pSched
=
(
SSchedQueue
*
)
scheduler
;
int
ret
=
0
;
setThreadName
(
"schedQ"
);
while
(
1
)
{
if
((
ret
=
tsem_wait
(
&
pSched
->
fullSem
))
!=
0
)
{
uFatal
(
"wait %s fullSem failed(%s)"
,
pSched
->
label
,
strerror
(
errno
));
...
...
src/util/tests/trefTest.c
浏览文件 @
5e07893a
...
...
@@ -36,6 +36,8 @@ void *addRef(void *param) {
int
id
;
int64_t
rid
;
setThreadName
(
"addRef"
);
for
(
int
i
=
0
;
i
<
pSpace
->
steps
;
++
i
)
{
printf
(
"a"
);
id
=
random
()
%
pSpace
->
refNum
;
...
...
@@ -54,6 +56,8 @@ void *removeRef(void *param) {
int
id
;
int64_t
rid
;
setThreadName
(
"removeRef"
);
for
(
int
i
=
0
;
i
<
pSpace
->
steps
;
++
i
)
{
printf
(
"d"
);
id
=
random
()
%
pSpace
->
refNum
;
...
...
@@ -73,6 +77,8 @@ void *acquireRelease(void *param) {
int
id
;
int64_t
rid
;
setThreadName
(
"acquireRelease"
);
for
(
int
i
=
0
;
i
<
pSpace
->
steps
;
++
i
)
{
printf
(
"a"
);
...
...
@@ -94,6 +100,8 @@ void myfree(void *p) {
void
*
openRefSpace
(
void
*
param
)
{
SRefSpace
*
pSpace
=
(
SRefSpace
*
)
param
;
setThreadName
(
"openRefSpace"
);
printf
(
"c"
);
pSpace
->
rsetId
=
taosOpenRef
(
50
,
myfree
);
...
...
src/vnode/src/vnodeBackup.c
浏览文件 @
5e07893a
...
...
@@ -61,6 +61,8 @@ static void vnodeProcessBackupMsg(SVBackupMsg *pMsg) {
}
static
void
*
vnodeBackupFunc
(
void
*
param
)
{
setThreadName
(
"vnodeBackup"
);
while
(
1
)
{
SVBackupMsg
*
pMsg
=
NULL
;
if
(
taosReadQitemFromQset
(
tsVBackupQset
,
NULL
,
(
void
**
)
&
pMsg
,
NULL
)
==
0
)
{
...
...
src/vnode/src/vnodeWorker.c
浏览文件 @
5e07893a
...
...
@@ -188,6 +188,8 @@ static void vnodeProcessMWorkerMsg(SVMWorkerMsg *pMsg) {
}
static
void
*
vnodeMWorkerFunc
(
void
*
param
)
{
setThreadName
(
"vnodeMWorker"
);
while
(
1
)
{
SVMWorkerMsg
*
pMsg
=
NULL
;
if
(
taosReadQitemFromQset
(
tsVMWorkerQset
,
NULL
,
(
void
**
)
&
pMsg
,
NULL
)
==
0
)
{
...
...
src/wal/src/walMgmt.c
浏览文件 @
5e07893a
...
...
@@ -192,6 +192,7 @@ static void walFsyncAll() {
static
void
*
walThreadFunc
(
void
*
param
)
{
int
stop
=
0
;
setThreadName
(
"walThrd"
);
while
(
1
)
{
walUpdateSeq
();
walFsyncAll
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录