Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
73710da5
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看板
提交
73710da5
编写于
12月 25, 2022
作者:
K
kailixu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: rsma sync and assert
上级
ed3a0c1d
变更
10
展开全部
隐藏空白更改
内联
并排
Showing
10 changed file
with
378 addition
and
351 deletion
+378
-351
include/util/taoserror.h
include/util/taoserror.h
+3
-0
source/dnode/vnode/src/inc/sma.h
source/dnode/vnode/src/inc/sma.h
+7
-12
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+2
-0
source/dnode/vnode/src/sma/smaFS.c
source/dnode/vnode/src/sma/smaFS.c
+84
-14
source/dnode/vnode/src/sma/smaOpen.c
source/dnode/vnode/src/sma/smaOpen.c
+8
-5
source/dnode/vnode/src/sma/smaRollup.c
source/dnode/vnode/src/sma/smaRollup.c
+2
-2
source/dnode/vnode/src/sma/smaSnapshot.c
source/dnode/vnode/src/sma/smaSnapshot.c
+240
-239
source/dnode/vnode/src/sma/smaTimeRange.c
source/dnode/vnode/src/sma/smaTimeRange.c
+28
-10
source/dnode/vnode/src/sma/smaUtil.c
source/dnode/vnode/src/sma/smaUtil.c
+0
-68
source/util/src/terror.c
source/util/src/terror.c
+4
-1
未找到文件。
include/util/taoserror.h
浏览文件 @
73710da5
...
...
@@ -708,6 +708,9 @@ int32_t* taosGetErrno();
#define TSDB_CODE_RSMA_REGEX_MATCH TAOS_DEF_ERROR_CODE(0, 0x3158)
#define TSDB_CODE_RSMA_STREAM_STATE_OPEN TAOS_DEF_ERROR_CODE(0, 0x3159)
#define TSDB_CODE_RSMA_STREAM_STATE_COMMIT TAOS_DEF_ERROR_CODE(0, 0x3160)
#define TSDB_CODE_RSMA_FS_REF TAOS_DEF_ERROR_CODE(0, 0x3161)
#define TSDB_CODE_RSMA_FS_SYNC TAOS_DEF_ERROR_CODE(0, 0x3162)
#define TSDB_CODE_RSMA_FS_UPDATE TAOS_DEF_ERROR_CODE(0, 0x3163)
//index
#define TSDB_CODE_INDEX_REBUILDING TAOS_DEF_ERROR_CODE(0, 0x3200)
...
...
source/dnode/vnode/src/inc/sma.h
浏览文件 @
73710da5
...
...
@@ -44,7 +44,6 @@ typedef struct SRSmaInfoItem SRSmaInfoItem;
typedef
struct
SRSmaFS
SRSmaFS
;
typedef
struct
SQTaskFile
SQTaskFile
;
typedef
struct
SQTaskFReader
SQTaskFReader
;
typedef
struct
SQTaskFWriter
SQTaskFWriter
;
struct
SSmaEnv
{
SRWLatch
lock
;
...
...
@@ -94,15 +93,11 @@ struct SQTaskFile {
struct
SQTaskFReader
{
SSma
*
pSma
;
int8_t
level
;
int64_t
suid
;
int64_t
version
;
TdFilePtr
pReadH
;
};
struct
SQTaskFWriter
{
SSma
*
pSma
;
int64_t
version
;
TdFilePtr
pWriteH
;
char
*
fname
;
};
struct
SRSmaFS
{
SArray
*
aQTaskInf
;
// array of SQTaskFile
...
...
@@ -221,11 +216,11 @@ void tdRSmaFSClose(SRSmaFS *fs);
int32_t
tdRSmaFSPrepareCommit
(
SSma
*
pSma
,
SRSmaFS
*
pFSNew
);
int32_t
tdRSmaFSCommit
(
SSma
*
pSma
);
int32_t
tdRSmaFSFinishCommit
(
SSma
*
pSma
);
int32_t
tdRSmaFSCopy
(
SSma
*
pSma
,
SRSmaFS
*
pFS
Out
);
int32_t
tdRSmaFSTakeSnapshot
(
SSma
*
pSma
,
SRSmaFS
*
pFS
Out
);
int32_t
tdRSmaFSRef
(
SSma
*
pSma
,
SRSma
Stat
*
pStat
,
int64_t
suid
,
int8_t
level
,
int64_t
version
);
void
tdRSmaFSUnRef
(
SSma
*
pSma
,
SRSma
Stat
*
pStat
,
int64_t
suid
,
int8_t
level
,
int64_t
version
);
int32_t
tdRSmaFSUpsertQTaskFile
(
S
RSmaFS
*
pFS
,
SQTaskFile
*
qTaskFile
,
int32_t
s
ize
);
int32_t
tdRSmaFSCopy
(
SSma
*
pSma
,
SRSmaFS
*
pFS
);
int32_t
tdRSmaFSTakeSnapshot
(
SSma
*
pSma
,
SRSmaFS
*
pFS
);
int32_t
tdRSmaFSRef
(
SSma
*
pSma
,
SRSma
FS
*
pFS
);
void
tdRSmaFSUnRef
(
SSma
*
pSma
,
SRSma
FS
*
pFS
);
int32_t
tdRSmaFSUpsertQTaskFile
(
S
Sma
*
pSma
,
SRSmaFS
*
pFS
,
SQTaskFile
*
qTaskFile
,
int32_t
nS
ize
);
int32_t
tdRSmaFSRollback
(
SSma
*
pSma
);
int32_t
tdRSmaRestore
(
SSma
*
pSma
,
int8_t
type
,
int64_t
committedVer
,
int8_t
rollback
);
int32_t
tdRSmaProcessCreateImpl
(
SSma
*
pSma
,
SRSmaParam
*
param
,
int64_t
suid
,
const
char
*
tbName
);
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
73710da5
...
...
@@ -271,6 +271,7 @@ int32_t rsmaSnapRead(SRSmaSnapReader* pReader, uint8_t** ppData);
// SRSmaSnapWriter ========================================
int32_t
rsmaSnapWriterOpen
(
SSma
*
pSma
,
int64_t
sver
,
int64_t
ever
,
SRSmaSnapWriter
**
ppWriter
);
int32_t
rsmaSnapWrite
(
SRSmaSnapWriter
*
pWriter
,
uint8_t
*
pData
,
uint32_t
nData
);
int32_t
rsmaSnapWriterPrepareClose
(
SRSmaSnapWriter
*
pWriter
);
int32_t
rsmaSnapWriterClose
(
SRSmaSnapWriter
**
ppWriter
,
int8_t
rollback
);
typedef
struct
{
...
...
@@ -414,6 +415,7 @@ enum {
struct
SSnapDataHdr
{
int8_t
type
;
int8_t
flag
;
int64_t
index
;
int64_t
size
;
uint8_t
data
[];
...
...
source/dnode/vnode/src/sma/smaFS.c
浏览文件 @
73710da5
...
...
@@ -588,10 +588,10 @@ _exit:
return
code
;
}
int32_t
tdRSmaFSUpsertQTaskFile
(
S
RSmaFS
*
pFS
,
SQTaskFile
*
qTaskFile
,
int32_t
s
ize
)
{
int32_t
tdRSmaFSUpsertQTaskFile
(
S
Sma
*
pSma
,
SRSmaFS
*
pFS
,
SQTaskFile
*
qTaskFile
,
int32_t
nS
ize
)
{
int32_t
code
=
0
;
for
(
int32_t
i
=
0
;
i
<
s
ize
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
nS
ize
;
++
i
)
{
SQTaskFile
*
qTaskF
=
qTaskFile
+
i
;
int32_t
idx
=
taosArraySearchIdx
(
pFS
->
aQTaskInf
,
qTaskF
,
tdQTaskInfCmprFn1
,
TD_GE
);
...
...
@@ -602,7 +602,14 @@ int32_t tdRSmaFSUpsertQTaskFile(SRSmaFS *pFS, SQTaskFile *qTaskFile, int32_t siz
SQTaskFile
*
pTaskF
=
(
SQTaskFile
*
)
taosArrayGet
(
pFS
->
aQTaskInf
,
idx
);
int32_t
c
=
tdQTaskInfCmprFn1
(
pTaskF
,
qTaskF
);
if
(
c
==
0
)
{
ASSERT
(
0
);
if
(
pTaskF
->
size
!=
qTaskF
->
size
)
{
code
=
TSDB_CODE_RSMA_FS_UPDATE
;
smaError
(
"vgId:%d, %s failed at line %d since %s, level:%"
PRIi8
", suid:%"
PRIi64
", version:%"
PRIi64
", size:%"
PRIi64
" != %"
PRIi64
,
SMA_VID
(
pSma
),
__func__
,
__LINE__
,
tstrerror
(
code
),
pTaskF
->
level
,
pTaskF
->
suid
,
pTaskF
->
version
,
pTaskF
->
size
,
qTaskF
->
size
);
goto
_exit
;
}
continue
;
}
}
...
...
@@ -616,7 +623,7 @@ int32_t tdRSmaFSUpsertQTaskFile(SRSmaFS *pFS, SQTaskFile *qTaskFile, int32_t siz
_exit:
return
code
;
}
#if 0
int32_t tdRSmaFSRef(SSma *pSma, SRSmaStat *pStat, int64_t suid, int8_t level, int64_t version) {
SArray *aQTaskInf = RSMA_FS(pStat)->aQTaskInf;
SQTaskFile qTaskF = {.level = level, .suid = suid, .version = version};
...
...
@@ -696,38 +703,101 @@ void tdRSmaFSUnRef(SSma *pSma, SRSmaStat *pStat, int64_t suid, int8_t level, int
taosWUnLockLatch(RSMA_FS_LOCK(pStat));
}
#endif
int32_t
tdRSmaFSRef
(
SSma
*
pSma
,
SRSmaFS
*
pFS
)
{
int32_t
code
=
0
;
int32_t
lino
=
0
;
int32_t
nRef
=
0
;
SSmaEnv
*
pEnv
=
SMA_RSMA_ENV
(
pSma
);
SRSmaStat
*
pStat
=
(
SRSmaStat
*
)
SMA_ENV_STAT
(
pEnv
);
SRSmaFS
*
qFS
=
RSMA_FS
(
pStat
);
int32_t
size
=
taosArrayGetSize
(
qFS
->
aQTaskInf
);
pFS
->
aQTaskInf
=
taosArrayInit
(
size
,
sizeof
(
SQTaskFile
));
if
(
pFS
->
aQTaskInf
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
SQTaskFile
*
qTaskF
=
(
SQTaskFile
*
)
taosArrayGet
(
qFS
->
aQTaskInf
,
i
);
nRef
=
atomic_fetch_add_32
(
&
qTaskF
->
nRef
,
1
);
if
(
nRef
<=
0
)
{
code
=
TSDB_CODE_RSMA_FS_REF
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
}
taosArraySetSize
(
pFS
->
aQTaskInf
,
size
);
memcpy
(
pFS
->
aQTaskInf
->
pData
,
qFS
->
aQTaskInf
->
pData
,
size
*
sizeof
(
SQTaskFile
));
_exit:
if
(
code
)
{
smaError
(
"vgId:%d, %s failed at line %d since %s, nRef %d"
,
TD_VID
(
pSma
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
),
nRef
);
}
return
code
;
}
void
tdRSmaFSUnRef
(
SSma
*
pSma
,
SRSmaFS
*
pFS
)
{
int32_t
nRef
=
0
;
char
fname
[
TSDB_FILENAME_LEN
];
SVnode
*
pVnode
=
pSma
->
pVnode
;
SSmaEnv
*
pEnv
=
SMA_RSMA_ENV
(
pSma
);
SRSmaStat
*
pStat
=
(
SRSmaStat
*
)
SMA_ENV_STAT
(
pEnv
);
int32_t
size
=
taosArrayGetSize
(
pFS
->
aQTaskInf
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
SQTaskFile
*
pTaskF
=
(
SQTaskFile
*
)
taosArrayGet
(
pFS
->
aQTaskInf
,
i
);
nRef
=
atomic_sub_fetch_32
(
&
pTaskF
->
nRef
,
1
);
if
(
nRef
==
0
)
{
tdRSmaQTaskInfoGetFullName
(
TD_VID
(
pVnode
),
pTaskF
->
suid
,
pTaskF
->
level
,
pTaskF
->
version
,
tfsGetPrimaryPath
(
pVnode
->
pTfs
),
fname
);
if
(
taosRemoveFile
(
fname
)
<
0
)
{
smaWarn
(
"vgId:%d, failed to remove %s since %s"
,
TD_VID
(
pVnode
),
fname
,
tstrerror
(
TAOS_SYSTEM_ERROR
(
errno
)));
}
else
{
smaDebug
(
"vgId:%d, success to remove %s"
,
TD_VID
(
pVnode
),
fname
);
}
}
else
if
(
nRef
<
0
)
{
smaWarn
(
"vgId:%d, abnormal unref %s since %s"
,
TD_VID
(
pVnode
),
fname
,
tstrerror
(
TSDB_CODE_RSMA_FS_REF
));
}
}
taosArrayDestroy
(
pFS
->
aQTaskInf
);
}
int32_t
tdRSmaFSTakeSnapshot
(
SSma
*
pSma
,
SRSmaFS
*
pFS
Out
)
{
int32_t
tdRSmaFSTakeSnapshot
(
SSma
*
pSma
,
SRSmaFS
*
pFS
)
{
int32_t
code
=
0
;
int32_t
lino
=
0
;
SSmaEnv
*
pEnv
=
SMA_RSMA_ENV
(
pSma
);
SRSmaStat
*
pStat
=
(
SRSmaStat
*
)
SMA_ENV_STAT
(
pEnv
);
taosRLockLatch
(
RSMA_FS_LOCK
(
pStat
));
code
=
tdRSmaFS
Copy
(
pSma
,
pFSOut
);
code
=
tdRSmaFS
Ref
(
pSma
,
pFS
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
taosRUnLockLatch
(
RSMA_FS_LOCK
(
pStat
));
_exit:
taosRUnLockLatch
(
RSMA_FS_LOCK
(
pStat
));
if
(
code
)
{
taosRUnLockLatch
(
RSMA_FS_LOCK
(
pStat
));
smaError
(
"vgId:%d, %s failed at line %d since %s"
,
TD_VID
(
pSma
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
}
return
code
;
}
int32_t
tdRSmaFSCopy
(
SSma
*
pSma
,
SRSmaFS
*
pFS
Out
)
{
int32_t
tdRSmaFSCopy
(
SSma
*
pSma
,
SRSmaFS
*
pFS
)
{
int32_t
code
=
0
;
int32_t
lino
=
0
;
SSmaEnv
*
pEnv
=
SMA_RSMA_ENV
(
pSma
);
SRSmaStat
*
pStat
=
(
SRSmaStat
*
)
SMA_ENV_STAT
(
pEnv
);
SRSmaFS
*
p
FS
=
RSMA_FS
(
pStat
);
int32_t
size
=
taosArrayGetSize
(
p
FS
->
aQTaskInf
);
SRSmaFS
*
q
FS
=
RSMA_FS
(
pStat
);
int32_t
size
=
taosArrayGetSize
(
q
FS
->
aQTaskInf
);
code
=
tdRSmaFSCreate
(
pFS
Out
,
size
);
code
=
tdRSmaFSCreate
(
pFS
,
size
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
taosArraySetSize
(
pFS
Out
->
aQTaskInf
,
size
);
memcpy
(
pFS
Out
->
aQTaskInf
->
pData
,
p
FS
->
aQTaskInf
->
pData
,
size
*
sizeof
(
SQTaskFile
));
taosArraySetSize
(
pFS
->
aQTaskInf
,
size
);
memcpy
(
pFS
->
aQTaskInf
->
pData
,
q
FS
->
aQTaskInf
->
pData
,
size
*
sizeof
(
SQTaskFile
));
_exit:
if
(
code
)
{
...
...
source/dnode/vnode/src/sma/smaOpen.c
浏览文件 @
73710da5
...
...
@@ -121,8 +121,6 @@ int smaSetKeepCfg(SVnode *pVnode, STsdbKeepCfg *pKeepCfg, STsdbCfg *pCfg, int ty
int32_t
smaOpen
(
SVnode
*
pVnode
,
int8_t
rollback
)
{
STsdbCfg
*
pCfg
=
&
pVnode
->
config
.
tsdbCfg
;
ASSERT
(
!
pVnode
->
pSma
);
SSma
*
pSma
=
taosMemoryCalloc
(
1
,
sizeof
(
SSma
));
if
(
!
pSma
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -137,7 +135,7 @@ int32_t smaOpen(SVnode *pVnode, int8_t rollback) {
if
(
VND_IS_RSMA
(
pVnode
))
{
STsdbKeepCfg
keepCfg
=
{
0
};
for
(
int
i
=
0
;
i
<
TSDB_RETENTION_MAX
;
++
i
)
{
for
(
int
32_t
i
=
0
;
i
<
TSDB_RETENTION_MAX
;
++
i
)
{
if
(
i
==
TSDB_RETENTION_L0
)
{
SMA_OPEN_RSMA_IMPL
(
pVnode
,
0
);
}
else
if
(
i
==
TSDB_RETENTION_L1
)
{
...
...
@@ -145,7 +143,9 @@ int32_t smaOpen(SVnode *pVnode, int8_t rollback) {
}
else
if
(
i
==
TSDB_RETENTION_L2
)
{
SMA_OPEN_RSMA_IMPL
(
pVnode
,
2
);
}
else
{
ASSERT
(
0
);
terrno
=
TSDB_CODE_APP_ERROR
;
smaError
(
"vgId:%d, sma open failed since %s, level:%d"
,
TD_VID
(
pVnode
),
terrstr
(),
i
);
goto
_err
;
}
}
...
...
@@ -182,7 +182,10 @@ int32_t smaClose(SSma *pSma) {
* @return int32_t
*/
int32_t
tdRSmaRestore
(
SSma
*
pSma
,
int8_t
type
,
int64_t
committedVer
,
int8_t
rollback
)
{
ASSERT
(
VND_IS_RSMA
(
pSma
->
pVnode
));
if
(
!
VND_IS_RSMA
(
pSma
->
pVnode
))
{
terrno
=
TSDB_CODE_RSMA_INVALID_ENV
;
return
TSDB_CODE_FAILED
;
}
return
tdRSmaProcessRestoreImpl
(
pSma
,
type
,
committedVer
,
rollback
);
}
source/dnode/vnode/src/sma/smaRollup.c
浏览文件 @
73710da5
...
...
@@ -1272,10 +1272,10 @@ int32_t tdRSmaPersistExecImpl(SRSmaStat *pRSmaStat, SHashObj *pInfoHash) {
}
// prepare
code
=
tdRSmaFS
TakeSnapshot
(
pSma
,
&
fs
);
code
=
tdRSmaFS
Copy
(
pSma
,
&
fs
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
code
=
tdRSmaFSUpsertQTaskFile
(
&
fs
,
qTaskFArray
->
pData
,
taosArrayGetSize
(
qTaskFArray
));
code
=
tdRSmaFSUpsertQTaskFile
(
pSma
,
&
fs
,
qTaskFArray
->
pData
,
taosArrayGetSize
(
qTaskFArray
));
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
code
=
tdRSmaFSPrepareCommit
(
pSma
,
&
fs
);
...
...
source/dnode/vnode/src/sma/smaSnapshot.c
浏览文件 @
73710da5
此差异已折叠。
点击以展开。
source/dnode/vnode/src/sma/smaTimeRange.c
浏览文件 @
73710da5
...
...
@@ -111,35 +111,48 @@ _err:
* @return int32_t
*/
static
int32_t
tdProcessTSmaCreateImpl
(
SSma
*
pSma
,
int64_t
version
,
const
char
*
pMsg
)
{
SSmaCfg
*
pCfg
=
(
SSmaCfg
*
)
pMsg
;
int32_t
code
=
0
;
int32_t
lino
=
0
;
SSmaCfg
*
pCfg
=
(
SSmaCfg
*
)
pMsg
;
SVCreateStbReq
pReq
=
{
0
};
if
(
TD_VID
(
pSma
->
pVnode
)
==
pCfg
->
dstVgId
)
{
// create tsma meta in dstVgId
if
(
metaCreateTSma
(
SMA_META
(
pSma
),
version
,
pCfg
)
<
0
)
{
return
-
1
;
code
=
terrno
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
// create stable to save tsma result in dstVgId
SName
stbFullName
=
{
0
};
tNameFromString
(
&
stbFullName
,
pCfg
->
dstTbName
,
T_NAME_ACCT
|
T_NAME_DB
|
T_NAME_TABLE
);
SVCreateStbReq
pReq
=
{
0
};
pReq
.
name
=
(
char
*
)
tNameGetTableName
(
&
stbFullName
);
pReq
.
suid
=
pCfg
->
dstTbUid
;
pReq
.
schemaRow
=
pCfg
->
schemaRow
;
pReq
.
schemaTag
=
pCfg
->
schemaTag
;
if
(
metaCreateSTable
(
SMA_META
(
pSma
),
version
,
&
pReq
)
<
0
)
{
return
-
1
;
code
=
terrno
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
}
else
{
code
=
terrno
=
TSDB_CODE_TSMA_INVALID_STAT
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
_exit:
if
(
code
)
{
smaError
(
"vgId:%d, failed at line %d to create sma index %s %"
PRIi64
" on stb:%"
PRIi64
", dstSuid:%"
PRIi64
" dstTb:%s dstVg:%d"
,
SMA_VID
(
pSma
),
lino
,
pCfg
->
indexName
,
pCfg
->
indexUid
,
pCfg
->
tableUid
,
pCfg
->
dstTbUid
,
pReq
.
name
,
pCfg
->
dstVgId
);
}
else
{
smaDebug
(
"vgId:%d, success to create sma index %s %"
PRIi64
" on stb:%"
PRIi64
", dstSuid:%"
PRIi64
" dstTb:%s dstVg:%d"
,
SMA_VID
(
pSma
),
pCfg
->
indexName
,
pCfg
->
indexUid
,
pCfg
->
tableUid
,
pCfg
->
dstTbUid
,
pReq
.
name
,
pCfg
->
dstVgId
);
}
else
{
ASSERT
(
0
);
}
return
0
;
return
code
;
}
/**
...
...
@@ -174,7 +187,7 @@ static int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char
STSmaStat
*
pTsmaStat
=
NULL
;
if
(
!
pEnv
||
!
(
pStat
=
SMA_ENV_STAT
(
pEnv
)))
{
terrno
=
TSDB_CODE_TSMA_INVALID_
STAT
;
terrno
=
TSDB_CODE_TSMA_INVALID_
ENV
;
return
TSDB_CODE_FAILED
;
}
...
...
@@ -216,9 +229,14 @@ static int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char
indexUid
,
tstrerror
(
terrno
));
goto
_err
;
}
#if 0
ASSERT(!strncasecmp("td.tsma.rst.tb", pTsmaStat->pTSma->dstTbName, 14));
if (!strncasecmp("td.tsma.rst.tb", pTsmaStat->pTSma->dstTbName, 14)) {
terrno = TSDB_CODE_APP_ERROR;
smaError("vgId:%d, tsma insert for smaIndex %" PRIi64 " failed since %s, %s", SMA_VID(pSma), indexUid,
pTsmaStat->pTSma->indexUid, tstrerror(terrno), pTsmaStat->pTSma->dstTbName);
goto _err;
}
#endif
SRpcMsg
submitReqMsg
=
{
...
...
source/dnode/vnode/src/sma/smaUtil.c
浏览文件 @
73710da5
...
...
@@ -98,74 +98,6 @@ void tdRSmaGetDirName(int32_t vgId, const char *pdname, const char *dname, bool
}
}
#if 0
int32_t tdInitTFile(STFile *pTFile, const char *dname, const char *fname) {
TD_TFILE_SET_STATE(pTFile, TD_FILE_STATE_OK);
TD_TFILE_SET_CLOSED(pTFile);
memset(&(pTFile->info), 0, sizeof(pTFile->info));
pTFile->info.magic = TD_FILE_INIT_MAGIC;
char tmpName[TSDB_FILENAME_LEN * 2 + 32] = {0};
snprintf(tmpName, TSDB_FILENAME_LEN * 2 + 32, "%s%s%s", dname, TD_DIRSEP, fname);
int32_t tmpNameLen = strlen(tmpName) + 1;
pTFile->fname = taosMemoryMalloc(tmpNameLen);
if (!pTFile->fname) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return -1;
}
tstrncpy(pTFile->fname, tmpName, tmpNameLen);
return 0;
}
int32_t tdCreateTFile(STFile *pTFile, bool updateHeader, int8_t fType) {
ASSERT(pTFile->info.fsize == 0 && pTFile->info.magic == TD_FILE_INIT_MAGIC);
pTFile->pFile = taosOpenFile(TD_TFILE_FULL_NAME(pTFile), TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC);
if (pTFile->pFile == NULL) {
if (errno == ENOENT) {
// Try to create directory recursively
char *s = strdup(TD_TFILE_FULL_NAME(pTFile));
if (taosMulMkDir(taosDirName(s)) != 0) {
terrno = TAOS_SYSTEM_ERROR(errno);
taosMemoryFree(s);
return -1;
}
taosMemoryFree(s);
pTFile->pFile = taosOpenFile(TD_TFILE_FULL_NAME(pTFile), TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC);
if (pTFile->pFile == NULL) {
terrno = TAOS_SYSTEM_ERROR(errno);
return -1;
}
}
}
if (!updateHeader) {
return 0;
}
pTFile->info.fsize += TD_FILE_HEAD_SIZE;
pTFile->info.fver = 0;
if (tdUpdateTFileHeader(pTFile) < 0) {
tdCloseTFile(pTFile);
tdRemoveTFile(pTFile);
return -1;
}
return 0;
}
int32_t tdRemoveTFile(STFile *pTFile) {
if (taosRemoveFile(TD_TFILE_FULL_NAME(pTFile)) != 0) {
terrno = TAOS_SYSTEM_ERROR(errno);
return -1;
};
return 0;
}
#endif
// smaXXXUtil ================
void
*
tdAcquireSmaRef
(
int32_t
rsetId
,
int64_t
refId
)
{
void
*
pResult
=
taosAcquireRef
(
rsetId
,
refId
);
...
...
source/util/src/terror.c
浏览文件 @
73710da5
...
...
@@ -585,7 +585,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_NO_INDEX_IN_CACHE, "No tsma index in ca
TAOS_DEFINE_ERROR
(
TSDB_CODE_RSMA_INVALID_ENV
,
"Invalid rsma env"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_RSMA_INVALID_STAT
,
"Invalid rsma state"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_RSMA_QTASKINFO_CREATE
,
"Rsma qtaskinfo creation error"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_RSMA_FS_COMMIT
,
"
Invalid rsma fs commit
"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_RSMA_FS_COMMIT
,
"
Rsma fs commit error
"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_RSMA_REMOVE_EXISTS
,
"Rsma remove exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_RSMA_FETCH_MSG_MSSED_UP
,
"Rsma fetch msg is messed up"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_RSMA_EMPTY_INFO
,
"Rsma info is empty"
)
...
...
@@ -593,6 +593,9 @@ TAOS_DEFINE_ERROR(TSDB_CODE_RSMA_INVALID_SCHEMA, "Rsma invalid schema
TAOS_DEFINE_ERROR
(
TSDB_CODE_RSMA_REGEX_MATCH
,
"Rsma regex match"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_RSMA_STREAM_STATE_OPEN
,
"Rsma stream state open"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_RSMA_STREAM_STATE_COMMIT
,
"Rsma stream state commit"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_RSMA_FS_REF
,
"Rsma fs ref error"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_RSMA_FS_SYNC
,
"Rsma fs sync error"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_RSMA_FS_UPDATE
,
"Rsma fs update error"
)
//index
TAOS_DEFINE_ERROR
(
TSDB_CODE_INDEX_REBUILDING
,
"Index is rebuilding"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录