Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
92a9613e
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看板
提交
92a9613e
编写于
12月 06, 2019
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TBASE-1284]
上级
a425bb51
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
57 addition
and
9 deletion
+57
-9
src/sdb/src/sdbEngine.c
src/sdb/src/sdbEngine.c
+23
-6
src/system/detail/src/mgmtMeter.c
src/system/detail/src/mgmtMeter.c
+34
-3
未找到文件。
src/sdb/src/sdbEngine.c
浏览文件 @
92a9613e
...
...
@@ -21,6 +21,10 @@
#define abs(x) (((x) < 0) ? -(x) : (x))
#ifndef max
#define max(a, b) ((a) > (b) ? (a) : (b))
#endif
extern
char
version
[];
const
int16_t
sdbFileVersion
=
0
;
int
sdbExtConns
=
0
;
...
...
@@ -171,6 +175,7 @@ int sdbInitTableByFile(SSdbTable *pTable) {
void
*
pMetaRow
=
NULL
;
int
total_size
=
0
;
int
real_size
=
0
;
int
maxAutoIndex
=
0
;
oldId
=
pTable
->
id
;
if
(
sdbOpenSdbFile
(
pTable
)
<
0
)
return
-
1
;
...
...
@@ -240,10 +245,18 @@ int sdbInitTableByFile(SSdbTable *pTable) {
rowMeta
.
rowSize
=
rowHead
->
rowSize
;
rowMeta
.
row
=
(
*
(
pTable
->
appTool
))(
SDB_TYPE_DECODE
,
NULL
,
rowHead
->
data
,
rowHead
->
rowSize
,
NULL
);
(
*
sdbAddIndexFp
[
pTable
->
keyType
])(
pTable
->
iHandle
,
rowMeta
.
row
,
&
rowMeta
);
if
(
pTable
->
keyType
==
SDB_KEYTYPE_AUTO
)
pTable
->
autoIndex
++
;
if
(
pTable
->
keyType
==
SDB_KEYTYPE_AUTO
)
{
pTable
->
autoIndex
++
;
maxAutoIndex
=
max
(
maxAutoIndex
,
*
(
int32_t
*
)
rowHead
->
data
);
}
pTable
->
numOfRows
++
;
}
}
else
{
// already exists
if
(
pTable
->
keyType
==
SDB_KEYTYPE_AUTO
)
{
pTable
->
autoIndex
++
;
maxAutoIndex
=
max
(
maxAutoIndex
,
*
(
int32_t
*
)
rowHead
->
data
);
}
if
(
rowHead
->
id
<
0
)
{
// Delete the object
(
*
sdbDeleteIndexFp
[
pTable
->
keyType
])(
pTable
->
iHandle
,
rowHead
->
data
);
(
*
(
pTable
->
appTool
))(
SDB_TYPE_DESTROY
,
pMetaRow
,
NULL
,
0
,
NULL
);
...
...
@@ -260,6 +273,10 @@ int sdbInitTableByFile(SSdbTable *pTable) {
if
(
pTable
->
id
<
abs
(
rowHead
->
id
))
pTable
->
id
=
abs
(
rowHead
->
id
);
}
if
(
pTable
->
keyType
==
SDB_KEYTYPE_AUTO
)
{
pTable
->
autoIndex
=
maxAutoIndex
;
}
sdbVersion
+=
(
pTable
->
id
-
oldId
);
if
(
numOfDels
>
pTable
->
maxRows
/
4
)
sdbSaveSnapShot
(
pTable
);
...
...
@@ -372,10 +389,10 @@ int64_t sdbInsertRow(void *handle, void *row, int rowSize) {
sdbError
(
"table:%s, failed to insert record:%s sdbVersion:%ld id:%d"
,
pTable
->
name
,
taosIpStr
(
*
(
int32_t
*
)
row
),
sdbVersion
,
pTable
->
id
);
break
;
case
SDB_KEYTYPE_AUTO
:
sdbError
(
"table:%s, failed to insert record:%
s
sdbVersion:%ld id:%d"
,
pTable
->
name
,
*
(
int32_t
*
)
row
,
sdbVersion
,
pTable
->
id
);
sdbError
(
"table:%s, failed to insert record:%
d
sdbVersion:%ld id:%d"
,
pTable
->
name
,
*
(
int32_t
*
)
row
,
sdbVersion
,
pTable
->
id
);
break
;
default:
sdbError
(
"table:%s, failed to insert record
:%s
sdbVersion:%ld id:%d"
,
pTable
->
name
,
sdbVersion
,
pTable
->
id
);
sdbError
(
"table:%s, failed to insert record sdbVersion:%ld id:%d"
,
pTable
->
name
,
sdbVersion
,
pTable
->
id
);
break
;
}
return
-
1
;
...
...
@@ -593,15 +610,15 @@ int sdbUpdateRow(void *handle, void *row, int updateSize, char isUpdated) {
pTable
->
name
,
(
char
*
)
row
,
sdbVersion
,
pTable
->
id
);
break
;
case
SDB_KEYTYPE_UINT32
:
//dnodes or mnodes
sdbError
(
"table:%s, failed to update record:%s record is not there, sdbVersion:%ld id:%d"
,
sdbError
(
"table:%s, failed to update record:%s
,
record is not there, sdbVersion:%ld id:%d"
,
pTable
->
name
,
taosIpStr
(
*
(
int32_t
*
)
row
),
sdbVersion
,
pTable
->
id
);
break
;
case
SDB_KEYTYPE_AUTO
:
sdbError
(
"table:%s, failed to update record:
F%s
record is not there, sdbVersion:%ld id:%d"
,
sdbError
(
"table:%s, failed to update record:
%d,
record is not there, sdbVersion:%ld id:%d"
,
pTable
->
name
,
*
(
int32_t
*
)
row
,
sdbVersion
,
pTable
->
id
);
break
;
default:
sdbError
(
"table:%s, failed to update record
:%s
record is not there, sdbVersion:%ld id:%d"
,
sdbError
(
"table:%s, failed to update record
,
record is not there, sdbVersion:%ld id:%d"
,
pTable
->
name
,
sdbVersion
,
pTable
->
id
);
break
;
}
...
...
src/system/detail/src/mgmtMeter.c
浏览文件 @
92a9613e
...
...
@@ -233,6 +233,10 @@ void *mgmtMeterActionDelete(void *row, char *str, int size, int *ssize) {
pMeter
=
(
STabObj
*
)
row
;
if
(
mgmtIsNormalMeter
(
pMeter
))
{
if
(
pMeter
->
gid
.
vgId
==
0
)
{
return
NULL
;
}
pVgroup
=
mgmtGetVgroup
(
pMeter
->
gid
.
vgId
);
if
(
pVgroup
==
NULL
)
{
mError
(
"id:%s not in vgroup:%d"
,
pMeter
->
meterId
,
pMeter
->
gid
.
vgId
);
...
...
@@ -426,6 +430,7 @@ void mgmtAddMeterStatisticToAcct(STabObj *pMeter, SAcctObj *pAcct) {
int
mgmtInitMeters
()
{
void
*
pNode
=
NULL
;
void
*
pLastNode
=
NULL
;
SVgObj
*
pVgroup
=
NULL
;
STabObj
*
pMeter
=
NULL
;
STabObj
*
pMetric
=
NULL
;
...
...
@@ -451,21 +456,47 @@ int mgmtInitMeters() {
pNode
=
NULL
;
while
(
1
)
{
pLastNode
=
pNode
;
pNode
=
sdbFetchRow
(
meterSdb
,
pNode
,
(
void
**
)
&
pMeter
);
if
(
pMeter
==
NULL
)
break
;
pDb
=
mgmtGetDbByMeterId
(
pMeter
->
meterId
);
if
(
pDb
==
NULL
)
{
mError
(
"failed to get db: %s"
,
pMeter
->
meterId
);
mError
(
"meter:%s, failed to get db, discard it"
,
pMeter
->
meterId
,
pMeter
->
gid
.
vgId
,
pMeter
->
gid
.
sid
);
pMeter
->
gid
.
vgId
=
0
;
sdbDeleteRow
(
meterSdb
,
pMeter
);
pNode
=
pLastNode
;
continue
;
}
if
(
mgmtIsNormalMeter
(
pMeter
))
{
pVgroup
=
mgmtGetVgroup
(
pMeter
->
gid
.
vgId
);
if
(
pVgroup
==
NULL
||
pVgroup
->
meterList
==
NULL
)
{
mError
(
"failed to get vgroup:%i"
,
pMeter
->
gid
.
vgId
);
if
(
pVgroup
==
NULL
)
{
mError
(
"meter:%s, failed to get vgroup:%d sid:%d, discard it"
,
pMeter
->
meterId
,
pMeter
->
gid
.
vgId
,
pMeter
->
gid
.
sid
);
pMeter
->
gid
.
vgId
=
0
;
sdbDeleteRow
(
meterSdb
,
pMeter
);
pNode
=
pLastNode
;
continue
;
}
if
(
strcmp
(
pVgroup
->
dbName
,
pDb
->
name
)
!=
0
)
{
mError
(
"meter:%s, db:%s not match with vgroup:%d db:%s sid:%d, discard it"
,
pMeter
->
meterId
,
pDb
->
name
,
pMeter
->
gid
.
vgId
,
pVgroup
->
dbName
,
pMeter
->
gid
.
sid
);
pMeter
->
gid
.
vgId
=
0
;
sdbDeleteRow
(
meterSdb
,
pMeter
);
pNode
=
pLastNode
;
continue
;
}
if
(
pVgroup
->
meterList
==
NULL
)
{
mError
(
"meter:%s, vgroup:%d meterlist is null"
,
pMeter
->
meterId
,
pMeter
->
gid
.
vgId
);
pMeter
->
gid
.
vgId
=
0
;
sdbDeleteRow
(
meterSdb
,
pMeter
);
pNode
=
pLastNode
;
continue
;
}
pVgroup
->
meterList
[
pMeter
->
gid
.
sid
]
=
pMeter
;
taosIdPoolMarkStatus
(
pVgroup
->
idPool
,
pMeter
->
gid
.
sid
,
1
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录