Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4076520a
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看板
提交
4076520a
编写于
5月 09, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: make show transactions and kill transaction work
上级
495bc3a3
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
41 addition
and
31 deletion
+41
-31
include/common/systable.h
include/common/systable.h
+14
-15
include/common/tglobal.h
include/common/tglobal.h
+8
-7
source/common/src/systable.c
source/common/src/systable.c
+1
-0
source/common/src/tglobal.c
source/common/src/tglobal.c
+8
-2
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+5
-2
source/dnode/mnode/impl/src/mnode.c
source/dnode/mnode/impl/src/mnode.c
+4
-4
source/dnode/mnode/impl/test/trans/trans2.cpp
source/dnode/mnode/impl/test/trans/trans2.cpp
+1
-1
未找到文件。
include/common/systable.h
浏览文件 @
4076520a
...
...
@@ -23,7 +23,6 @@ extern "C" {
#define TDENGINE_SYSTABLE_H
#define TSDB_INFORMATION_SCHEMA_DB "information_schema"
#define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema"
#define TSDB_INS_TABLE_DNODES "dnodes"
#define TSDB_INS_TABLE_MNODES "mnodes"
#define TSDB_INS_TABLE_MODULES "modules"
...
...
@@ -44,27 +43,27 @@ extern "C" {
#define TSDB_INS_TABLE_VNODES "vnodes"
#define TSDB_INS_TABLE_CONFIGS "configs"
#define TSDB_PERFORMANCE_SCHEMA_DB
"performance_schema"
#define TSDB_PERFS_TABLE_SMAS
"smas"
#define TSDB_PERFS_TABLE_SUBSCRIBES
"subscribes"
#define TSDB_PERFS_TABLE_CONNECTIONS
"connections"
#define TSDB_PERFS_TABLE_QUERIES
"queries"
#define TSDB_PERFS_TABLE_TOPICS
"topics"
#define TSDB_PERFS_TABLE_CONSUMERS
"consumers"
#define TSDB_PERFS_TABLE_SUBSCRIPTIONS
"subscriptions"
#define TSDB_PERFS_TABLE_OFFSETS
"offsets"
#define TSDB_PERFS_TABLE_TRANS
"trans"
#define TSDB_PERFS_TABLE_STREAMS
"streams"
#define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema"
#define TSDB_PERFS_TABLE_SMAS "smas"
#define TSDB_PERFS_TABLE_SUBSCRIBES "subscribes"
#define TSDB_PERFS_TABLE_CONNECTIONS "connections"
#define TSDB_PERFS_TABLE_QUERIES "queries"
#define TSDB_PERFS_TABLE_TOPICS "topics"
#define TSDB_PERFS_TABLE_CONSUMERS "consumers"
#define TSDB_PERFS_TABLE_SUBSCRIPTIONS "subscriptions"
#define TSDB_PERFS_TABLE_OFFSETS "offsets"
#define TSDB_PERFS_TABLE_TRANS "trans"
#define TSDB_PERFS_TABLE_STREAMS "streams"
typedef
struct
SSysDbTableSchema
{
const
char
*
name
;
const
char
*
name
;
const
int32_t
type
;
const
int32_t
bytes
;
}
SSysDbTableSchema
;
typedef
struct
SSysTableMeta
{
const
char
*
name
;
const
SSysDbTableSchema
*
schema
;
const
char
*
name
;
const
SSysDbTableSchema
*
schema
;
const
int32_t
colNum
;
}
SSysTableMeta
;
...
...
include/common/tglobal.h
浏览文件 @
4076520a
...
...
@@ -17,8 +17,8 @@
#define _TD_COMMON_GLOBAL_H_
#include "tarray.h"
#include "tdef.h"
#include "tconfig.h"
#include "tdef.h"
#ifdef __cplusplus
extern
"C"
{
...
...
@@ -121,15 +121,16 @@ extern char tsCompressor[];
extern
int32_t
tsDiskCfgNum
;
extern
SDiskCfg
tsDiskCfg
[];
// internal
extern
int32_t
tsTransPullup
Ms
;
extern
int32_t
tsM
aRebalanceMs
;
// internal
extern
int32_t
tsTransPullup
Interval
;
extern
int32_t
tsM
qRebalanceInterval
;
#define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
int32_t
taosCreateLog
(
const
char
*
logname
,
int32_t
logFileNum
,
const
char
*
cfgDir
,
const
char
**
envCmd
,
const
char
*
envFile
,
char
*
apolloUrl
,
SArray
*
pArgs
,
bool
tsc
);
int32_t
taosInitCfg
(
const
char
*
cfgDir
,
const
char
**
envCmd
,
const
char
*
envFile
,
char
*
apolloUrl
,
SArray
*
pArgs
,
bool
tsc
);
int32_t
taosCreateLog
(
const
char
*
logname
,
int32_t
logFileNum
,
const
char
*
cfgDir
,
const
char
**
envCmd
,
const
char
*
envFile
,
char
*
apolloUrl
,
SArray
*
pArgs
,
bool
tsc
);
int32_t
taosInitCfg
(
const
char
*
cfgDir
,
const
char
**
envCmd
,
const
char
*
envFile
,
char
*
apolloUrl
,
SArray
*
pArgs
,
bool
tsc
);
void
taosCleanupCfg
();
void
taosCfgDynamicOptions
(
const
char
*
option
,
const
char
*
value
);
void
taosAddDataDir
(
int32_t
index
,
char
*
v1
,
int32_t
level
,
int32_t
primary
);
...
...
source/common/src/systable.c
浏览文件 @
4076520a
...
...
@@ -211,6 +211,7 @@ static const SSysDbTableSchema transSchema[] = {
{.
name
=
"stage"
,
.
bytes
=
TSDB_TRANS_STAGE_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"db"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"type"
,
.
bytes
=
TSDB_TRANS_TYPE_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"failed_times"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"last_exec_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"last_error"
,
.
bytes
=
(
TSDB_TRANS_ERROR_LEN
-
1
)
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
};
...
...
source/common/src/tglobal.c
浏览文件 @
4076520a
...
...
@@ -170,8 +170,8 @@ uint32_t tsCurRange = 100; // range
char
tsCompressor
[
32
]
=
"ZSTD_COMPRESSOR"
;
// ZSTD_COMPRESSOR or GZIP_COMPRESSOR
// internal
int32_t
tsTransPullup
Ms
=
6000
;
int32_t
tsM
aRebalanceMs
=
2000
;
int32_t
tsTransPullup
Interval
=
6
;
int32_t
tsM
qRebalanceInterval
=
2
;
void
taosAddDataDir
(
int32_t
index
,
char
*
v1
,
int32_t
level
,
int32_t
primary
)
{
tstrncpy
(
tsDiskCfg
[
index
].
dir
,
v1
,
TSDB_FILENAME_LEN
);
...
...
@@ -438,6 +438,9 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if
(
cfgAddString
(
pCfg
,
"telemetryServer"
,
tsTelemServer
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"telemetryPort"
,
tsTelemPort
,
1
,
65056
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"transPullupInterval"
,
tsTransPullupInterval
,
1
,
10000
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"mqRebalanceInterval"
,
tsMqRebalanceInterval
,
1
,
10000
,
1
)
!=
0
)
return
-
1
;
return
0
;
}
...
...
@@ -575,6 +578,9 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
tstrncpy
(
tsTelemServer
,
cfgGetItem
(
pCfg
,
"telemetryServer"
)
->
str
,
TSDB_FQDN_LEN
);
tsTelemPort
=
(
uint16_t
)
cfgGetItem
(
pCfg
,
"telemetryPort"
)
->
i32
;
tsTransPullupInterval
=
cfgGetItem
(
pCfg
,
"transPullupInterval"
)
->
i32
;
tsMqRebalanceInterval
=
cfgGetItem
(
pCfg
,
"mqRebalanceInterval"
)
->
i32
;
if
(
tsQueryBufferSize
>=
0
)
{
tsQueryBufferSizeBytes
=
tsQueryBufferSize
*
1048576UL
;
}
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
4076520a
...
...
@@ -1405,15 +1405,18 @@ static int32_t mndRetrieveTrans(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *pB
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
dbname
,
false
);
char
type
[
TSDB_TRANS_TYPE_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
dbnam
e
,
mndTransType
(
pTrans
->
type
),
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
STR_WITH_MAXSIZE_TO_VARSTR
(
typ
e
,
mndTransType
(
pTrans
->
type
),
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
type
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pTrans
->
failedTimes
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pTrans
->
lastExecTime
,
false
);
char
lastError
[
TSDB_TRANS_ERROR_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
dbname
,
pTrans
->
lastError
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
STR_WITH_MAXSIZE_TO_VARSTR
(
lastError
,
pTrans
->
lastError
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
lastError
,
false
);
...
...
source/dnode/mnode/impl/src/mnode.c
浏览文件 @
4076520a
...
...
@@ -65,7 +65,7 @@ static void mndPullupTrans(void *param, void *tmrId) {
tmsgPutToQueue
(
&
pMnode
->
msgCb
,
WRITE_QUEUE
,
&
rpcMsg
);
}
taosTmrReset
(
mndPullupTrans
,
tsTransPullup
Ms
,
pMnode
,
pMnode
->
timer
,
&
pMnode
->
transTimer
);
taosTmrReset
(
mndPullupTrans
,
tsTransPullup
Interval
*
1000
,
pMnode
,
pMnode
->
timer
,
&
pMnode
->
transTimer
);
}
static
void
mndCalMqRebalance
(
void
*
param
,
void
*
tmrId
)
{
...
...
@@ -81,7 +81,7 @@ static void mndCalMqRebalance(void *param, void *tmrId) {
tmsgPutToQueue
(
&
pMnode
->
msgCb
,
READ_QUEUE
,
&
rpcMsg
);
}
taosTmrReset
(
mndCalMqRebalance
,
tsM
aRebalanceMs
,
pMnode
,
pMnode
->
timer
,
&
pMnode
->
mqTimer
);
taosTmrReset
(
mndCalMqRebalance
,
tsM
qRebalanceInterval
*
1000
,
pMnode
,
pMnode
->
timer
,
&
pMnode
->
mqTimer
);
}
static
void
mndPullupTelem
(
void
*
param
,
void
*
tmrId
)
{
...
...
@@ -103,12 +103,12 @@ static int32_t mndInitTimer(SMnode *pMnode) {
return
-
1
;
}
if
(
taosTmrReset
(
mndPullupTrans
,
tsTransPullup
Ms
,
pMnode
,
pMnode
->
timer
,
&
pMnode
->
transTimer
))
{
if
(
taosTmrReset
(
mndPullupTrans
,
tsTransPullup
Interval
*
1000
,
pMnode
,
pMnode
->
timer
,
&
pMnode
->
transTimer
))
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
if
(
taosTmrReset
(
mndCalMqRebalance
,
tsM
aRebalanceMs
,
pMnode
,
pMnode
->
timer
,
&
pMnode
->
mqTimer
))
{
if
(
taosTmrReset
(
mndCalMqRebalance
,
tsM
qRebalanceInterval
*
1000
,
pMnode
,
pMnode
->
timer
,
&
pMnode
->
mqTimer
))
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
...
...
source/dnode/mnode/impl/test/trans/trans2.cpp
浏览文件 @
4076520a
...
...
@@ -58,7 +58,7 @@ class MndTestTrans2 : public ::testing::Test {
strcpy
(
opt
.
replicas
[
0
].
fqdn
,
"localhost"
);
opt
.
msgCb
=
msgCb
;
tsTransPullup
Ms
=
1000
;
tsTransPullup
Interval
=
1
;
const
char
*
mnodepath
=
"/tmp/mnode_test_trans"
;
taosRemoveDir
(
mnodepath
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录