Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
f629aee1
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看板
提交
f629aee1
编写于
3月 26, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-32] fix error in retrieve data from table created according to stable
上级
a49528de
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
48 addition
and
63 deletion
+48
-63
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+1
-1
src/client/src/tscAsync.c
src/client/src/tscAsync.c
+0
-5
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+1
-1
src/client/src/tscSchemaUtil.c
src/client/src/tscSchemaUtil.c
+13
-10
src/client/src/tscServer.c
src/client/src/tscServer.c
+22
-28
src/client/src/tscSql.c
src/client/src/tscSql.c
+1
-2
src/inc/taosmsg.h
src/inc/taosmsg.h
+9
-16
src/mnode/src/mgmtChildTable.c
src/mnode/src/mgmtChildTable.c
+1
-0
未找到文件。
src/client/inc/tscUtil.h
浏览文件 @
f629aee1
...
...
@@ -32,7 +32,7 @@ extern "C" {
#define UTIL_TABLE_IS_SUPERTABLE(metaInfo) \
(((metaInfo)->pTableMeta != NULL) && ((metaInfo)->pTableMeta->tableType == TSDB_SUPER_TABLE))
#define UTIL_TABLE_IS_NOMRAL_TABLE(metaInfo) (!(UTIL_TABLE_IS_SUPERTABLE(metaInfo)))
#define UTIL_TABLE_
CREATE_FROM_S
TABLE(metaInfo) \
#define UTIL_TABLE_
IS_CHILD_
TABLE(metaInfo) \
(((metaInfo)->pTableMeta != NULL) && ((metaInfo)->pTableMeta->tableType == TSDB_CHILD_TABLE))
#define TSDB_COL_IS_TAG(f) (((f)&TSDB_COL_TAG) != 0)
...
...
src/client/src/tscAsync.c
浏览文件 @
f629aee1
...
...
@@ -406,11 +406,6 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
if
(
pSql
->
fp
==
NULL
)
{
tscError
(
"%p callBack is NULL!!!"
,
pSql
);
return
;
}
if
(
pSql
->
fp
==
(
void
*
)
1
)
{
pSql
->
fp
=
NULL
;
...
...
src/client/src/tscSQLParser.c
浏览文件 @
f629aee1
...
...
@@ -4240,7 +4240,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
}
else
if
((
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_UPDATE_TAG_VAL
)
&&
(
UTIL_TABLE_IS_SUPERTABLE
(
pTableMetaInfo
)))
{
return
invalidSqlErrMsg
(
pQueryInfo
->
msg
,
msg4
);
}
else
if
((
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_ADD_COLUMN
||
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_DROP_COLUMN
)
&&
UTIL_TABLE_
CREATE_FROM_S
TABLE
(
pTableMetaInfo
))
{
UTIL_TABLE_
IS_CHILD_
TABLE
(
pTableMetaInfo
))
{
return
invalidSqlErrMsg
(
pQueryInfo
->
msg
,
msg6
);
}
...
...
src/client/src/tscSchemaUtil.c
浏览文件 @
f629aee1
...
...
@@ -51,12 +51,12 @@ int32_t tscGetNumOfColumns(const STableMeta* pTableMeta) {
SSchema
*
tscGetTableSchema
(
const
STableMeta
*
pTableMeta
)
{
assert
(
pTableMeta
!=
NULL
);
if
(
pTableMeta
->
tableType
==
TSDB_CHILD_TABLE
)
{
STableMeta
*
pSTableMeta
=
pTableMeta
->
pSTable
;
assert
(
pSTableMeta
!=
NULL
);
return
pSTableMeta
->
schema
;
}
//
if (pTableMeta->tableType == TSDB_CHILD_TABLE) {
//
STableMeta* pSTableMeta = pTableMeta->pSTable;
//
assert (pSTableMeta != NULL);
//
//
return pSTableMeta->schema;
//
}
return
(
SSchema
*
)
pTableMeta
->
schema
;
}
...
...
@@ -72,12 +72,14 @@ SSchema* tscGetTableTagSchema(const STableMeta* pTableMeta) {
STableComInfo
tscGetTableInfo
(
const
STableMeta
*
pTableMeta
)
{
assert
(
pTableMeta
!=
NULL
);
#if 0
if (pTableMeta->tableType == TSDB_CHILD_TABLE) {
assert (pTableMeta->pSTable != NULL);
return pTableMeta->pSTable->tableInfo;
}
#endif
return
pTableMeta
->
tableInfo
;
}
...
...
@@ -130,12 +132,13 @@ SSchema* tscGetTableColumnSchema(const STableMeta* pTableMeta, int32_t startCol)
assert
(
pTableMeta
!=
NULL
);
SSchema
*
pSchema
=
pTableMeta
->
schema
;
#if 0
if (pTableMeta->tableType == TSDB_CHILD_TABLE) {
assert (pTableMeta->pSTable != NULL);
pSchema = pTableMeta->pSTable->schema;
}
#endif
return
&
pSchema
[
startCol
];
}
...
...
src/client/src/tscServer.c
浏览文件 @
f629aee1
...
...
@@ -325,8 +325,9 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg) {
rpcMsg
->
code
=
(
*
tscProcessMsgRsp
[
pCmd
->
command
])(
pSql
);
if
(
rpcMsg
->
code
!=
TSDB_CODE_ACTION_IN_PROGRESS
)
{
int
command
=
pCmd
->
command
;
void
*
taosres
=
tscKeepConn
[
command
]
?
pSql
:
NULL
;
void
*
taosres
=
tscKeepConn
[
pCmd
->
command
]
?
pSql
:
NULL
;
rpcMsg
->
code
=
pRes
->
code
?
-
pRes
->
code
:
pRes
->
numOfRows
;
tscTrace
(
"%p Async SQL result:%s res:%p"
,
pSql
,
tstrerror
(
pRes
->
code
),
taosres
);
/*
...
...
@@ -1817,14 +1818,13 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
pMetaMsg
->
vgId
=
htonl
(
pMetaMsg
->
vgId
);
pMetaMsg
->
uid
=
htobe64
(
pMetaMsg
->
uid
);
pMetaMsg
->
contLen
=
htons
(
pMetaMsg
->
contLen
);
pMetaMsg
->
numOfColumns
=
htons
(
pMetaMsg
->
numOfColumns
);
if
(
pMetaMsg
->
sid
<
0
||
pMetaMsg
->
vgId
<
0
)
{
tscError
(
"invalid meter vgId:%d, sid%d"
,
pMetaMsg
->
vgId
,
pMetaMsg
->
sid
);
return
TSDB_CODE_INVALID_VALUE
;
}
pMetaMsg
->
numOfColumns
=
htons
(
pMetaMsg
->
numOfColumns
);
if
(
pMetaMsg
->
numOfTags
>
TSDB_MAX_TAGS
||
pMetaMsg
->
numOfTags
<
0
)
{
tscError
(
"invalid numOfTags:%d"
,
pMetaMsg
->
numOfTags
);
return
TSDB_CODE_INVALID_VALUE
;
...
...
@@ -1848,23 +1848,20 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
pSchema
++
;
}
// rsp += numOfTotalCols * sizeof(SSchema);
//
// int32_t tagLen = 0;
// SSchema *pTagsSchema = tscGetTableTagSchema(pMetaMsg);
//
// if (pMetaMsg->tableType == TSDB_CHILD_TABLE) {
// for (int32_t i = 0; i < pMetaMsg->numOfTags; ++i) {
// tagLen += pTagsSchema[i].bytes;
// }
// }
//
// rsp += tagLen;
// int32_t size = (int32_t)(rsp - (char *)pMetaMsg);
size_t
size
=
0
;
STableMeta
*
pTableMeta
=
tscCreateTableMetaFromMsg
(
pMetaMsg
,
&
size
);
#if 0
// if current table is created according to super table, get the table meta of super table
if (pTableMeta->tableType == TSDB_CHILD_TABLE) {
char id[TSDB_TABLE_ID_LEN + 1] = {0};
strncpy(id, pMetaMsg->stableId, TSDB_TABLE_ID_LEN);
// NOTE: if the table meta of super table is not cached at client side yet, the pSTable is NULL
pTableMeta->pSTable = taosCacheAcquireByName(tscCacheHandle, id);
}
#endif
// todo add one more function: taosAddDataIfNotExists();
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
&
pSql
->
cmd
,
0
,
0
);
assert
(
pTableMetaInfo
->
pTableMeta
==
NULL
);
...
...
@@ -1878,6 +1875,7 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
}
free
(
pTableMeta
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -2343,7 +2341,7 @@ int tscProcessRetrieveRspFromLocal(SSqlObj *pSql) {
void
tscTableMetaCallBack
(
void
*
param
,
TAOS_RES
*
res
,
int
code
);
static
int32_t
doGetMeterMetaFromServer
(
SSqlObj
*
pSql
,
STableMetaInfo
*
pTableMetaInfo
)
{
static
int32_t
getTableMetaFromMgmt
(
SSqlObj
*
pSql
,
STableMetaInfo
*
pTableMetaInfo
)
{
SSqlObj
*
pNew
=
calloc
(
1
,
sizeof
(
SSqlObj
));
if
(
NULL
==
pNew
)
{
tscError
(
"%p malloc failed for new sqlobj to get meter meta"
,
pSql
);
...
...
@@ -2370,7 +2368,7 @@ static int32_t doGetMeterMetaFromServer(SSqlObj *pSql, STableMetaInfo *pTableMet
STableMetaInfo
*
pNewMeterMetaInfo
=
tscAddEmptyMetaInfo
(
pNewQueryInfo
);
assert
(
pNew
->
cmd
.
numOfClause
==
1
&&
pNewQueryInfo
->
numOfTables
==
1
);
str
cpy
(
pNewMeterMetaInfo
->
name
,
pTableMetaInfo
->
name
);
str
ncpy
(
pNewMeterMetaInfo
->
name
,
pTableMetaInfo
->
name
,
tListLen
(
pNewMeterMetaInfo
->
name
)
);
memcpy
(
pNew
->
cmd
.
payload
,
pSql
->
cmd
.
payload
,
TSDB_DEFAULT_PAYLOAD_SIZE
);
// tag information if table does not exists.
tscTrace
(
"%p new pSqlObj:%p to get tableMeta"
,
pSql
,
pNew
);
...
...
@@ -2388,7 +2386,7 @@ static int32_t doGetMeterMetaFromServer(SSqlObj *pSql, STableMetaInfo *pTableMet
int32_t
tscGetTableMeta
(
SSqlObj
*
pSql
,
STableMetaInfo
*
pTableMetaInfo
)
{
assert
(
strlen
(
pTableMetaInfo
->
name
)
!=
0
);
// If this STableMetaInfo owns a
meter
meta, release it first
// If this STableMetaInfo owns a
table
meta, release it first
if
(
pTableMetaInfo
->
pTableMeta
!=
NULL
)
{
taosCacheRelease
(
tscCacheHandle
,
(
void
**
)
&
(
pTableMetaInfo
->
pTableMeta
),
false
);
}
...
...
@@ -2401,12 +2399,8 @@ int32_t tscGetTableMeta(SSqlObj *pSql, STableMetaInfo *pTableMetaInfo) {
return
TSDB_CODE_SUCCESS
;
}
/*
* for async insert operation, release data block buffer before issue new object to get metermeta
* because in table meta callback function, the tscParse function will generate the submit data blocks
*/
return
doGetMeterMetaFromServer
(
pSql
,
pTableMetaInfo
);
return
getTableMetaFromMgmt
(
pSql
,
pTableMetaInfo
);
}
int
tscGetMeterMetaEx
(
SSqlObj
*
pSql
,
STableMetaInfo
*
pTableMetaInfo
,
bool
createIfNotExists
)
{
...
...
@@ -2455,7 +2449,7 @@ int tscRenewMeterMeta(SSqlObj *pSql, char *tableId) {
tscWaitingForCreateTable
(
pCmd
);
taosCacheRelease
(
tscCacheHandle
,
(
void
**
)
&
(
pTableMetaInfo
->
pTableMeta
),
true
);
code
=
doGetMeterMetaFromServer
(
pSql
,
pTableMetaInfo
);
// todo ??
code
=
getTableMetaFromMgmt
(
pSql
,
pTableMetaInfo
);
// todo ??
}
else
{
tscTrace
(
"%p metric query not update metric meta, numOfTags:%d, numOfCols:%d, uid:%"
PRId64
", addr:%p"
,
pSql
,
tscGetNumOfTags
(
pTableMetaInfo
->
pTableMeta
),
pCmd
->
numOfCols
,
pTableMetaInfo
->
pTableMeta
->
uid
,
...
...
src/client/src/tscSql.c
浏览文件 @
f629aee1
...
...
@@ -651,8 +651,7 @@ static void **tscBuildResFromSubqueries(SSqlObj *pSql) {
static
void
asyncFetchCallback
(
void
*
param
,
TAOS_RES
*
tres
,
int
numOfRows
)
{
SSqlObj
*
pSql
=
(
SSqlObj
*
)
tres
;
if
(
numOfRows
<
0
)
{
// set the error code
if
(
numOfRows
<
0
)
{
// set the error code
pSql
->
res
.
code
=
-
numOfRows
;
}
...
...
src/inc/taosmsg.h
浏览文件 @
f629aee1
...
...
@@ -206,14 +206,6 @@ typedef struct SMsgHead {
int32_t
vgId
;
}
SMsgHead
;
// typedef struct {
// SMsgDesc desc;
// SMsgHead header;
// int16_t import;
// int32_t numOfTables; // total number of sid
// char blks[]; // number of data blocks, each table has at least one data block
//} SShellSubmitMsg;
// Submit message for one table
typedef
struct
SSubmitBlk
{
int64_t
uid
;
// table unique id
...
...
@@ -683,14 +675,15 @@ typedef struct {
}
SSuperTableMeta
;
typedef
struct
STableMetaMsg
{
char
tableId
[
TSDB_TABLE_ID_LEN
];
// note: This field must be at the front
int32_t
contLen
;
uint8_t
numOfTags
;
uint8_t
precision
;
uint8_t
tableType
;
int16_t
numOfColumns
;
int16_t
sversion
;
int32_t
contLen
;
char
tableId
[
TSDB_TABLE_ID_LEN
];
// table id
char
stableId
[
TSDB_TABLE_ID_LEN
];
// stable name if it is created according to super table
uint8_t
numOfTags
;
uint8_t
precision
;
uint8_t
tableType
;
int16_t
numOfColumns
;
int16_t
sversion
;
int8_t
numOfVpeers
;
SVnodeDesc
vpeerDesc
[
TSDB_VNODES_SUPPORT
];
int32_t
sid
;
...
...
src/mnode/src/mgmtChildTable.c
浏览文件 @
f629aee1
...
...
@@ -728,6 +728,7 @@ static int32_t mgmtDoGetChildTableMeta(SDbObj *pDb, SChildTableObj *pTable, STab
pMeta
->
numOfTags
=
0
;
pMeta
->
numOfColumns
=
htons
((
int16_t
)
pTable
->
superTable
->
numOfColumns
);
pMeta
->
contLen
=
sizeof
(
STableMetaMsg
)
+
mgmtSetSchemaFromSuperTable
(
pMeta
->
schema
,
pTable
->
superTable
);
strncpy
(
pMeta
->
stableId
,
pTable
->
superTable
->
info
.
tableId
,
tListLen
(
pMeta
->
stableId
));
}
else
{
pMeta
->
sversion
=
htons
(
pTable
->
sversion
);
pMeta
->
numOfTags
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录