Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e4140b90
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
e4140b90
编写于
6月 17, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
差异文件
[td-225] update sim
上级
fcfb85d6
c83f9708
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
65 addition
and
67 deletion
+65
-67
src/client/src/TSDBJNIConnector.c
src/client/src/TSDBJNIConnector.c
+10
-10
src/client/src/tscAsync.c
src/client/src/tscAsync.c
+4
-4
src/client/src/tscFunctionImpl.c
src/client/src/tscFunctionImpl.c
+7
-19
src/client/src/tscLocalMerge.c
src/client/src/tscLocalMerge.c
+5
-1
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+1
-2
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+2
-4
src/mnode/src/mnodeProfile.c
src/mnode/src/mnodeProfile.c
+19
-7
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+10
-5
src/mnode/src/mnodeVgroup.c
src/mnode/src/mnodeVgroup.c
+2
-11
tests/script/general/parser/alter.sim
tests/script/general/parser/alter.sim
+1
-1
tests/script/general/parser/alter1.sim
tests/script/general/parser/alter1.sim
+4
-3
未找到文件。
src/client/src/TSDBJNIConnector.c
浏览文件 @
e4140b90
...
@@ -151,8 +151,8 @@ JNIEXPORT void JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_dumpMemoryLeakImp
...
@@ -151,8 +151,8 @@ JNIEXPORT void JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_dumpMemoryLeakImp
JNIEXPORT
void
JNICALL
Java_com_taosdata_jdbc_TSDBJNIConnector_initImp
(
JNIEnv
*
env
,
jobject
jobj
,
jstring
jconfigDir
)
{
JNIEXPORT
void
JNICALL
Java_com_taosdata_jdbc_TSDBJNIConnector_initImp
(
JNIEnv
*
env
,
jobject
jobj
,
jstring
jconfigDir
)
{
if
(
jconfigDir
!=
NULL
)
{
if
(
jconfigDir
!=
NULL
)
{
const
char
*
confDir
=
(
*
env
)
->
GetStringUTFChars
(
env
,
jconfigDir
,
NULL
);
const
char
*
confDir
=
(
*
env
)
->
GetStringUTFChars
(
env
,
jconfigDir
,
NULL
);
if
(
confDir
&&
strlen
(
conf
ig
Dir
)
!=
0
)
{
if
(
confDir
&&
strlen
(
confDir
)
!=
0
)
{
strcpy
(
configDir
,
confDir
);
tstrncpy
(
configDir
,
confDir
,
TSDB_FILENAME_LEN
);
}
}
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
jconfigDir
,
confDir
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
jconfigDir
,
confDir
);
}
}
...
@@ -385,7 +385,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getAffectedRowsIm
...
@@ -385,7 +385,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getAffectedRowsIm
}
}
jint
ret
=
taos_affected_rows
((
SSqlObj
*
)
res
);
jint
ret
=
taos_affected_rows
((
SSqlObj
*
)
res
);
jniTrace
(
"jobj:%p, conn:%p, sql:%p, affect rows:%d"
,
jobj
,
tscon
,
(
void
*
)
con
,
res
,
ret
);
jniTrace
(
"jobj:%p, conn:%p, sql:%p, affect rows:%d"
,
jobj
,
tscon
,
(
SSqlObj
*
)
res
,
ret
);
return
ret
;
return
ret
;
}
}
...
@@ -411,10 +411,10 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getSchemaMetaData
...
@@ -411,10 +411,10 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getSchemaMetaData
// jobject arrayListObj = (*env)->NewObject(env, g_arrayListClass, g_arrayListConstructFp, "");
// jobject arrayListObj = (*env)->NewObject(env, g_arrayListClass, g_arrayListConstructFp, "");
if
(
num_fields
==
0
)
{
if
(
num_fields
==
0
)
{
jniError
(
"jobj:%p, conn:%p, resultset:%p, fields size is %d"
,
jobj
,
tscon
,
res
,
num_fields
);
jniError
(
"jobj:%p, conn:%p, resultset:%p, fields size is %d"
,
jobj
,
tscon
,
(
void
*
)
res
,
num_fields
);
return
JNI_NUM_OF_FIELDS_0
;
return
JNI_NUM_OF_FIELDS_0
;
}
else
{
}
else
{
jniTrace
(
"jobj:%p, conn:%p, resultset:%p, fields size is %d"
,
jobj
,
tscon
,
res
,
num_fields
);
jniTrace
(
"jobj:%p, conn:%p, resultset:%p, fields size is %d"
,
jobj
,
tscon
,
(
void
*
)
res
,
num_fields
);
for
(
int
i
=
0
;
i
<
num_fields
;
++
i
)
{
for
(
int
i
=
0
;
i
<
num_fields
;
++
i
)
{
jobject
metadataObj
=
(
*
env
)
->
NewObject
(
env
,
g_metadataClass
,
g_metadataConstructFp
);
jobject
metadataObj
=
(
*
env
)
->
NewObject
(
env
,
g_metadataClass
,
g_metadataConstructFp
);
(
*
env
)
->
SetIntField
(
env
,
metadataObj
,
g_metadataColtypeField
,
fields
[
i
].
type
);
(
*
env
)
->
SetIntField
(
env
,
metadataObj
,
g_metadataColtypeField
,
fields
[
i
].
type
);
...
@@ -465,7 +465,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_fetchRowImp(JNIEn
...
@@ -465,7 +465,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_fetchRowImp(JNIEn
int
num_fields
=
taos_num_fields
(
result
);
int
num_fields
=
taos_num_fields
(
result
);
if
(
num_fields
==
0
)
{
if
(
num_fields
==
0
)
{
jniError
(
"jobj:%p, conn:%p, resultset:%p, fields size is %d"
,
jobj
,
tscon
,
res
,
num_fields
);
jniError
(
"jobj:%p, conn:%p, resultset:%p, fields size is %d"
,
jobj
,
tscon
,
(
void
*
)
res
,
num_fields
);
return
JNI_NUM_OF_FIELDS_0
;
return
JNI_NUM_OF_FIELDS_0
;
}
}
...
@@ -473,7 +473,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_fetchRowImp(JNIEn
...
@@ -473,7 +473,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_fetchRowImp(JNIEn
if
(
row
==
NULL
)
{
if
(
row
==
NULL
)
{
int
tserrno
=
taos_errno
(
result
);
int
tserrno
=
taos_errno
(
result
);
if
(
tserrno
==
0
)
{
if
(
tserrno
==
0
)
{
jniTrace
(
"jobj:%p, conn:%p, resultset:%p, fields size is %d, fetch row to the end"
,
jobj
,
tscon
,
res
,
num_fields
);
jniTrace
(
"jobj:%p, conn:%p, resultset:%p, fields size is %d, fetch row to the end"
,
jobj
,
tscon
,
(
void
*
)
res
,
num_fields
);
return
JNI_FETCH_END
;
return
JNI_FETCH_END
;
}
else
{
}
else
{
jniTrace
(
"jobj:%p, conn:%p, interruptted query"
,
jobj
,
tscon
);
jniTrace
(
"jobj:%p, conn:%p, interruptted query"
,
jobj
,
tscon
);
...
@@ -571,9 +571,9 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_subscribeImp(JNI
...
@@ -571,9 +571,9 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_subscribeImp(JNI
sub
=
(
jlong
)
tsub
;
sub
=
(
jlong
)
tsub
;
if
(
sub
==
0
)
{
if
(
sub
==
0
)
{
jniTrace
(
"jobj:%p, failed to subscribe: topic:%s"
,
jobj
,
j
topic
);
jniTrace
(
"jobj:%p, failed to subscribe: topic:%s"
,
jobj
,
topic
);
}
else
{
}
else
{
jniTrace
(
"jobj:%p, successfully subscribe: topic: %s"
,
jobj
,
j
topic
);
jniTrace
(
"jobj:%p, successfully subscribe: topic: %s"
,
jobj
,
topic
);
}
}
if
(
topic
!=
NULL
)
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
jtopic
,
topic
);
if
(
topic
!=
NULL
)
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
jtopic
,
topic
);
...
@@ -583,7 +583,7 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_subscribeImp(JNI
...
@@ -583,7 +583,7 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_subscribeImp(JNI
}
}
JNIEXPORT
jlong
JNICALL
Java_com_taosdata_jdbc_TSDBJNIConnector_consumeImp
(
JNIEnv
*
env
,
jobject
jobj
,
jlong
sub
)
{
JNIEXPORT
jlong
JNICALL
Java_com_taosdata_jdbc_TSDBJNIConnector_consumeImp
(
JNIEnv
*
env
,
jobject
jobj
,
jlong
sub
)
{
jniTrace
(
"jobj:%p, in TSDBJNIConnector_consumeImp, sub:%
ld"
,
jobj
,
sub
);
jniTrace
(
"jobj:%p, in TSDBJNIConnector_consumeImp, sub:%
"
PRId64
,
jobj
,
sub
);
jniGetGlobalMethod
(
env
);
jniGetGlobalMethod
(
env
);
TAOS_SUB
*
tsub
=
(
TAOS_SUB
*
)
sub
;
TAOS_SUB
*
tsub
=
(
TAOS_SUB
*
)
sub
;
...
...
src/client/src/tscAsync.c
浏览文件 @
e4140b90
...
@@ -286,7 +286,7 @@ void taos_fetch_row_a(TAOS_RES *taosa, void (*fp)(void *, TAOS_RES *, TAOS_ROW),
...
@@ -286,7 +286,7 @@ void taos_fetch_row_a(TAOS_RES *taosa, void (*fp)(void *, TAOS_RES *, TAOS_ROW),
tscProcessSql
(
pSql
);
tscProcessSql
(
pSql
);
}
else
{
}
else
{
SSchedMsg
schedMsg
;
SSchedMsg
schedMsg
=
{
0
}
;
schedMsg
.
fp
=
tscProcessFetchRow
;
schedMsg
.
fp
=
tscProcessFetchRow
;
schedMsg
.
ahandle
=
pSql
;
schedMsg
.
ahandle
=
pSql
;
schedMsg
.
thandle
=
pRes
->
tsrow
;
schedMsg
.
thandle
=
pRes
->
tsrow
;
...
@@ -388,7 +388,7 @@ void tscQueueAsyncError(void(*fp), void *param, int32_t code) {
...
@@ -388,7 +388,7 @@ void tscQueueAsyncError(void(*fp), void *param, int32_t code) {
int32_t
*
c
=
malloc
(
sizeof
(
int32_t
));
int32_t
*
c
=
malloc
(
sizeof
(
int32_t
));
*
c
=
code
;
*
c
=
code
;
SSchedMsg
schedMsg
;
SSchedMsg
schedMsg
=
{
0
}
;
schedMsg
.
fp
=
tscProcessAsyncError
;
schedMsg
.
fp
=
tscProcessAsyncError
;
schedMsg
.
ahandle
=
fp
;
schedMsg
.
ahandle
=
fp
;
schedMsg
.
thandle
=
param
;
schedMsg
.
thandle
=
param
;
...
@@ -404,7 +404,7 @@ void tscQueueAsyncRes(SSqlObj *pSql) {
...
@@ -404,7 +404,7 @@ void tscQueueAsyncRes(SSqlObj *pSql) {
tscError
(
"%p add into queued async res, code:%s"
,
pSql
,
tstrerror
(
pSql
->
res
.
code
));
tscError
(
"%p add into queued async res, code:%s"
,
pSql
,
tstrerror
(
pSql
->
res
.
code
));
}
}
SSchedMsg
schedMsg
;
SSchedMsg
schedMsg
=
{
0
}
;
schedMsg
.
fp
=
tscProcessAsyncRes
;
schedMsg
.
fp
=
tscProcessAsyncRes
;
schedMsg
.
ahandle
=
pSql
;
schedMsg
.
ahandle
=
pSql
;
schedMsg
.
thandle
=
(
void
*
)
1
;
schedMsg
.
thandle
=
(
void
*
)
1
;
...
@@ -421,7 +421,7 @@ void tscProcessAsyncFree(SSchedMsg *pMsg) {
...
@@ -421,7 +421,7 @@ void tscProcessAsyncFree(SSchedMsg *pMsg) {
void
tscQueueAsyncFreeResult
(
SSqlObj
*
pSql
)
{
void
tscQueueAsyncFreeResult
(
SSqlObj
*
pSql
)
{
tscTrace
(
"%p sqlObj put in queue to async free"
,
pSql
);
tscTrace
(
"%p sqlObj put in queue to async free"
,
pSql
);
SSchedMsg
schedMsg
;
SSchedMsg
schedMsg
=
{
0
}
;
schedMsg
.
fp
=
tscProcessAsyncFree
;
schedMsg
.
fp
=
tscProcessAsyncFree
;
schedMsg
.
ahandle
=
pSql
;
schedMsg
.
ahandle
=
pSql
;
schedMsg
.
thandle
=
(
void
*
)
1
;
schedMsg
.
thandle
=
(
void
*
)
1
;
...
...
src/client/src/tscFunctionImpl.c
浏览文件 @
e4140b90
...
@@ -1853,26 +1853,14 @@ static void last_row_function(SQLFunctionCtx *pCtx) {
...
@@ -1853,26 +1853,14 @@ static void last_row_function(SQLFunctionCtx *pCtx) {
static
void
last_row_finalizer
(
SQLFunctionCtx
*
pCtx
)
{
static
void
last_row_finalizer
(
SQLFunctionCtx
*
pCtx
)
{
// do nothing at the first stage
// do nothing at the first stage
SResultInfo
*
pResInfo
=
GET_RES_INFO
(
pCtx
);
SResultInfo
*
pResInfo
=
GET_RES_INFO
(
pCtx
);
if
(
pCtx
->
currentStage
==
SECONDARY_STAGE_MERGE
)
{
if
(
pResInfo
->
hasResult
!=
DATA_SET_FLAG
)
{
if
(
pResInfo
->
hasResult
!=
DATA_SET_FLAG
)
{
if
(
pCtx
->
outputType
==
TSDB_DATA_TYPE_BINARY
||
pCtx
->
outputType
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
pCtx
->
outputType
==
TSDB_DATA_TYPE_BINARY
||
pCtx
->
outputType
==
TSDB_DATA_TYPE_NCHAR
)
{
setVardataNull
(
pCtx
->
aOutputBuf
,
pCtx
->
outputType
);
setVardataNull
(
pCtx
->
aOutputBuf
,
pCtx
->
outputType
);
}
else
{
}
else
{
setNull
(
pCtx
->
aOutputBuf
,
pCtx
->
outputType
,
pCtx
->
outputBytes
);
setNull
(
pCtx
->
aOutputBuf
,
pCtx
->
outputType
,
pCtx
->
outputBytes
);
}
return
;
}
}
else
{
if
(
pResInfo
->
hasResult
!=
DATA_SET_FLAG
)
{
if
(
pCtx
->
outputType
==
TSDB_DATA_TYPE_BINARY
||
pCtx
->
outputType
==
TSDB_DATA_TYPE_NCHAR
)
{
setVardataNull
(
pCtx
->
aOutputBuf
,
pCtx
->
outputType
);
}
else
{
setNull
(
pCtx
->
aOutputBuf
,
pCtx
->
outputType
,
pCtx
->
outputBytes
);
}
return
;
}
}
return
;
}
}
GET_RES_INFO
(
pCtx
)
->
numOfRes
=
1
;
GET_RES_INFO
(
pCtx
)
->
numOfRes
=
1
;
...
...
src/client/src/tscLocalMerge.c
浏览文件 @
e4140b90
...
@@ -230,6 +230,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
...
@@ -230,6 +230,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
if
(
ds
==
NULL
)
{
if
(
ds
==
NULL
)
{
tscError
(
"%p failed to create merge structure"
,
pSql
);
tscError
(
"%p failed to create merge structure"
,
pSql
);
pRes
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
pRes
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
tfree
(
pReducer
);
return
;
return
;
}
}
...
@@ -266,6 +267,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
...
@@ -266,6 +267,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
// no data actually, no need to merge result.
// no data actually, no need to merge result.
if
(
idx
==
0
)
{
if
(
idx
==
0
)
{
tfree
(
pReducer
);
return
;
return
;
}
}
...
@@ -282,6 +284,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
...
@@ -282,6 +284,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
pRes
->
code
=
tLoserTreeCreate
(
&
pReducer
->
pLoserTree
,
pReducer
->
numOfBuffer
,
param
,
treeComparator
);
pRes
->
code
=
tLoserTreeCreate
(
&
pReducer
->
pLoserTree
,
pReducer
->
numOfBuffer
,
param
,
treeComparator
);
if
(
pReducer
->
pLoserTree
==
NULL
||
pRes
->
code
!=
0
)
{
if
(
pReducer
->
pLoserTree
==
NULL
||
pRes
->
code
!=
0
)
{
tfree
(
pReducer
);
return
;
return
;
}
}
...
@@ -325,7 +328,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
...
@@ -325,7 +328,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
tfree
(
pReducer
->
pResultBuf
);
tfree
(
pReducer
->
pResultBuf
);
tfree
(
pReducer
->
pFinalRes
);
tfree
(
pReducer
->
pFinalRes
);
tfree
(
pReducer
->
prevRowOfInput
);
tfree
(
pReducer
->
prevRowOfInput
);
tfree
(
pReducer
);
pRes
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
pRes
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
;
return
;
}
}
...
@@ -685,6 +688,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr
...
@@ -685,6 +688,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr
if
(
createOrderDescriptor
(
pOrderDesc
,
pCmd
,
pModel
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
createOrderDescriptor
(
pOrderDesc
,
pCmd
,
pModel
)
!=
TSDB_CODE_SUCCESS
)
{
pRes
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
pRes
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
tfree
(
pSchema
);
return
pRes
->
code
;
return
pRes
->
code
;
}
}
...
...
src/client/src/tscParseInsert.c
浏览文件 @
e4140b90
...
@@ -252,7 +252,7 @@ int32_t tsParseOneColumnData(SSchema *pSchema, SSQLToken *pToken, char *payload,
...
@@ -252,7 +252,7 @@ int32_t tsParseOneColumnData(SSchema *pSchema, SSQLToken *pToken, char *payload,
numType
=
tscToInteger
(
pToken
,
&
iv
,
&
endptr
);
numType
=
tscToInteger
(
pToken
,
&
iv
,
&
endptr
);
if
(
TK_ILLEGAL
==
numType
)
{
if
(
TK_ILLEGAL
==
numType
)
{
return
tscInvalidSQLErrMsg
(
msg
,
"invalid bigint data"
,
pToken
->
z
);
return
tscInvalidSQLErrMsg
(
msg
,
"invalid bigint data"
,
pToken
->
z
);
}
else
if
(
errno
==
ERANGE
||
iv
>
INT64_MAX
||
iv
<
=
INT64_MIN
)
{
}
else
if
(
errno
==
ERANGE
||
iv
=
=
INT64_MIN
)
{
return
tscInvalidSQLErrMsg
(
msg
,
"bigint data overflow"
,
pToken
->
z
);
return
tscInvalidSQLErrMsg
(
msg
,
"bigint data overflow"
,
pToken
->
z
);
}
}
...
@@ -594,7 +594,6 @@ int32_t tscAllocateMemIfNeed(STableDataBlocks *pDataBlock, int32_t rowSize, int3
...
@@ -594,7 +594,6 @@ int32_t tscAllocateMemIfNeed(STableDataBlocks *pDataBlock, int32_t rowSize, int3
size_t
remain
=
pDataBlock
->
nAllocSize
-
pDataBlock
->
size
;
size_t
remain
=
pDataBlock
->
nAllocSize
-
pDataBlock
->
size
;
const
int
factor
=
5
;
const
int
factor
=
5
;
uint32_t
nAllocSizeOld
=
pDataBlock
->
nAllocSize
;
uint32_t
nAllocSizeOld
=
pDataBlock
->
nAllocSize
;
assert
(
pDataBlock
->
headerSize
>=
0
);
// expand the allocated size
// expand the allocated size
if
(
remain
<
rowSize
*
factor
)
{
if
(
remain
<
rowSize
*
factor
)
{
...
...
src/client/src/tscSQLParser.c
浏览文件 @
e4140b90
...
@@ -1438,7 +1438,7 @@ static int32_t setExprInfoForFunctions(SQueryInfo* pQueryInfo, SSchema* pSchema,
...
@@ -1438,7 +1438,7 @@ static int32_t setExprInfoForFunctions(SQueryInfo* pQueryInfo, SSchema* pSchema,
}
}
if
(
aliasName
!=
NULL
)
{
if
(
aliasName
!=
NULL
)
{
strcpy
(
columnName
,
aliasName
);
tstrncpy
(
columnName
,
aliasName
,
sizeof
(
columnName
)
);
}
else
{
}
else
{
getRevisedName
(
columnName
,
functionID
,
sizeof
(
columnName
)
-
1
,
pSchema
[
pColIndex
->
columnIndex
].
name
);
getRevisedName
(
columnName
,
functionID
,
sizeof
(
columnName
)
-
1
,
pSchema
[
pColIndex
->
columnIndex
].
name
);
}
}
...
@@ -2216,7 +2216,6 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
...
@@ -2216,7 +2216,6 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
// db prefix in tagCond, show table conds in payload
// db prefix in tagCond, show table conds in payload
SSQLToken
*
pDbPrefixToken
=
&
pShowInfo
->
prefix
;
SSQLToken
*
pDbPrefixToken
=
&
pShowInfo
->
prefix
;
if
(
pDbPrefixToken
->
type
!=
0
)
{
if
(
pDbPrefixToken
->
type
!=
0
)
{
assert
(
pDbPrefixToken
->
n
>=
0
);
if
(
pDbPrefixToken
->
n
>=
TSDB_DB_NAME_LEN
)
{
// db name is too long
if
(
pDbPrefixToken
->
n
>=
TSDB_DB_NAME_LEN
)
{
// db name is too long
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
...
@@ -4718,7 +4717,7 @@ int32_t parseLimitClause(SQueryInfo* pQueryInfo, int32_t clauseIndex, SQuerySQL*
...
@@ -4718,7 +4717,7 @@ int32_t parseLimitClause(SQueryInfo* pQueryInfo, int32_t clauseIndex, SQuerySQL*
pQueryInfo
->
clauseLimit
=
pQueryInfo
->
limit
.
limit
;
pQueryInfo
->
clauseLimit
=
pQueryInfo
->
limit
.
limit
;
pQueryInfo
->
slimit
=
pQuerySql
->
slimit
;
pQueryInfo
->
slimit
=
pQuerySql
->
slimit
;
tscTrace
(
"%p limit:%
d, offset:%"
PRId64
" slimit:%d
, soffset:%"
PRId64
,
pSql
,
pQueryInfo
->
limit
.
limit
,
tscTrace
(
"%p limit:%
"
PRId64
", offset:%"
PRId64
" slimit:%"
PRId64
"
, soffset:%"
PRId64
,
pSql
,
pQueryInfo
->
limit
.
limit
,
pQueryInfo
->
limit
.
offset
,
pQueryInfo
->
slimit
.
limit
,
pQueryInfo
->
slimit
.
offset
);
pQueryInfo
->
limit
.
offset
,
pQueryInfo
->
slimit
.
limit
,
pQueryInfo
->
slimit
.
offset
);
if
(
pQueryInfo
->
slimit
.
offset
<
0
||
pQueryInfo
->
limit
.
offset
<
0
)
{
if
(
pQueryInfo
->
slimit
.
offset
<
0
||
pQueryInfo
->
limit
.
offset
<
0
)
{
...
@@ -5199,7 +5198,6 @@ static int32_t doAddGroupbyColumnsOnDemand(SQueryInfo* pQueryInfo) {
...
@@ -5199,7 +5198,6 @@ static int32_t doAddGroupbyColumnsOnDemand(SQueryInfo* pQueryInfo) {
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
groupbyExpr
.
numOfGroupCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
groupbyExpr
.
numOfGroupCols
;
++
i
)
{
SColIndex
*
pColIndex
=
taosArrayGet
(
pQueryInfo
->
groupbyExpr
.
columnInfo
,
i
);
SColIndex
*
pColIndex
=
taosArrayGet
(
pQueryInfo
->
groupbyExpr
.
columnInfo
,
i
);
int16_t
colIndex
=
pColIndex
->
colIndex
;
int16_t
colIndex
=
pColIndex
->
colIndex
;
if
(
colIndex
==
TSDB_TBNAME_COLUMN_INDEX
)
{
if
(
colIndex
==
TSDB_TBNAME_COLUMN_INDEX
)
{
type
=
s
.
type
;
type
=
s
.
type
;
...
...
src/mnode/src/mnodeProfile.c
浏览文件 @
e4140b90
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
#define CONN_KEEP_TIME (tsShellActivityTimer * 3)
#define CONN_KEEP_TIME (tsShellActivityTimer * 3)
#define CONN_CHECK_TIME (tsShellActivityTimer * 2)
#define CONN_CHECK_TIME (tsShellActivityTimer * 2)
#define QUERY_ID_SIZE 20
#define QUERY_ID_SIZE 20
#define QUERY_STREAM_SAVE_SIZE 20
extern
void
*
tsMnodeTmr
;
extern
void
*
tsMnodeTmr
;
static
SCacheObj
*
tsMnodeConnCache
=
NULL
;
static
SCacheObj
*
tsMnodeConnCache
=
NULL
;
...
@@ -264,16 +265,27 @@ static int32_t mnodeRetrieveConns(SShowObj *pShow, char *data, int32_t rows, voi
...
@@ -264,16 +265,27 @@ static int32_t mnodeRetrieveConns(SShowObj *pShow, char *data, int32_t rows, voi
// not thread safe, need optimized
// not thread safe, need optimized
int32_t
mnodeSaveQueryStreamList
(
SConnObj
*
pConn
,
SCMHeartBeatMsg
*
pHBMsg
)
{
int32_t
mnodeSaveQueryStreamList
(
SConnObj
*
pConn
,
SCMHeartBeatMsg
*
pHBMsg
)
{
pConn
->
numOfQueries
=
htonl
(
pHBMsg
->
numOfQueries
);
pConn
->
numOfQueries
=
htonl
(
pHBMsg
->
numOfQueries
);
if
(
pConn
->
numOfQueries
>
0
&&
pConn
->
numOfQueries
<
20
)
{
if
(
pConn
->
numOfQueries
>
0
)
{
pConn
->
pQueries
=
calloc
(
sizeof
(
SQueryDesc
),
pConn
->
numOfQueries
);
if
(
pConn
->
pQueries
==
NULL
)
{
memcpy
(
pConn
->
pQueries
,
pHBMsg
->
pData
,
pConn
->
numOfQueries
*
sizeof
(
SQueryDesc
));
pConn
->
pQueries
=
calloc
(
sizeof
(
SQueryDesc
),
QUERY_STREAM_SAVE_SIZE
);
}
int32_t
saveSize
=
MIN
(
QUERY_STREAM_SAVE_SIZE
,
pConn
->
numOfQueries
)
*
sizeof
(
SQueryDesc
);
if
(
saveSize
>
0
&&
pConn
->
pQueries
!=
NULL
)
{
memcpy
(
pConn
->
pQueries
,
pHBMsg
->
pData
,
saveSize
);
}
}
}
pConn
->
numOfStreams
=
htonl
(
pHBMsg
->
numOfStreams
);
pConn
->
numOfStreams
=
htonl
(
pHBMsg
->
numOfStreams
);
if
(
pConn
->
numOfStreams
>
0
&&
pConn
->
numOfStreams
<
20
)
{
if
(
pConn
->
numOfStreams
>
0
)
{
pConn
->
pStreams
=
calloc
(
sizeof
(
SStreamDesc
),
pConn
->
numOfStreams
);
if
(
pConn
->
pStreams
==
NULL
)
{
memcpy
(
pConn
->
pStreams
,
pHBMsg
->
pData
+
pConn
->
numOfQueries
*
sizeof
(
SQueryDesc
),
pConn
->
pStreams
=
calloc
(
sizeof
(
SStreamDesc
),
QUERY_STREAM_SAVE_SIZE
);
pConn
->
numOfStreams
*
sizeof
(
SStreamDesc
));
}
int32_t
saveSize
=
MIN
(
QUERY_STREAM_SAVE_SIZE
,
pConn
->
numOfStreams
)
*
sizeof
(
SStreamDesc
);
if
(
saveSize
>
0
&&
pConn
->
pStreams
!=
NULL
)
{
memcpy
(
pConn
->
pStreams
,
pHBMsg
->
pData
+
pConn
->
numOfQueries
*
sizeof
(
SQueryDesc
),
saveSize
);
}
}
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
e4140b90
...
@@ -182,14 +182,19 @@ static int32_t mnodeChildTableActionUpdate(SSdbOper *pOper) {
...
@@ -182,14 +182,19 @@ static int32_t mnodeChildTableActionUpdate(SSdbOper *pOper) {
SChildTableObj
*
pNew
=
pOper
->
pObj
;
SChildTableObj
*
pNew
=
pOper
->
pObj
;
SChildTableObj
*
pTable
=
mnodeGetChildTable
(
pNew
->
info
.
tableId
);
SChildTableObj
*
pTable
=
mnodeGetChildTable
(
pNew
->
info
.
tableId
);
if
(
pTable
!=
pNew
)
{
if
(
pTable
!=
pNew
)
{
void
*
oldTableId
=
pTable
->
info
.
tableId
;
void
*
oldTableId
=
pTable
->
info
.
tableId
;
void
*
oldSql
=
pTable
->
sql
;
void
*
oldSql
=
pTable
->
sql
;
void
*
oldSchema
=
pTable
->
schema
;
void
*
oldSchema
=
pTable
->
schema
;
void
*
oldSTable
=
pTable
->
superTable
;
int32_t
oldRefCount
=
pTable
->
refCount
;
int32_t
oldRefCount
=
pTable
->
refCount
;
memcpy
(
pTable
,
pNew
,
sizeof
(
SChildTableObj
));
memcpy
(
pTable
,
pNew
,
sizeof
(
SChildTableObj
));
pTable
->
refCount
=
oldRefCount
;
pTable
->
refCount
=
oldRefCount
;
pTable
->
sql
=
pNew
->
sql
;
pTable
->
sql
=
pNew
->
sql
;
pTable
->
schema
=
pNew
->
schema
;
pTable
->
schema
=
pNew
->
schema
;
pTable
->
superTable
=
oldSTable
;
free
(
pNew
);
free
(
pNew
);
free
(
oldSql
);
free
(
oldSql
);
free
(
oldSchema
);
free
(
oldSchema
);
...
@@ -1743,9 +1748,9 @@ static int32_t mnodeFindNormalTableColumnIndex(SChildTableObj *pTable, char *col
...
@@ -1743,9 +1748,9 @@ static int32_t mnodeFindNormalTableColumnIndex(SChildTableObj *pTable, char *col
}
}
static
int32_t
mnodeAddNormalTableColumnCb
(
SMnodeMsg
*
pMsg
,
int32_t
code
)
{
static
int32_t
mnodeAddNormalTableColumnCb
(
SMnodeMsg
*
pMsg
,
int32_t
code
)
{
S
SuperTableObj
*
pTable
=
(
SSuper
TableObj
*
)
pMsg
->
pTable
;
S
ChildTableObj
*
pTable
=
(
SChild
TableObj
*
)
pMsg
->
pTable
;
mLPrint
(
"app:%p:%p, ctable %s, add column result:%s"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pTable
->
info
.
tableId
,
mLPrint
(
"app:%p:%p, ctable %s, add column result:%s"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pTable
->
info
.
tableId
,
tstrerror
(
code
));
tstrerror
(
code
));
return
code
;
return
code
;
}
}
...
@@ -1803,7 +1808,7 @@ static int32_t mnodeAddNormalTableColumn(SMnodeMsg *pMsg, SSchema schema[], int3
...
@@ -1803,7 +1808,7 @@ static int32_t mnodeAddNormalTableColumn(SMnodeMsg *pMsg, SSchema schema[], int3
}
}
static
int32_t
mnodeDropNormalTableColumnCb
(
SMnodeMsg
*
pMsg
,
int32_t
code
)
{
static
int32_t
mnodeDropNormalTableColumnCb
(
SMnodeMsg
*
pMsg
,
int32_t
code
)
{
S
SuperTableObj
*
pTable
=
(
SSuper
TableObj
*
)
pMsg
->
pTable
;
S
ChildTableObj
*
pTable
=
(
SChild
TableObj
*
)
pMsg
->
pTable
;
mLPrint
(
"app:%p:%p, ctable %s, drop column result:%s"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pTable
->
info
.
tableId
,
mLPrint
(
"app:%p:%p, ctable %s, drop column result:%s"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pTable
->
info
.
tableId
,
tstrerror
(
code
));
tstrerror
(
code
));
return
code
;
return
code
;
...
@@ -1840,7 +1845,7 @@ static int32_t mnodeDropNormalTableColumn(SMnodeMsg *pMsg, char *colName) {
...
@@ -1840,7 +1845,7 @@ static int32_t mnodeDropNormalTableColumn(SMnodeMsg *pMsg, char *colName) {
};
};
int32_t
code
=
sdbUpdateRow
(
&
oper
);
int32_t
code
=
sdbUpdateRow
(
&
oper
);
if
(
code
!
=
TSDB_CODE_SUCCESS
)
{
if
(
code
=
=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
}
...
...
src/mnode/src/mnodeVgroup.c
浏览文件 @
e4140b90
...
@@ -149,17 +149,8 @@ static int32_t mnodeVgroupActionUpdate(SSdbOper *pOper) {
...
@@ -149,17 +149,8 @@ static int32_t mnodeVgroupActionUpdate(SSdbOper *pOper) {
}
}
}
}
void
*
idPool
=
pVgroup
->
idPool
;
memcpy
(
pVgroup
,
pNew
,
tsVgUpdateSize
);
void
*
tableList
=
pVgroup
->
tableList
;
int32_t
oldRefCount
=
pVgroup
->
refCount
;
memcpy
(
pVgroup
,
pNew
,
sizeof
(
SVgObj
));
free
(
pNew
);
pVgroup
->
refCount
=
oldRefCount
;
pVgroup
->
idPool
=
idPool
;
pVgroup
->
tableList
=
tableList
;
for
(
int32_t
i
=
0
;
i
<
pVgroup
->
numOfVnodes
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pVgroup
->
numOfVnodes
;
++
i
)
{
SDnodeObj
*
pDnode
=
mnodeGetDnode
(
pVgroup
->
vnodeGid
[
i
].
dnodeId
);
SDnodeObj
*
pDnode
=
mnodeGetDnode
(
pVgroup
->
vnodeGid
[
i
].
dnodeId
);
pVgroup
->
vnodeGid
[
i
].
pDnode
=
pDnode
;
pVgroup
->
vnodeGid
[
i
].
pDnode
=
pDnode
;
...
...
tests/script/general/parser/alter.sim
浏览文件 @
e4140b90
...
@@ -135,7 +135,7 @@ endi
...
@@ -135,7 +135,7 @@ endi
sql alter table tb1 drop column c3
sql alter table tb1 drop column c3
sleep 6000
sleep 6000
sql insert into tb1 values (now, 2, 'taos')
sql insert into tb1 values (now, 2, 'taos')
sleep 3000
sleep 3000
0
sql select * from strm
sql select * from strm
if $rows != 2 then
if $rows != 2 then
return -1
return -1
...
...
tests/script/general/parser/alter1.sim
浏览文件 @
e4140b90
...
@@ -108,11 +108,12 @@ endi
...
@@ -108,11 +108,12 @@ endi
print ================== change a tag value
print ================== change a tag value
sql alter table car1 set tag carid=10
sql alter table car1 set tag carid=10
sql
describe
car1
sql
select carId, carmodel from
car1
if $rows !=
7
then
if $rows !=
1
then
return -1
return -1
endi
endi
if $data43 != 10 then
if $data00 != 10 then
return -1
return -1
endi
endi
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录