Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
aba4a194
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看板
未验证
提交
aba4a194
编写于
5月 15, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
5月 15, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1920 from taosdata/hotfix/savedVersion
Hotfix/saved version
上级
445168c5
44d0bfa4
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
25 addition
and
19 deletion
+25
-19
src/dnode/src/dnodeShell.c
src/dnode/src/dnodeShell.c
+1
-1
src/inc/tsync.h
src/inc/tsync.h
+2
-2
src/mnode/src/mgmtSdb.c
src/mnode/src/mgmtSdb.c
+1
-1
src/rpc/src/rpcMain.c
src/rpc/src/rpcMain.c
+1
-1
src/vnode/inc/vnodeInt.h
src/vnode/inc/vnodeInt.h
+7
-7
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+13
-7
未找到文件。
src/dnode/src/dnodeShell.c
浏览文件 @
aba4a194
...
...
@@ -157,8 +157,8 @@ static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char
if
(
rpcRsp
.
code
!=
0
)
{
dError
(
"user:%s, auth msg received from mnode, error:%s"
,
user
,
tstrerror
(
rpcRsp
.
code
));
}
else
{
dTrace
(
"user:%s, auth msg received from mnode"
,
user
);
SDMAuthRsp
*
pRsp
=
rpcRsp
.
pCont
;
dTrace
(
"user:%s, auth msg received from mnode"
,
user
);
memcpy
(
secret
,
pRsp
->
secret
,
TSDB_KEY_LEN
);
memcpy
(
ckey
,
pRsp
->
ckey
,
TSDB_KEY_LEN
);
*
spi
=
pRsp
->
spi
;
...
...
src/inc/tsync.h
浏览文件 @
aba4a194
...
...
@@ -57,7 +57,7 @@ typedef struct {
// if name is empty(name[0] is zero), get the file from index or after, used by master
// if name is provided(name[0] is not zero), get the named file at the specified index, used by unsynced node
// it returns the file magic number and size, if file not there, magic shall be 0.
typedef
uint32_t
(
*
FGetFileInfo
)(
void
*
ahandle
,
char
*
name
,
uint32_t
*
index
,
int32_t
*
size
);
typedef
uint32_t
(
*
FGetFileInfo
)(
void
*
ahandle
,
char
*
name
,
uint32_t
*
index
,
int32_t
*
size
,
uint64_t
*
fversion
);
// get the wal file from index or after
// return value, -1: error, 1:more wal files, 0:last WAL. if name[0]==0, no WAL file
...
...
@@ -73,7 +73,7 @@ typedef void (*FConfirmForward)(void *ahandle, void *mhandle, int32_t code);
typedef
void
(
*
FNotifyRole
)(
void
*
ahandle
,
int8_t
role
);
// when data file is synced successfully, notity app
typedef
void
(
*
FNotifyFileSynced
)(
void
*
ahandle
);
typedef
void
(
*
FNotifyFileSynced
)(
void
*
ahandle
,
uint64_t
fversion
);
typedef
struct
{
int32_t
vgId
;
// vgroup ID
...
...
src/mnode/src/mgmtSdb.c
浏览文件 @
aba4a194
...
...
@@ -185,7 +185,7 @@ void sdbUpdateMnodeRoles() {
}
}
static
uint32_t
sdbGetFileInfo
(
void
*
ahandle
,
char
*
name
,
uint32_t
*
index
,
int32_t
*
size
)
{
static
uint32_t
sdbGetFileInfo
(
void
*
ahandle
,
char
*
name
,
uint32_t
*
index
,
int32_t
*
size
,
uint64_t
*
fversion
)
{
sdbUpdateMnodeRoles
();
return
0
;
}
...
...
src/rpc/src/rpcMain.c
浏览文件 @
aba4a194
...
...
@@ -898,9 +898,9 @@ static void rpcNotifyClient(SRpcReqContext *pContext, SRpcMsg *pMsg) {
if
(
pContext
->
pRsp
)
{
// for synchronous API
tsem_post
(
pContext
->
pSem
);
memcpy
(
pContext
->
pSet
,
&
pContext
->
ipSet
,
sizeof
(
SRpcIpSet
));
memcpy
(
pContext
->
pRsp
,
pMsg
,
sizeof
(
SRpcMsg
));
tsem_post
(
pContext
->
pSem
);
}
else
{
// for asynchronous API
SRpcIpSet
*
pIpSet
=
NULL
;
...
...
src/vnode/inc/vnodeInt.h
浏览文件 @
aba4a194
...
...
@@ -37,8 +37,8 @@ typedef struct {
int32_t
refCount
;
// reference count
int
status
;
int8_t
role
;
int64_t
version
;
int64_t
savedVersion
;
int64_t
version
;
// current version
int64_t
fversion
;
// version on saved data file
void
*
wqueue
;
void
*
rqueue
;
void
*
wal
;
...
...
@@ -46,11 +46,11 @@ typedef struct {
void
*
sync
;
void
*
events
;
void
*
cq
;
// continuous query
int32_t
cfgVersion
;
STsdbCfg
tsdbCfg
;
SSyncCfg
syncCfg
;
SWalCfg
walCfg
;
char
*
rootDir
;
int32_t
cfgVersion
;
STsdbCfg
tsdbCfg
;
SSyncCfg
syncCfg
;
SWalCfg
walCfg
;
char
*
rootDir
;
}
SVnodeObj
;
int
vnodeWriteToQueue
(
void
*
param
,
void
*
pHead
,
int
type
);
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
aba4a194
...
...
@@ -37,10 +37,10 @@ static int32_t vnodeReadCfg(SVnodeObj *pVnode);
static
int32_t
vnodeSaveVersion
(
SVnodeObj
*
pVnode
);
static
bool
vnodeReadVersion
(
SVnodeObj
*
pVnode
);
static
int
vnodeProcessTsdbStatus
(
void
*
arg
,
int
status
);
static
uint32_t
vnodeGetFileInfo
(
void
*
ahandle
,
char
*
name
,
uint32_t
*
index
,
int32_t
*
size
);
static
uint32_t
vnodeGetFileInfo
(
void
*
ahandle
,
char
*
name
,
uint32_t
*
index
,
int32_t
*
size
,
uint64_t
*
fversion
);
static
int
vnodeGetWalInfo
(
void
*
ahandle
,
char
*
name
,
uint32_t
*
index
);
static
void
vnodeNotifyRole
(
void
*
ahandle
,
int8_t
role
);
static
void
vnodeNotifyFileSynced
(
void
*
ahandle
);
static
void
vnodeNotifyFileSynced
(
void
*
ahandle
,
uint64_t
fversion
);
static
pthread_once_t
vnodeModuleInit
=
PTHREAD_ONCE_INIT
;
...
...
@@ -196,6 +196,7 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) {
}
vnodeReadVersion
(
pVnode
);
pVnode
->
fversion
=
pVnode
->
version
;
pVnode
->
wqueue
=
dnodeAllocateWqueue
(
pVnode
);
pVnode
->
rqueue
=
dnodeAllocateRqueue
(
pVnode
);
...
...
@@ -394,7 +395,7 @@ static int vnodeProcessTsdbStatus(void *arg, int status) {
SVnodeObj
*
pVnode
=
arg
;
if
(
status
==
TSDB_STATUS_COMMIT_START
)
{
pVnode
->
savedV
ersion
=
pVnode
->
version
;
pVnode
->
fv
ersion
=
pVnode
->
version
;
return
walRenew
(
pVnode
->
wal
);
}
...
...
@@ -404,8 +405,9 @@ static int vnodeProcessTsdbStatus(void *arg, int status) {
return
0
;
}
static
uint32_t
vnodeGetFileInfo
(
void
*
ahandle
,
char
*
name
,
uint32_t
*
index
,
int32_t
*
size
)
{
static
uint32_t
vnodeGetFileInfo
(
void
*
ahandle
,
char
*
name
,
uint32_t
*
index
,
int32_t
*
size
,
uint64_t
*
fversion
)
{
SVnodeObj
*
pVnode
=
ahandle
;
*
fversion
=
pVnode
->
fversion
;
return
tsdbGetFileInfo
(
pVnode
->
tsdb
,
name
,
index
,
size
);
}
...
...
@@ -425,10 +427,14 @@ static void vnodeNotifyRole(void *ahandle, int8_t role) {
cqStop
(
pVnode
->
cq
);
}
static
void
vnodeNotifyFileSynced
(
void
*
ahandle
)
{
static
void
vnodeNotifyFileSynced
(
void
*
ahandle
,
uint64_t
fversion
)
{
SVnodeObj
*
pVnode
=
ahandle
;
vTrace
(
"vgId:%d, data file is synced"
,
pVnode
->
vgId
);
pVnode
->
fversion
=
fversion
;
pVnode
->
version
=
fversion
;
vnodeSaveVersion
(
pVnode
);
char
rootDir
[
128
]
=
"
\0
"
;
sprintf
(
rootDir
,
"%s/tsdb"
,
pVnode
->
rootDir
);
// clsoe tsdb, then open tsdb
...
...
@@ -706,14 +712,14 @@ static int32_t vnodeSaveVersion(SVnodeObj *pVnode) {
char
*
content
=
calloc
(
1
,
maxLen
+
1
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"{
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
version
\"
: %"
PRId64
"
\n
"
,
pVnode
->
savedV
ersion
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
version
\"
: %"
PRId64
"
\n
"
,
pVnode
->
fv
ersion
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"}
\n
"
);
fwrite
(
content
,
1
,
len
,
fp
);
fclose
(
fp
);
free
(
content
);
vPrint
(
"vgId:%d, save vnode version:%"
PRId64
" succeed"
,
pVnode
->
vgId
,
pVnode
->
savedV
ersion
);
vPrint
(
"vgId:%d, save vnode version:%"
PRId64
" succeed"
,
pVnode
->
vgId
,
pVnode
->
fv
ersion
);
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录