Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d7956b6e
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1181
Star
22014
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
d7956b6e
编写于
7月 08, 2022
作者:
dengyihao
提交者:
GitHub
7月 08, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #14660 from taosdata/enh/rmIdx
enh: rm table idx
上级
c591d16e
3ed02800
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
91 addition
and
8 deletion
+91
-8
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+84
-1
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+2
-2
source/libs/transport/src/transSvr.c
source/libs/transport/src/transSvr.c
+1
-1
tests/system-test/2-query/json_tag.py
tests/system-test/2-query/json_tag.py
+4
-4
未找到文件。
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
d7956b6e
...
...
@@ -16,6 +16,7 @@
#include "meta.h"
static
int
metaSaveJsonVarToIdx
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pCtbEntry
,
const
SSchema
*
pSchema
);
static
int
metaDelJsonVarFromIdx
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pCtbEntry
,
const
SSchema
*
pSchema
);
static
int
metaHandleEntry
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pME
);
static
int
metaSaveToTbDb
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pME
);
static
int
metaUpdateUidIdx
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pME
);
...
...
@@ -92,7 +93,65 @@ static int metaSaveJsonVarToIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const
}
else
if
(
type
==
TSDB_DATA_TYPE_BOOL
)
{
int
val
=
*
(
int
*
)(
&
pTagVal
->
i64
);
int
len
=
sizeof
(
val
);
term
=
indexTermCreate
(
suid
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
key
,
nKey
,
(
const
char
*
)
&
val
,
len
);
term
=
indexTermCreate
(
suid
,
ADD_VALUE
,
TSDB_DATA_TYPE_BOOL
,
key
,
nKey
,
(
const
char
*
)
&
val
,
len
);
}
if
(
term
!=
NULL
)
{
indexMultiTermAdd
(
terms
,
term
);
}
}
indexJsonPut
(
pMeta
->
pTagIvtIdx
,
terms
,
tuid
);
indexMultiTermDestroy
(
terms
);
#endif
return
0
;
}
int
metaDelJsonVarFromIdx
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pCtbEntry
,
const
SSchema
*
pSchema
)
{
#ifdef USE_INVERTED_INDEX
if
(
pMeta
->
pTagIvtIdx
==
NULL
||
pCtbEntry
==
NULL
)
{
return
-
1
;
}
void
*
data
=
pCtbEntry
->
ctbEntry
.
pTags
;
const
char
*
tagName
=
pSchema
->
name
;
tb_uid_t
suid
=
pCtbEntry
->
ctbEntry
.
suid
;
tb_uid_t
tuid
=
pCtbEntry
->
uid
;
const
void
*
pTagData
=
pCtbEntry
->
ctbEntry
.
pTags
;
int32_t
nTagData
=
0
;
SArray
*
pTagVals
=
NULL
;
if
(
tTagToValArray
((
const
STag
*
)
data
,
&
pTagVals
)
!=
0
)
{
return
-
1
;
}
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
int16_t
nCols
=
taosArrayGetSize
(
pTagVals
);
for
(
int
i
=
0
;
i
<
nCols
;
i
++
)
{
STagVal
*
pTagVal
=
(
STagVal
*
)
taosArrayGet
(
pTagVals
,
i
);
char
type
=
pTagVal
->
type
;
char
*
key
=
pTagVal
->
pKey
;
int32_t
nKey
=
strlen
(
key
);
SIndexTerm
*
term
=
NULL
;
if
(
type
==
TSDB_DATA_TYPE_NULL
)
{
term
=
indexTermCreate
(
suid
,
DEL_VALUE
,
TSDB_DATA_TYPE_VARCHAR
,
key
,
nKey
,
NULL
,
0
);
}
else
if
(
type
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
pTagVal
->
nData
>
0
)
{
char
*
val
=
taosMemoryCalloc
(
1
,
pTagVal
->
nData
+
VARSTR_HEADER_SIZE
);
int32_t
len
=
taosUcs4ToMbs
((
TdUcs4
*
)
pTagVal
->
pData
,
pTagVal
->
nData
,
val
+
VARSTR_HEADER_SIZE
);
memcpy
(
val
,
(
uint16_t
*
)
&
len
,
VARSTR_HEADER_SIZE
);
type
=
TSDB_DATA_TYPE_VARCHAR
;
term
=
indexTermCreate
(
suid
,
DEL_VALUE
,
type
,
key
,
nKey
,
val
,
len
);
}
else
if
(
pTagVal
->
nData
==
0
)
{
term
=
indexTermCreate
(
suid
,
DEL_VALUE
,
TSDB_DATA_TYPE_VARCHAR
,
key
,
nKey
,
pTagVal
->
pData
,
0
);
}
}
else
if
(
type
==
TSDB_DATA_TYPE_DOUBLE
)
{
double
val
=
*
(
double
*
)(
&
pTagVal
->
i64
);
int
len
=
sizeof
(
val
);
term
=
indexTermCreate
(
suid
,
DEL_VALUE
,
type
,
key
,
nKey
,
(
const
char
*
)
&
val
,
len
);
}
else
if
(
type
==
TSDB_DATA_TYPE_BOOL
)
{
int
val
=
*
(
int
*
)(
&
pTagVal
->
i64
);
int
len
=
sizeof
(
val
);
term
=
indexTermCreate
(
suid
,
DEL_VALUE
,
TSDB_DATA_TYPE_BOOL
,
key
,
nKey
,
(
const
char
*
)
&
val
,
len
);
}
if
(
term
!=
NULL
)
{
indexMultiTermAdd
(
terms
,
term
);
...
...
@@ -434,9 +493,33 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) {
if
(
type
)
*
type
=
e
.
type
;
if
(
e
.
type
==
TSDB_CHILD_TABLE
)
{
void
*
tData
=
NULL
;
int
tLen
=
0
;
if
(
tdbTbGet
(
pMeta
->
pUidIdx
,
&
e
.
ctbEntry
.
suid
,
sizeof
(
tb_uid_t
),
&
tData
,
&
tLen
)
==
0
)
{
version
=
*
(
int64_t
*
)
tData
;
STbDbKey
tbDbKey
=
{.
uid
=
e
.
ctbEntry
.
suid
,
.
version
=
version
};
if
(
tdbTbGet
(
pMeta
->
pTbDb
,
&
tbDbKey
,
sizeof
(
tbDbKey
),
&
tData
,
&
tLen
)
==
0
)
{
SDecoder
tdc
=
{
0
};
SMetaEntry
stbEntry
=
{
0
};
tDecoderInit
(
&
tdc
,
tData
,
tLen
);
metaDecodeEntry
(
&
tdc
,
&
stbEntry
);
const
SSchema
*
pTagColumn
=
&
stbEntry
.
stbEntry
.
schemaTag
.
pSchema
[
0
];
if
(
pTagColumn
->
type
==
TSDB_DATA_TYPE_JSON
)
{
metaDelJsonVarFromIdx
(
pMeta
,
&
e
,
pTagColumn
);
}
tDecoderClear
(
&
tdc
);
}
tdbFree
(
tData
);
}
}
tdbTbDelete
(
pMeta
->
pTbDb
,
&
(
STbDbKey
){.
version
=
version
,
.
uid
=
uid
},
sizeof
(
STbDbKey
),
&
pMeta
->
txn
);
tdbTbDelete
(
pMeta
->
pNameIdx
,
e
.
name
,
strlen
(
e
.
name
)
+
1
,
&
pMeta
->
txn
);
tdbTbDelete
(
pMeta
->
pUidIdx
,
&
uid
,
sizeof
(
uid
),
&
pMeta
->
txn
);
if
(
e
.
type
!=
TSDB_SUPER_TABLE
)
metaDeleteTtlIdx
(
pMeta
,
&
e
);
if
(
e
.
type
==
TSDB_CHILD_TABLE
)
{
...
...
source/libs/transport/src/transCli.c
浏览文件 @
d7956b6e
...
...
@@ -573,8 +573,8 @@ static void cliRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) {
return
;
}
if
(
nread
<
0
)
{
t
Error
(
"%s conn %p read error: %s, ref: %d"
,
CONN_GET_INST_LABEL
(
conn
),
conn
,
uv_err_name
(
nread
),
T_REF_VAL_GET
(
conn
));
t
Warn
(
"%s conn %p read error: %s, ref: %d"
,
CONN_GET_INST_LABEL
(
conn
),
conn
,
uv_err_name
(
nread
),
T_REF_VAL_GET
(
conn
));
conn
->
broken
=
true
;
cliHandleExcept
(
conn
);
}
...
...
source/libs/transport/src/transSvr.c
浏览文件 @
d7956b6e
...
...
@@ -305,7 +305,7 @@ void uvOnRecvCb(uv_stream_t* cli, ssize_t nread, const uv_buf_t* buf) {
return
;
}
t
Error
(
"%s conn %p read error: %s"
,
transLabel
(
pTransInst
),
conn
,
uv_err_name
(
nread
));
t
Warn
(
"%s conn %p read error: %s"
,
transLabel
(
pTransInst
),
conn
,
uv_err_name
(
nread
));
if
(
nread
<
0
)
{
conn
->
broken
=
true
;
if
(
conn
->
status
==
ConnAcquire
)
{
...
...
tests/system-test/2-query/json_tag.py
浏览文件 @
d7956b6e
...
...
@@ -323,12 +323,12 @@ class TDTestCase:
# where json value is bool
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1'=true"
)
tdSql
.
checkRows
(
0
)
#
tdSql.query("select * from jsons1 where jtag->'tag1'=false")
#
tdSql.checkRows(1)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1'=false"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1'!=false"
)
tdSql
.
checkRows
(
0
)
#
tdSql.query("select * from jsons1 where jtag->'tag1'>false")
#
tdSql.checkRows(0)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1'>false"
)
tdSql
.
checkRows
(
0
)
# where json value is null
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1'=null"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录