Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
922711df
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
922711df
编写于
11月 14, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into feature/query
上级
ef960e90
e8f6c7b4
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
55 addition
and
36 deletion
+55
-36
src/connector/go
src/connector/go
+1
-1
src/dnode/src/dnodeVWrite.c
src/dnode/src/dnodeVWrite.c
+7
-5
src/inc/taosdef.h
src/inc/taosdef.h
+1
-1
src/inc/tsdb.h
src/inc/tsdb.h
+2
-2
src/mnode/src/mnodeSdb.c
src/mnode/src/mnodeSdb.c
+1
-1
src/sync/src/syncMain.c
src/sync/src/syncMain.c
+26
-12
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+5
-1
src/tsdb/src/tsdbMemTable.c
src/tsdb/src/tsdbMemTable.c
+1
-1
src/util/tests/trefTest.c
src/util/tests/trefTest.c
+2
-2
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+2
-3
src/vnode/src/vnodeRead.c
src/vnode/src/vnodeRead.c
+3
-3
src/vnode/src/vnodeWrite.c
src/vnode/src/vnodeWrite.c
+3
-3
tests/examples/JDBC/connectionPools/pom.xml
tests/examples/JDBC/connectionPools/pom.xml
+1
-1
未找到文件。
go
@
050667e5
比较
8d7bf743
...
050667e5
Subproject commit
8d7bf743852897110cbdcc7c4322cd7a74d4167b
Subproject commit
050667e5b4d0eafa5387e4283e713559b421203f
src/dnode/src/dnodeVWrite.c
浏览文件 @
922711df
...
...
@@ -212,7 +212,7 @@ static void *dnodeProcessVWriteQueue(void *param) {
pWrite
->
code
=
vnodeProcessWrite
(
pVnode
,
pWrite
->
pHead
,
qtype
,
&
pWrite
->
rspRet
);
if
(
pWrite
->
code
<=
0
)
pWrite
->
processedCount
=
1
;
if
(
pWrite
->
pHead
->
msgType
!=
TSDB_MSG_TYPE_SUBMIT
)
forceFsync
=
true
;
if
(
pWrite
->
code
==
0
&&
pWrite
->
pHead
->
msgType
!=
TSDB_MSG_TYPE_SUBMIT
)
forceFsync
=
true
;
dTrace
(
"msg:%p is processed in vwrite queue, result:%s"
,
pWrite
,
tstrerror
(
pWrite
->
code
));
}
...
...
@@ -225,11 +225,13 @@ static void *dnodeProcessVWriteQueue(void *param) {
taosGetQitem
(
pWorker
->
qall
,
&
qtype
,
(
void
**
)
&
pWrite
);
if
(
qtype
==
TAOS_QTYPE_RPC
)
{
dnodeSendRpcVWriteRsp
(
pVnode
,
pWrite
,
pWrite
->
code
);
}
else
if
(
qtype
==
TAOS_QTYPE_FWD
)
{
vnodeConfirmForward
(
pVnode
,
pWrite
->
pHead
->
version
,
0
);
taosFreeQitem
(
pWrite
);
vnodeRelease
(
pVnode
);
}
else
{
if
(
qtype
==
TAOS_QTYPE_FWD
)
{
vnodeConfirmForward
(
pVnode
,
pWrite
->
pHead
->
version
,
0
);
}
if
(
pWrite
->
rspRet
.
rsp
)
{
rpcFreeCont
(
pWrite
->
rspRet
.
rsp
);
}
taosFreeQitem
(
pWrite
);
vnodeRelease
(
pVnode
);
}
...
...
src/inc/taosdef.h
浏览文件 @
922711df
...
...
@@ -332,7 +332,7 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size, void* buf
#define TSDB_MIN_DAYS_PER_FILE 1
#define TSDB_MAX_DAYS_PER_FILE 3650
#define TSDB_DEFAULT_DAYS_PER_FILE
2
#define TSDB_DEFAULT_DAYS_PER_FILE
10
#define TSDB_MIN_KEEP 1 // data in db to be reserved.
#define TSDB_MAX_KEEP 365000 // data in db to be reserved.
...
...
src/inc/tsdb.h
浏览文件 @
922711df
...
...
@@ -126,7 +126,7 @@ uint32_t tsdbGetFileInfo(TSDB_REPO_T *repo, char *name, uint32_t *index, uint32_
// the TSDB repository info
typedef
struct
STsdbRepoInfo
{
STsdbCfg
tsdbCfg
;
int64_t
version
;
// version of the repository
uint64_t
version
;
// version of the repository
int64_t
tsdbTotalDataSize
;
// the original inserted data size
int64_t
tsdbTotalDiskSize
;
// the total disk size taken by this TSDB repository
// TODO: Other informations to add
...
...
@@ -136,7 +136,7 @@ STsdbRepoInfo *tsdbGetStatus(TSDB_REPO_T *pRepo);
// the meter information report structure
typedef
struct
{
STableCfg
tableCfg
;
int64_t
version
;
uint64_t
version
;
int64_t
tableTotalDataSize
;
// In bytes
int64_t
tableTotalDiskSize
;
// In bytes
}
STableInfo
;
...
...
src/mnode/src/mnodeSdb.c
浏览文件 @
922711df
...
...
@@ -71,7 +71,7 @@ typedef struct _SSdbTable {
typedef
struct
{
ESyncRole
role
;
ESdbStatus
status
;
int64_t
version
;
uint64_t
version
;
int64_t
sync
;
void
*
wal
;
SSyncCfg
cfg
;
...
...
src/sync/src/syncMain.c
浏览文件 @
922711df
...
...
@@ -352,7 +352,7 @@ void syncConfirmForward(int64_t rid, uint64_t version, int32_t code) {
int32_t
retLen
=
write
(
pPeer
->
peerFd
,
msg
,
msgLen
);
if
(
retLen
==
msgLen
)
{
sDebug
(
"%s, forward-rsp is sent,
ver:%"
PRIu64
,
pPeer
->
id
,
version
);
sDebug
(
"%s, forward-rsp is sent,
code:%x hver:%"
PRIu64
,
pPeer
->
id
,
code
,
version
);
}
else
{
sDebug
(
"%s, failed to send forward ack, restart"
,
pPeer
->
id
);
syncRestartConnection
(
pPeer
);
...
...
@@ -498,7 +498,7 @@ static SSyncPeer *syncAddPeer(SSyncNode *pNode, const SNodeInfo *pInfo) {
int32_t
ret
=
strcmp
(
pPeer
->
fqdn
,
tsNodeFqdn
);
if
(
pPeer
->
nodeId
==
0
||
(
ret
>
0
)
||
(
ret
==
0
&&
pPeer
->
port
>
tsSyncPort
))
{
int32_t
checkMs
=
100
+
(
pNode
->
vgId
*
10
)
%
100
;
if
(
pNode
->
vgId
>
1
)
checkMs
=
tsStatusInterval
*
2
000
+
checkMs
;
if
(
pNode
->
vgId
>
1
)
checkMs
=
tsStatusInterval
*
1
000
+
checkMs
;
sDebug
(
"%s, start to check peer connection after %d ms"
,
pPeer
->
id
,
checkMs
);
taosTmrReset
(
syncCheckPeerConnection
,
checkMs
,
pPeer
,
tsSyncTmrCtrl
,
&
pPeer
->
timer
);
}
...
...
@@ -575,6 +575,17 @@ static void syncChooseMaster(SSyncNode *pNode) {
if
(
index
==
pNode
->
selfIndex
)
{
sInfo
(
"vgId:%d, start to work as master"
,
pNode
->
vgId
);
nodeRole
=
TAOS_SYNC_ROLE_MASTER
;
#if 0
for (int32_t i = 0; i < pNode->replica; ++i) {
pPeer = pNode->peerInfo[i];
if (pPeer->version == nodeVersion) {
pPeer->role = TAOS_SYNC_ROLE_SLAVE;
pPeer->sstatus = TAOS_SYNC_STATUS_CACHE;
sInfo("%s, it shall work as slave", pPeer->id);
}
}
#endif
syncResetFlowCtrl
(
pNode
);
(
*
pNode
->
notifyRole
)(
pNode
->
ahandle
,
nodeRole
);
}
else
{
...
...
@@ -831,7 +842,7 @@ static void syncProcessFwdResponse(char *cont, SSyncPeer *pPeer) {
SSyncFwds
*
pSyncFwds
=
pNode
->
pSyncFwds
;
SFwdInfo
*
pFwdInfo
;
sDebug
(
"%s, forward-rsp is received,
ver:%"
PRIu64
,
pPeer
->
id
,
pFwdRsp
->
version
);
sDebug
(
"%s, forward-rsp is received,
code:%x ver:%"
PRIu64
,
pPeer
->
id
,
pFwdRsp
->
code
,
pFwdRsp
->
version
);
SFwdInfo
*
pFirst
=
pSyncFwds
->
fwdInfo
+
pSyncFwds
->
first
;
if
(
pFirst
->
version
<=
pFwdRsp
->
version
&&
pSyncFwds
->
fwds
>
0
)
{
...
...
@@ -1097,7 +1108,7 @@ static void syncProcessBrokenLink(void *param) {
SSyncPeer
*
pPeer
=
param
;
SSyncNode
*
pNode
=
pPeer
->
pSyncNode
;
if
(
taosAcquireRef
(
tsSyncRefId
,
pNode
->
rid
)
<
0
)
return
;
if
(
taosAcquireRef
(
tsSyncRefId
,
pNode
->
rid
)
==
NULL
)
return
;
pthread_mutex_lock
(
&
(
pNode
->
mutex
));
sDebug
(
"%s, TCP link is broken(%s)"
,
pPeer
->
id
,
strerror
(
errno
));
...
...
@@ -1125,10 +1136,9 @@ static void syncSaveFwdInfo(SSyncNode *pNode, uint64_t version, void *mhandle) {
}
SFwdInfo
*
pFwdInfo
=
pSyncFwds
->
fwdInfo
+
pSyncFwds
->
last
;
memset
(
pFwdInfo
,
0
,
sizeof
(
SFwdInfo
));
pFwdInfo
->
version
=
version
;
pFwdInfo
->
mhandle
=
mhandle
;
pFwdInfo
->
acks
=
0
;
pFwdInfo
->
confirmed
=
0
;
pFwdInfo
->
time
=
time
;
pSyncFwds
->
fwds
++
;
...
...
@@ -1210,13 +1220,17 @@ static int32_t syncForwardToPeerImpl(SSyncNode *pNode, void *data, void *mhandle
int32_t
fwdLen
;
int32_t
code
=
0
;
if
(
nodeRole
==
TAOS_SYNC_ROLE_SLAVE
&&
pWalHead
->
version
!=
nodeVersion
+
1
)
{
sError
(
"vgId:%d, received ver:%"
PRIu64
", inconsistent with last ver:%"
PRIu64
", restart connection"
,
pNode
->
vgId
,
pWalHead
->
version
,
nodeVersion
);
for
(
int32_t
i
=
0
;
i
<
pNode
->
replica
;
++
i
)
{
pPeer
=
pNode
->
peerInfo
[
i
];
syncRestartConnection
(
pPeer
);
if
(
pWalHead
->
version
>
nodeVersion
+
1
)
{
sError
(
"vgId:%d, hver:%"
PRIu64
", inconsistent with ver:%"
PRIu64
,
pNode
->
vgId
,
pWalHead
->
version
,
nodeVersion
);
if
(
nodeRole
==
TAOS_SYNC_ROLE_SLAVE
)
{
sInfo
(
"vgId:%d, restart connection"
,
pNode
->
vgId
);
for
(
int32_t
i
=
0
;
i
<
pNode
->
replica
;
++
i
)
{
pPeer
=
pNode
->
peerInfo
[
i
];
syncRestartConnection
(
pPeer
);
}
}
return
TSDB_CODE_SYN_INVALID_VERSION
;
}
...
...
src/tsdb/src/tsdbMain.c
浏览文件 @
922711df
...
...
@@ -294,6 +294,7 @@ STsdbCfg *tsdbGetCfg(const TSDB_REPO_T *repo) {
int32_t
tsdbConfigRepo
(
TSDB_REPO_T
*
repo
,
STsdbCfg
*
pCfg
)
{
// TODO: think about multithread cases
STsdbRepo
*
pRepo
=
(
STsdbRepo
*
)
repo
;
STsdbCfg
config
=
pRepo
->
config
;
STsdbCfg
*
pRCfg
=
&
pRepo
->
config
;
if
(
tsdbCheckAndSetDefaultCfg
(
pCfg
)
<
0
)
return
-
1
;
...
...
@@ -308,22 +309,25 @@ int32_t tsdbConfigRepo(TSDB_REPO_T *repo, STsdbCfg *pCfg) {
bool
configChanged
=
false
;
if
(
pRCfg
->
compression
!=
pCfg
->
compression
)
{
tsdbAlterCompression
(
pRepo
,
pCfg
->
compression
);
config
.
compression
=
pCfg
->
compression
;
configChanged
=
true
;
}
if
(
pRCfg
->
keep
!=
pCfg
->
keep
)
{
if
(
tsdbAlterKeep
(
pRepo
,
pCfg
->
keep
)
<
0
)
{
tsdbError
(
"vgId:%d failed to configure repo when alter keep since %s"
,
REPO_ID
(
pRepo
),
tstrerror
(
terrno
));
config
.
keep
=
pCfg
->
keep
;
return
-
1
;
}
configChanged
=
true
;
}
if
(
pRCfg
->
totalBlocks
!=
pCfg
->
totalBlocks
)
{
tsdbAlterCacheTotalBlocks
(
pRepo
,
pCfg
->
totalBlocks
);
config
.
totalBlocks
=
pCfg
->
totalBlocks
;
configChanged
=
true
;
}
if
(
configChanged
)
{
if
(
tsdbSaveConfig
(
pRepo
->
rootDir
,
&
pRepo
->
config
)
<
0
)
{
if
(
tsdbSaveConfig
(
pRepo
->
rootDir
,
&
config
)
<
0
)
{
tsdbError
(
"vgId:%d failed to configure repository while save config since %s"
,
REPO_ID
(
pRepo
),
tstrerror
(
terrno
));
return
-
1
;
}
...
...
src/tsdb/src/tsdbMemTable.c
浏览文件 @
922711df
...
...
@@ -462,8 +462,8 @@ _exit:
tdFreeDataCols
(
pDataCols
);
tsdbDestroyCommitIters
(
iters
,
pMem
->
maxTables
);
tsdbDestroyHelper
(
&
whelper
);
tsdbEndCommit
(
pRepo
);
tsdbInfo
(
"vgId:%d commit over"
,
pRepo
->
config
.
tsdbId
);
tsdbEndCommit
(
pRepo
);
return
NULL
;
}
...
...
src/util/tests/trefTest.c
浏览文件 @
922711df
...
...
@@ -77,8 +77,8 @@ void *acquireRelease(void *param) {
printf
(
"a"
);
id
=
random
()
%
pSpace
->
refNum
;
code
=
taosAcquireRef
(
pSpace
->
rsetId
,
pSpace
->
p
[
id
]);
if
(
code
>=
0
)
{
void
*
p
=
taosAcquireRef
(
pSpace
->
rsetId
,
pSpace
->
p
[
id
]);
if
(
p
)
{
usleep
(
id
%
5
+
1
);
taosReleaseRef
(
pSpace
->
rsetId
,
pSpace
->
p
[
id
]);
}
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
922711df
...
...
@@ -637,9 +637,8 @@ static int vnodeResetTsdb(SVnodeObj *pVnode) {
char
rootDir
[
128
]
=
"
\0
"
;
sprintf
(
rootDir
,
"%s/tsdb"
,
pVnode
->
rootDir
);
if
(
atomic_val_compare_exchange_8
(
&
pVnode
->
status
,
TAOS_VN_STATUS_READY
,
TAOS_VN_STATUS_RESET
)
!=
TAOS_VN_STATUS_READY
)
{
return
-
1
;
if
(
pVnode
->
status
!=
TAOS_VN_STATUS_CLOSING
&&
pVnode
->
status
!=
TAOS_VN_STATUS_INIT
)
{
pVnode
->
status
=
TAOS_VN_STATUS_RESET
;
}
void
*
tsdb
=
pVnode
->
tsdb
;
...
...
src/vnode/src/vnodeRead.c
浏览文件 @
922711df
...
...
@@ -56,19 +56,19 @@ int32_t vnodeProcessRead(void *param, SVReadMsg *pRead) {
static
int32_t
vnodeCheckRead
(
void
*
param
)
{
SVnodeObj
*
pVnode
=
param
;
if
(
pVnode
->
status
!=
TAOS_VN_STATUS_READY
)
{
vDebug
(
"vgId:%d, vnode status is %s, re
c
Count:%d pVnode:%p"
,
pVnode
->
vgId
,
vnodeStatus
[
pVnode
->
status
],
vDebug
(
"vgId:%d, vnode status is %s, re
f
Count:%d pVnode:%p"
,
pVnode
->
vgId
,
vnodeStatus
[
pVnode
->
status
],
pVnode
->
refCount
,
pVnode
);
return
TSDB_CODE_APP_NOT_READY
;
}
// tsdb may be in reset state
if
(
pVnode
->
tsdb
==
NULL
)
{
vDebug
(
"vgId:%d, tsdb is null, re
c
Count:%d pVnode:%p"
,
pVnode
->
vgId
,
pVnode
->
refCount
,
pVnode
);
vDebug
(
"vgId:%d, tsdb is null, re
f
Count:%d pVnode:%p"
,
pVnode
->
vgId
,
pVnode
->
refCount
,
pVnode
);
return
TSDB_CODE_APP_NOT_READY
;
}
if
(
pVnode
->
role
!=
TAOS_SYNC_ROLE_SLAVE
&&
pVnode
->
role
!=
TAOS_SYNC_ROLE_MASTER
)
{
vDebug
(
"vgId:%d, replica:%d role:%s, re
c
Count:%d pVnode:%p"
,
pVnode
->
vgId
,
pVnode
->
syncCfg
.
replica
,
vDebug
(
"vgId:%d, replica:%d role:%s, re
f
Count:%d pVnode:%p"
,
pVnode
->
vgId
,
pVnode
->
syncCfg
.
replica
,
syncRole
[
pVnode
->
role
],
pVnode
->
refCount
,
pVnode
);
return
TSDB_CODE_APP_NOT_READY
;
}
...
...
src/vnode/src/vnodeWrite.c
浏览文件 @
922711df
...
...
@@ -103,18 +103,18 @@ int32_t vnodeProcessWrite(void *vparam, void *wparam, int32_t qtype, void *rpara
static
int32_t
vnodeCheckWrite
(
void
*
param
)
{
SVnodeObj
*
pVnode
=
param
;
if
(
!
(
pVnode
->
accessState
&
TSDB_VN_WRITE_ACCCESS
))
{
vDebug
(
"vgId:%d, no write auth, re
c
Count:%d pVnode:%p"
,
pVnode
->
vgId
,
pVnode
->
refCount
,
pVnode
);
vDebug
(
"vgId:%d, no write auth, re
f
Count:%d pVnode:%p"
,
pVnode
->
vgId
,
pVnode
->
refCount
,
pVnode
);
return
TSDB_CODE_VND_NO_WRITE_AUTH
;
}
// tsdb may be in reset state
if
(
pVnode
->
tsdb
==
NULL
)
{
vDebug
(
"vgId:%d, tsdb is null, re
c
Count:%d pVnode:%p"
,
pVnode
->
vgId
,
pVnode
->
refCount
,
pVnode
);
vDebug
(
"vgId:%d, tsdb is null, re
f
Count:%d pVnode:%p"
,
pVnode
->
vgId
,
pVnode
->
refCount
,
pVnode
);
return
TSDB_CODE_APP_NOT_READY
;
}
if
(
pVnode
->
status
==
TAOS_VN_STATUS_CLOSING
)
{
vDebug
(
"vgId:%d, vnode status is %s, re
c
Count:%d pVnode:%p"
,
pVnode
->
vgId
,
vnodeStatus
[
pVnode
->
status
],
vDebug
(
"vgId:%d, vnode status is %s, re
f
Count:%d pVnode:%p"
,
pVnode
->
vgId
,
vnodeStatus
[
pVnode
->
status
],
pVnode
->
refCount
,
pVnode
);
return
TSDB_CODE_APP_NOT_READY
;
}
...
...
tests/examples/JDBC/connectionPools/pom.xml
浏览文件 @
922711df
...
...
@@ -42,7 +42,7 @@
<dependency>
<groupId>
com.mchange
</groupId>
<artifactId>
c3p0
</artifactId>
<version>
0.9.5.
2
</version>
<version>
0.9.5.
4
</version>
</dependency>
<!-- log4j -->
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录