Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c4b6d452
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
c4b6d452
编写于
5月 05, 2020
作者:
S
Steven Li
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/develop' into feature/crash_gen
上级
f08e9b08
65169b0a
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
101 addition
and
92 deletion
+101
-92
src/client/src/tscFunctionImpl.c
src/client/src/tscFunctionImpl.c
+18
-3
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+1
-1
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+1
-1
src/common/src/tdataformat.c
src/common/src/tdataformat.c
+1
-1
src/mnode/src/mgmtDb.c
src/mnode/src/mgmtDb.c
+3
-3
src/mnode/src/mgmtDnode.c
src/mnode/src/mgmtDnode.c
+8
-8
src/mnode/src/mgmtMnode.c
src/mnode/src/mgmtMnode.c
+1
-1
src/mnode/src/mgmtSdb.c
src/mnode/src/mgmtSdb.c
+4
-0
src/mnode/src/mgmtUser.c
src/mnode/src/mgmtUser.c
+8
-7
src/mnode/src/mgmtVgroup.c
src/mnode/src/mgmtVgroup.c
+14
-10
src/query/src/queryExecutor.c
src/query/src/queryExecutor.c
+2
-2
src/rpc/src/rpcMain.c
src/rpc/src/rpcMain.c
+8
-18
tests/script/general/user/user_create.sim
tests/script/general/user/user_create.sim
+6
-3
tests/script/unique/account/user_create.sim
tests/script/unique/account/user_create.sim
+5
-3
tests/script/unique/cluster/balance1.sim
tests/script/unique/cluster/balance1.sim
+10
-26
tests/test-all.sh
tests/test-all.sh
+10
-5
tests/tsim/src/simExe.c
tests/tsim/src/simExe.c
+1
-0
未找到文件。
src/client/src/tscFunctionImpl.c
浏览文件 @
c4b6d452
...
@@ -2965,14 +2965,28 @@ static void tag_project_function(SQLFunctionCtx *pCtx) {
...
@@ -2965,14 +2965,28 @@ static void tag_project_function(SQLFunctionCtx *pCtx) {
assert
(
pCtx
->
inputBytes
==
pCtx
->
outputBytes
);
assert
(
pCtx
->
inputBytes
==
pCtx
->
outputBytes
);
for
(
int32_t
i
=
0
;
i
<
pCtx
->
size
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pCtx
->
size
;
++
i
)
{
tVariantDump
(
&
pCtx
->
tag
,
pCtx
->
aOutputBuf
,
pCtx
->
outputType
);
char
*
output
=
pCtx
->
aOutputBuf
;
if
(
pCtx
->
tag
.
nType
==
TSDB_DATA_TYPE_BINARY
||
pCtx
->
tag
.
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
*
(
int16_t
*
)
output
=
pCtx
->
tag
.
nLen
;
output
+=
VARSTR_HEADER_SIZE
;
}
tVariantDump
(
&
pCtx
->
tag
,
output
,
pCtx
->
outputType
);
pCtx
->
aOutputBuf
+=
pCtx
->
outputBytes
;
pCtx
->
aOutputBuf
+=
pCtx
->
outputBytes
;
}
}
}
}
static
void
tag_project_function_f
(
SQLFunctionCtx
*
pCtx
,
int32_t
index
)
{
static
void
tag_project_function_f
(
SQLFunctionCtx
*
pCtx
,
int32_t
index
)
{
INC_INIT_VAL
(
pCtx
,
1
);
INC_INIT_VAL
(
pCtx
,
1
);
tVariantDump
(
&
pCtx
->
tag
,
pCtx
->
aOutputBuf
,
pCtx
->
tag
.
nType
);
char
*
output
=
pCtx
->
aOutputBuf
;
if
(
pCtx
->
tag
.
nType
==
TSDB_DATA_TYPE_BINARY
||
pCtx
->
tag
.
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
*
(
int16_t
*
)
output
=
pCtx
->
tag
.
nLen
;
output
+=
VARSTR_HEADER_SIZE
;
}
tVariantDump
(
&
pCtx
->
tag
,
output
,
pCtx
->
tag
.
nType
);
pCtx
->
aOutputBuf
+=
pCtx
->
outputBytes
;
pCtx
->
aOutputBuf
+=
pCtx
->
outputBytes
;
}
}
...
@@ -3007,7 +3021,8 @@ static void tag_function_f(SQLFunctionCtx *pCtx, int32_t index) {
...
@@ -3007,7 +3021,8 @@ static void tag_function_f(SQLFunctionCtx *pCtx, int32_t index) {
*
(
int16_t
*
)
output
=
pCtx
->
tag
.
nLen
;
*
(
int16_t
*
)
output
=
pCtx
->
tag
.
nLen
;
output
+=
VARSTR_HEADER_SIZE
;
output
+=
VARSTR_HEADER_SIZE
;
}
}
tVariantDump
(
&
pCtx
->
tag
,
pCtx
->
aOutputBuf
,
pCtx
->
tag
.
nType
);
tVariantDump
(
&
pCtx
->
tag
,
output
,
pCtx
->
tag
.
nType
);
}
}
static
void
copy_function
(
SQLFunctionCtx
*
pCtx
)
{
static
void
copy_function
(
SQLFunctionCtx
*
pCtx
)
{
...
...
src/client/src/tscSQLParser.c
浏览文件 @
c4b6d452
...
@@ -5132,7 +5132,7 @@ static int32_t doAddGroupbyColumnsOnDemand(SQueryInfo* pQueryInfo) {
...
@@ -5132,7 +5132,7 @@ static int32_t doAddGroupbyColumnsOnDemand(SQueryInfo* pQueryInfo) {
int16_t
colIndex
=
pColIndex
->
colIndex
;
int16_t
colIndex
=
pColIndex
->
colIndex
;
if
(
colIndex
==
TSDB_TBNAME_COLUMN_INDEX
)
{
if
(
colIndex
==
TSDB_TBNAME_COLUMN_INDEX
)
{
type
=
TSDB_DATA_TYPE_BINARY
;
type
=
TSDB_DATA_TYPE_BINARY
;
bytes
=
TSDB_TABLE_NAME_LEN
;
bytes
=
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
;
// todo extract method
name
=
TSQL_TBNAME_L
;
name
=
TSQL_TBNAME_L
;
}
else
{
}
else
{
if
(
TSDB_COL_IS_TAG
(
pColIndex
->
flag
))
{
if
(
TSDB_COL_IS_TAG
(
pColIndex
->
flag
))
{
...
...
src/client/src/tscUtil.c
浏览文件 @
c4b6d452
...
@@ -2134,7 +2134,7 @@ char* tscGetResultColumnChr(SSqlRes* pRes, SQueryInfo* pQueryInfo, int32_t colum
...
@@ -2134,7 +2134,7 @@ char* tscGetResultColumnChr(SSqlRes* pRes, SQueryInfo* pQueryInfo, int32_t colum
if
(
type
==
TSDB_DATA_TYPE_NCHAR
||
type
==
TSDB_DATA_TYPE_BINARY
)
{
if
(
type
==
TSDB_DATA_TYPE_NCHAR
||
type
==
TSDB_DATA_TYPE_BINARY
)
{
int32_t
realLen
=
varDataLen
(
pData
);
int32_t
realLen
=
varDataLen
(
pData
);
if
(
realLen
<
pInfo
->
pSqlExpr
->
resBytes
-
VARSTR_HEADER_SIZE
)
{
// todo refactor
if
(
realLen
<
pInfo
->
pSqlExpr
->
resBytes
-
VARSTR_HEADER_SIZE
)
{
// todo refactor
*
(
char
*
)
(
pData
+
realLen
+
sizeof
(
int16_t
)
)
=
0
;
*
(
char
*
)
(
pData
+
realLen
+
VARSTR_HEADER_SIZE
)
=
0
;
}
}
return
pData
+
VARSTR_HEADER_SIZE
;
// head is the length of binary/nchar data
return
pData
+
VARSTR_HEADER_SIZE
;
// head is the length of binary/nchar data
...
...
src/common/src/tdataformat.c
浏览文件 @
c4b6d452
...
@@ -424,8 +424,8 @@ int tdMergeDataCols(SDataCols *target, SDataCols *source, int rowsToMerge) {
...
@@ -424,8 +424,8 @@ int tdMergeDataCols(SDataCols *target, SDataCols *source, int rowsToMerge) {
dataColAppendVal
(
target
->
cols
+
j
,
tdGetColDataOfRow
(
source
->
cols
+
j
,
i
),
target
->
numOfPoints
,
dataColAppendVal
(
target
->
cols
+
j
,
tdGetColDataOfRow
(
source
->
cols
+
j
,
i
),
target
->
numOfPoints
,
target
->
maxPoints
);
target
->
maxPoints
);
}
}
target
->
numOfPoints
++
;
}
}
target
->
numOfPoints
++
;
}
else
{
}
else
{
pTarget
=
tdDupDataCols
(
target
,
true
);
pTarget
=
tdDupDataCols
(
target
,
true
);
if
(
pTarget
==
NULL
)
goto
_err
;
if
(
pTarget
==
NULL
)
goto
_err
;
...
...
src/mnode/src/mgmtDb.c
浏览文件 @
c4b6d452
...
@@ -480,7 +480,7 @@ static int32_t mgmtGetDbMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn)
...
@@ -480,7 +480,7 @@ static int32_t mgmtGetDbMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn)
}
}
#endif
#endif
pShow
->
bytes
[
cols
]
=
24
;
pShow
->
bytes
[
cols
]
=
24
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"keep1,keep2,keep(D)"
);
strcpy
(
pSchema
[
cols
].
name
,
"keep1,keep2,keep(D)"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
...
@@ -540,13 +540,13 @@ static int32_t mgmtGetDbMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn)
...
@@ -540,13 +540,13 @@ static int32_t mgmtGetDbMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn)
}
}
#endif
#endif
pShow
->
bytes
[
cols
]
=
3
;
pShow
->
bytes
[
cols
]
=
3
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"precision"
);
strcpy
(
pSchema
[
cols
].
name
,
"precision"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
10
;
pShow
->
bytes
[
cols
]
=
10
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"status"
);
strcpy
(
pSchema
[
cols
].
name
,
"status"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
...
...
src/mnode/src/mgmtDnode.c
浏览文件 @
c4b6d452
...
@@ -491,7 +491,7 @@ static int32_t mgmtGetDnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCo
...
@@ -491,7 +491,7 @@ static int32_t mgmtGetDnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCo
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
40
;
pShow
->
bytes
[
cols
]
=
40
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"end_point"
);
strcpy
(
pSchema
[
cols
].
name
,
"end_point"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
...
@@ -509,7 +509,7 @@ static int32_t mgmtGetDnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCo
...
@@ -509,7 +509,7 @@ static int32_t mgmtGetDnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCo
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
12
;
pShow
->
bytes
[
cols
]
=
12
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"status"
);
strcpy
(
pSchema
[
cols
].
name
,
"status"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
...
@@ -609,19 +609,19 @@ static int32_t mgmtGetModuleMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC
...
@@ -609,19 +609,19 @@ static int32_t mgmtGetModuleMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
40
;
pShow
->
bytes
[
cols
]
=
40
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"end point"
);
strcpy
(
pSchema
[
cols
].
name
,
"end point"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pShow
->
bytes
[
cols
]
=
8
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"module"
);
strcpy
(
pSchema
[
cols
].
name
,
"module"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pShow
->
bytes
[
cols
]
=
8
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"status"
);
strcpy
(
pSchema
[
cols
].
name
,
"status"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
...
@@ -713,13 +713,13 @@ static int32_t mgmtGetConfigMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC
...
@@ -713,13 +713,13 @@ static int32_t mgmtGetConfigMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC
SSchema
*
pSchema
=
pMeta
->
schema
;
SSchema
*
pSchema
=
pMeta
->
schema
;
pShow
->
bytes
[
cols
]
=
TSDB_CFG_OPTION_LEN
;
pShow
->
bytes
[
cols
]
=
TSDB_CFG_OPTION_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"config name"
);
strcpy
(
pSchema
[
cols
].
name
,
"config name"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_CFG_VALUE_LEN
;
pShow
->
bytes
[
cols
]
=
TSDB_CFG_VALUE_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"config value"
);
strcpy
(
pSchema
[
cols
].
name
,
"config value"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
...
@@ -806,7 +806,7 @@ static int32_t mgmtGetVnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCo
...
@@ -806,7 +806,7 @@ static int32_t mgmtGetVnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCo
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
12
;
pShow
->
bytes
[
cols
]
=
12
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"status"
);
strcpy
(
pSchema
[
cols
].
name
,
"status"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
...
...
src/mnode/src/mgmtMnode.c
浏览文件 @
c4b6d452
...
@@ -295,7 +295,7 @@ static int32_t mgmtGetMnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCo
...
@@ -295,7 +295,7 @@ static int32_t mgmtGetMnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCo
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
12
;
pShow
->
bytes
[
cols
]
=
12
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"role"
);
strcpy
(
pSchema
[
cols
].
name
,
"role"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
...
...
src/mnode/src/mgmtSdb.c
浏览文件 @
c4b6d452
...
@@ -458,6 +458,10 @@ static int sdbWrite(void *param, void *data, int type) {
...
@@ -458,6 +458,10 @@ static int sdbWrite(void *param, void *data, int type) {
// for data from WAL or forward, version may be smaller
// for data from WAL or forward, version may be smaller
if
(
pHead
->
version
<=
tsSdbObj
.
version
)
{
if
(
pHead
->
version
<=
tsSdbObj
.
version
)
{
pthread_mutex_unlock
(
&
tsSdbObj
.
mutex
);
pthread_mutex_unlock
(
&
tsSdbObj
.
mutex
);
if
(
type
==
TAOS_QTYPE_FWD
&&
tsSdbObj
.
sync
!=
NULL
)
{
sdbTrace
(
"forward request is received, version:%"
PRIu64
" confirm it"
,
pHead
->
version
);
syncConfirmForward
(
tsSdbObj
.
sync
,
pHead
->
version
,
TSDB_CODE_SUCCESS
);
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
else
if
(
pHead
->
version
!=
tsSdbObj
.
version
+
1
)
{
}
else
if
(
pHead
->
version
!=
tsSdbObj
.
version
+
1
)
{
pthread_mutex_unlock
(
&
tsSdbObj
.
mutex
);
pthread_mutex_unlock
(
&
tsSdbObj
.
mutex
);
...
...
src/mnode/src/mgmtUser.c
浏览文件 @
c4b6d452
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include "tutil.h"
#include "tutil.h"
#include "tglobal.h"
#include "tglobal.h"
#include "tgrant.h"
#include "tgrant.h"
#include "tdataformat.h"
#include "dnode.h"
#include "dnode.h"
#include "mgmtDef.h"
#include "mgmtDef.h"
#include "mgmtLog.h"
#include "mgmtLog.h"
...
@@ -256,13 +257,13 @@ static int32_t mgmtGetUserMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCon
...
@@ -256,13 +257,13 @@ static int32_t mgmtGetUserMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCon
int32_t
cols
=
0
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
schema
;
SSchema
*
pSchema
=
pMeta
->
schema
;
pShow
->
bytes
[
cols
]
=
TSDB_USER_LEN
;
pShow
->
bytes
[
cols
]
=
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"name"
);
strcpy
(
pSchema
[
cols
].
name
,
"name"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
6
;
pShow
->
bytes
[
cols
]
=
8
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"privilege"
);
strcpy
(
pSchema
[
cols
].
name
,
"privilege"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
...
@@ -270,7 +271,7 @@ static int32_t mgmtGetUserMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCon
...
@@ -270,7 +271,7 @@ static int32_t mgmtGetUserMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCon
pShow
->
bytes
[
cols
]
=
8
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create
time"
);
strcpy
(
pSchema
[
cols
].
name
,
"create
_
time"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
cols
++
;
...
@@ -303,16 +304,16 @@ static int32_t mgmtRetrieveUsers(SShowObj *pShow, char *data, int32_t rows, void
...
@@ -303,16 +304,16 @@ static int32_t mgmtRetrieveUsers(SShowObj *pShow, char *data, int32_t rows, void
cols
=
0
;
cols
=
0
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
strcpy
(
pWrite
,
pUser
->
user
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pUser
->
user
,
TSDB_USER_LEN
);
cols
++
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
if
(
pUser
->
superAuth
)
{
if
(
pUser
->
superAuth
)
{
strcpy
(
pWrite
,
"super"
);
STR_WITH_SIZE_TO_VARSTR
(
pWrite
,
"super"
,
5
);
}
else
if
(
pUser
->
writeAuth
)
{
}
else
if
(
pUser
->
writeAuth
)
{
strcpy
(
pWrite
,
"write"
);
STR_WITH_SIZE_TO_VARSTR
(
pWrite
,
"writable"
,
8
);
}
else
{
}
else
{
strcpy
(
pWrite
,
"read"
);
STR_WITH_SIZE_TO_VARSTR
(
pWrite
,
"readable"
,
8
);
}
}
cols
++
;
cols
++
;
...
...
src/mnode/src/mgmtVgroup.c
浏览文件 @
c4b6d452
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
#include "ttime.h"
#include "ttime.h"
#include "tbalance.h"
#include "tbalance.h"
#include "tglobal.h"
#include "tglobal.h"
#include "tdataformat.h"
#include "mgmtDef.h"
#include "mgmtDef.h"
#include "mgmtLog.h"
#include "mgmtLog.h"
#include "mgmtDb.h"
#include "mgmtDb.h"
...
@@ -374,9 +375,9 @@ int32_t mgmtGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) {
...
@@ -374,9 +375,9 @@ int32_t mgmtGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) {
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
9
;
pShow
->
bytes
[
cols
]
=
9
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"vgroup
status"
);
strcpy
(
pSchema
[
cols
].
name
,
"vgroup
_
status"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
cols
++
;
...
@@ -409,13 +410,13 @@ int32_t mgmtGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) {
...
@@ -409,13 +410,13 @@ int32_t mgmtGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) {
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
40
;
pShow
->
bytes
[
cols
]
=
40
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"end
point"
);
strcpy
(
pSchema
[
cols
].
name
,
"end
_
point"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
9
;
pShow
->
bytes
[
cols
]
=
9
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"vstatus"
);
strcpy
(
pSchema
[
cols
].
name
,
"vstatus"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
...
@@ -475,7 +476,8 @@ int32_t mgmtRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pCo
...
@@ -475,7 +476,8 @@ int32_t mgmtRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pCo
cols
++
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
strcpy
(
pWrite
,
pVgroup
->
status
?
"updating"
:
"ready"
);
char
*
status
=
pVgroup
->
status
?
"updating"
:
"ready"
;
STR_TO_VARSTR
(
pWrite
,
status
);
cols
++
;
cols
++
;
for
(
int32_t
i
=
0
;
i
<
maxReplica
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
maxReplica
;
++
i
)
{
...
@@ -487,18 +489,20 @@ int32_t mgmtRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pCo
...
@@ -487,18 +489,20 @@ int32_t mgmtRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pCo
if
(
pDnode
!=
NULL
)
{
if
(
pDnode
!=
NULL
)
{
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
strncpy
(
pWrite
,
pDnode
->
dnodeEp
,
pShow
->
bytes
[
cols
]
-
1
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pDnode
->
dnodeEp
,
pShow
->
bytes
[
cols
]
-
VARSTR_HEADER_SIZE
);
cols
++
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
strcpy
(
pWrite
,
mgmtGetMnodeRoleStr
(
pVgroup
->
vnodeGid
[
i
].
role
));
status
=
mgmtGetMnodeRoleStr
(
pVgroup
->
vnodeGid
[
i
].
role
);
STR_TO_VARSTR
(
pWrite
,
status
);
cols
++
;
cols
++
;
}
else
{
}
else
{
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
strcpy
(
pWrite
,
"null"
);
STR_WITH_SIZE_TO_VARSTR
(
pWrite
,
"NULL"
,
4
);
cols
++
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
strcpy
(
pWrite
,
"null"
);
STR_WITH_SIZE_TO_VARSTR
(
pWrite
,
"NULL"
,
4
);
cols
++
;
cols
++
;
}
}
}
}
...
...
src/query/src/queryExecutor.c
浏览文件 @
c4b6d452
...
@@ -1427,7 +1427,7 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int16_t order
...
@@ -1427,7 +1427,7 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int16_t order
int32_t
index
=
pSqlFuncMsg
->
colInfo
.
colIndex
;
int32_t
index
=
pSqlFuncMsg
->
colInfo
.
colIndex
;
if
(
TSDB_COL_IS_TAG
(
pIndex
->
flag
))
{
if
(
TSDB_COL_IS_TAG
(
pIndex
->
flag
))
{
if
(
pIndex
->
colId
==
TSDB_TBNAME_COLUMN_INDEX
)
{
if
(
pIndex
->
colId
==
TSDB_TBNAME_COLUMN_INDEX
)
{
pCtx
->
inputBytes
=
TSDB_TABLE_NAME_LEN
;
pCtx
->
inputBytes
=
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
;
pCtx
->
inputType
=
TSDB_DATA_TYPE_BINARY
;
pCtx
->
inputType
=
TSDB_DATA_TYPE_BINARY
;
}
else
{
}
else
{
pCtx
->
inputBytes
=
pQuery
->
tagColList
[
index
].
bytes
;
pCtx
->
inputBytes
=
pQuery
->
tagColList
[
index
].
bytes
;
...
@@ -5528,7 +5528,7 @@ static int32_t createSqlFunctionExprFromMsg(SQueryTableMsg *pQueryMsg, SExprInfo
...
@@ -5528,7 +5528,7 @@ static int32_t createSqlFunctionExprFromMsg(SQueryTableMsg *pQueryMsg, SExprInfo
bytes
=
tDataTypeDesc
[
type
].
nSize
;
bytes
=
tDataTypeDesc
[
type
].
nSize
;
}
else
if
(
pExprs
[
i
].
base
.
colInfo
.
colId
==
TSDB_TBNAME_COLUMN_INDEX
)
{
// parse the normal column
}
else
if
(
pExprs
[
i
].
base
.
colInfo
.
colId
==
TSDB_TBNAME_COLUMN_INDEX
)
{
// parse the normal column
type
=
TSDB_DATA_TYPE_BINARY
;
type
=
TSDB_DATA_TYPE_BINARY
;
bytes
=
TSDB_TABLE_NAME_LEN
;
bytes
=
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
;
}
else
{
}
else
{
int32_t
j
=
getColumnIndexInSource
(
pQueryMsg
,
&
pExprs
[
i
].
base
,
pTagCols
);
int32_t
j
=
getColumnIndexInSource
(
pQueryMsg
,
&
pExprs
[
i
].
base
,
pTagCols
);
assert
(
j
<
pQueryMsg
->
numOfCols
||
j
<
pQueryMsg
->
numOfTags
);
assert
(
j
<
pQueryMsg
->
numOfCols
||
j
<
pQueryMsg
->
numOfTags
);
...
...
src/rpc/src/rpcMain.c
浏览文件 @
c4b6d452
...
@@ -32,8 +32,6 @@
...
@@ -32,8 +32,6 @@
#include "rpcCache.h"
#include "rpcCache.h"
#include "rpcTcp.h"
#include "rpcTcp.h"
#include "rpcHead.h"
#include "rpcHead.h"
#include "shash.h"
#define RPC_MSG_OVERHEAD (sizeof(SRpcReqContext) + sizeof(SRpcHead) + sizeof(SRpcDigest))
#define RPC_MSG_OVERHEAD (sizeof(SRpcReqContext) + sizeof(SRpcHead) + sizeof(SRpcDigest))
#define rpcHeadFromCont(cont) ((SRpcHead *) (cont - sizeof(SRpcHead)))
#define rpcHeadFromCont(cont) ((SRpcHead *) (cont - sizeof(SRpcHead)))
...
@@ -262,9 +260,7 @@ void *rpcOpen(const SRpcInit *pInit) {
...
@@ -262,9 +260,7 @@ void *rpcOpen(const SRpcInit *pInit) {
}
}
if
(
pRpc
->
connType
==
TAOS_CONN_SERVER
)
{
if
(
pRpc
->
connType
==
TAOS_CONN_SERVER
)
{
pRpc
->
hash
=
taosInitStrHash
(
pRpc
->
sessions
,
sizeof
(
pRpc
),
taosHashString
);
pRpc
->
hash
=
taosHashInit
(
pRpc
->
sessions
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
);
// pRpc->hash = taosHashInit(pRpc->sessions, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true);
if
(
pRpc
->
hash
==
NULL
)
{
if
(
pRpc
->
hash
==
NULL
)
{
tError
(
"%s failed to init string hash"
,
pRpc
->
label
);
tError
(
"%s failed to init string hash"
,
pRpc
->
label
);
rpcClose
(
pRpc
);
rpcClose
(
pRpc
);
...
@@ -298,8 +294,7 @@ void rpcClose(void *param) {
...
@@ -298,8 +294,7 @@ void rpcClose(void *param) {
(
*
taosCleanUpConn
[
pRpc
->
connType
|
RPC_CONN_TCP
])(
pRpc
->
tcphandle
);
(
*
taosCleanUpConn
[
pRpc
->
connType
|
RPC_CONN_TCP
])(
pRpc
->
tcphandle
);
(
*
taosCleanUpConn
[
pRpc
->
connType
])(
pRpc
->
udphandle
);
(
*
taosCleanUpConn
[
pRpc
->
connType
])(
pRpc
->
udphandle
);
// taosHashCleanup(pRpc->hash);
taosHashCleanup
(
pRpc
->
hash
);
taosCleanUpStrHash
(
pRpc
->
hash
);
taosTmrCleanUp
(
pRpc
->
tmrCtrl
);
taosTmrCleanUp
(
pRpc
->
tmrCtrl
);
taosIdPoolCleanUp
(
pRpc
->
idPool
);
taosIdPoolCleanUp
(
pRpc
->
idPool
);
rpcCloseConnCache
(
pRpc
->
pCache
);
rpcCloseConnCache
(
pRpc
->
pCache
);
...
@@ -548,9 +543,8 @@ static void rpcCloseConn(void *thandle) {
...
@@ -548,9 +543,8 @@ static void rpcCloseConn(void *thandle) {
if
(
pRpc
->
connType
==
TAOS_CONN_SERVER
)
{
if
(
pRpc
->
connType
==
TAOS_CONN_SERVER
)
{
char
hashstr
[
40
]
=
{
0
};
char
hashstr
[
40
]
=
{
0
};
/*size_t size = */
sprintf
(
hashstr
,
"%x:%x:%x:%d"
,
pConn
->
peerIp
,
pConn
->
linkUid
,
pConn
->
peerId
,
pConn
->
connType
);
size_t
size
=
sprintf
(
hashstr
,
"%x:%x:%x:%d"
,
pConn
->
peerIp
,
pConn
->
linkUid
,
pConn
->
peerId
,
pConn
->
connType
);
// taosHashRemove(pRpc->hash, hashstr, size);
taosHashRemove
(
pRpc
->
hash
,
hashstr
,
size
);
taosDeleteStrHash
(
pRpc
->
hash
,
hashstr
);
rpcFreeMsg
(
pConn
->
pRspMsg
);
// it may have a response msg saved, but not request msg
rpcFreeMsg
(
pConn
->
pRspMsg
);
// it may have a response msg saved, but not request msg
pConn
->
pRspMsg
=
NULL
;
pConn
->
pRspMsg
=
NULL
;
...
@@ -599,12 +593,10 @@ static SRpcConn *rpcAllocateServerConn(SRpcInfo *pRpc, SRecvInfo *pRecv) {
...
@@ -599,12 +593,10 @@ static SRpcConn *rpcAllocateServerConn(SRpcInfo *pRpc, SRecvInfo *pRecv) {
char
hashstr
[
40
]
=
{
0
};
char
hashstr
[
40
]
=
{
0
};
SRpcHead
*
pHead
=
(
SRpcHead
*
)
pRecv
->
msg
;
SRpcHead
*
pHead
=
(
SRpcHead
*
)
pRecv
->
msg
;
/*size_t size = */
sprintf
(
hashstr
,
"%x:%x:%x:%d"
,
pRecv
->
ip
,
pHead
->
linkUid
,
pHead
->
sourceId
,
pRecv
->
connType
);
size_t
size
=
sprintf
(
hashstr
,
"%x:%x:%x:%d"
,
pRecv
->
ip
,
pHead
->
linkUid
,
pHead
->
sourceId
,
pRecv
->
connType
);
// check if it is already allocated
// check if it is already allocated
SRpcConn
**
ppConn
=
(
SRpcConn
**
)(
taosGetStrHashData
(
pRpc
->
hash
,
hashstr
));
SRpcConn
**
ppConn
=
(
SRpcConn
**
)(
taosHashGet
(
pRpc
->
hash
,
hashstr
,
size
));
// SRpcConn **ppConn = (SRpcConn **)(taosHashGet(pRpc->hash, hashstr, size));
if
(
ppConn
)
pConn
=
*
ppConn
;
if
(
ppConn
)
pConn
=
*
ppConn
;
if
(
pConn
)
return
pConn
;
if
(
pConn
)
return
pConn
;
...
@@ -638,10 +630,7 @@ static SRpcConn *rpcAllocateServerConn(SRpcInfo *pRpc, SRecvInfo *pRecv) {
...
@@ -638,10 +630,7 @@ static SRpcConn *rpcAllocateServerConn(SRpcInfo *pRpc, SRecvInfo *pRecv) {
pConn
->
localPort
=
(
pRpc
->
localPort
+
pRpc
->
index
);
pConn
->
localPort
=
(
pRpc
->
localPort
+
pRpc
->
index
);
}
}
taosAddStrHash
(
pRpc
->
hash
,
hashstr
,
(
char
*
)
&
pConn
);
taosHashPut
(
pRpc
->
hash
,
hashstr
,
size
,
(
char
*
)
&
pConn
,
POINTER_BYTES
);
// taosHashPut(pRpc->hash, hashstr, size, (char *)&pConn, POINTER_BYTES);
tTrace
(
"%s %p, rpc connection is allocated, sid:%d id:%s port:%u"
,
tTrace
(
"%s %p, rpc connection is allocated, sid:%d id:%s port:%u"
,
pRpc
->
label
,
pConn
,
sid
,
pConn
->
user
,
pConn
->
localPort
);
pRpc
->
label
,
pConn
,
sid
,
pConn
->
user
,
pConn
->
localPort
);
}
}
...
@@ -803,6 +792,7 @@ static SRpcConn *rpcProcessMsgHead(SRpcInfo *pRpc, SRecvInfo *pRecv) {
...
@@ -803,6 +792,7 @@ static SRpcConn *rpcProcessMsgHead(SRpcInfo *pRpc, SRecvInfo *pRecv) {
sid
=
pConn
->
sid
;
sid
=
pConn
->
sid
;
pConn
->
chandle
=
pRecv
->
chandle
;
pConn
->
chandle
=
pRecv
->
chandle
;
pConn
->
peerIp
=
pRecv
->
ip
;
if
(
pConn
->
peerPort
==
0
)
pConn
->
peerPort
=
pRecv
->
port
;
if
(
pConn
->
peerPort
==
0
)
pConn
->
peerPort
=
pRecv
->
port
;
if
(
pHead
->
port
)
pConn
->
peerPort
=
htons
(
pHead
->
port
);
if
(
pHead
->
port
)
pConn
->
peerPort
=
htons
(
pHead
->
port
);
...
...
tests/script/general/user/user_create.sim
浏览文件 @
c4b6d452
...
@@ -49,19 +49,22 @@ sleep 2000
...
@@ -49,19 +49,22 @@ sleep 2000
sql alter user read privilege read
sql alter user read privilege read
sql show users
sql show users
if $data1_read != read then
print $data1_read
if $data1_read != readable then
return -1
return -1
endi
endi
sql_error alter user read privilege super
sql_error alter user read privilege super
sql show users
sql show users
if $data1_read != read then
print $data1_read
if $data1_read != readable then
return -1
return -1
endi
endi
sql alter user read privilege write
sql alter user read privilege write
sql show users
sql show users
if $data1_read != write then
print $data1_read
if $data1_read != writable then
return -1
return -1
endi
endi
...
...
tests/script/unique/account/user_create.sim
浏览文件 @
c4b6d452
...
@@ -49,19 +49,21 @@ sleep 2000
...
@@ -49,19 +49,21 @@ sleep 2000
sql alter user read privilege read
sql alter user read privilege read
sql show users
sql show users
if $data1_read != read then
print $data1_read
if $data1_read != readable then
return -1
return -1
endi
endi
sql_error alter user read privilege super
sql_error alter user read privilege super
sql show users
sql show users
if $data1_read != read then
print $data1_read
if $data1_read != readable then
return -1
return -1
endi
endi
sql alter user read privilege write
sql alter user read privilege write
sql show users
sql show users
if $data1_read != write then
if $data1_read != writ
abl
e then
return -1
return -1
endi
endi
...
...
tests/script/unique/cluster/balance1.sim
浏览文件 @
c4b6d452
...
@@ -438,22 +438,25 @@ sleep 1000
...
@@ -438,22 +438,25 @@ sleep 1000
print ============================== step17
print ============================== step17
print ========= check data
print ========= check data
sql reset query cache
sleep 1000
sql use c_b1_d1
sql use c_b1_d1
sql select * from c_b1_t1
sql select * from c_b1_t1
if $rows !=
0
then
if $rows !=
5
then
return -1
return -1
endi
endi
sql use c_b1_d2
sql use c_b1_d2
sql select * from c_b1_t2
sql select * from c_b1_t2
if $rows ==
0
then
if $rows ==
6
then
return -1
return -1
endi
endi
sql use c_b1_d3
sql use c_b1_d3
sql select * from c_b1_t3 order by t desc
sql select * from c_b1_t3 order by t desc
print $data01 $data11 $data21 $data31 $data41
print $data01 $data11 $data21 $data31 $data41
if $rows !=
1
then
if $rows !=
6
then
return -1
return -1
endi
endi
if $data01 != 36 then
if $data01 != 36 then
...
@@ -540,30 +543,11 @@ if $data41 != 85 then
...
@@ -540,30 +543,11 @@ if $data41 != 85 then
return -1
return -1
endi
endi
sql use c_b1_d9
sql select * from c_b1_t9 order by t desc
print $data01 $data11 $data21 $data31 $data41
if $data01 != 91 then
return -1
endi
if $data11 != 92 then
return -1
endi
if $data21 != 93 then
return -1
endi
if $data31 != 94 then
return -1
endi
if $data41 != 95 then
return -1
endi
print ============================================ over
print ============================================ over
#
system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
#
system sh/exec_up.sh -n dnode3 -s stop -x SIGINT
system sh/exec_up.sh -n dnode3 -s stop -x SIGINT
#
system sh/exec_up.sh -n dnode4 -s stop -x SIGINT
system sh/exec_up.sh -n dnode4 -s stop -x SIGINT
#
system sh/exec_up.sh -n dnode5 -s stop -x SIGINT
system sh/exec_up.sh -n dnode5 -s stop -x SIGINT
tests/test-all.sh
浏览文件 @
c4b6d452
...
@@ -7,23 +7,28 @@ GREEN_DARK='\033[0;32m'
...
@@ -7,23 +7,28 @@ GREEN_DARK='\033[0;32m'
GREEN_UNDERLINE
=
'\033[4;32m'
GREEN_UNDERLINE
=
'\033[4;32m'
NC
=
'\033[0m'
NC
=
'\033[0m'
echo
"### run TSIM script ###"
cd
script
cd
script
./test.sh
-f
basicSuite.sim 2>&1 |
grep
'success\|failed\|fault'
|
tee
out.txt
./test.sh
-f
basicSuite.sim 2>&1 |
grep
'success\|failed\|fault'
|
grep
-v
'default'
|
tee
out.txt
totalSuccess
=
`
grep
-w
'success'
out.txt |
wc
-l
`
totalSuccess
=
`
grep
'success'
out.txt |
wc
-l
`
totalBasic
=
`
grep
success out.txt |
grep
Suite |
wc
-l
`
totalBasic
=
`
grep
success out.txt |
grep
Suite |
wc
-l
`
if
[
"
$totalSuccess
"
-gt
"0"
]
;
then
if
[
"
$totalSuccess
"
-gt
"0"
]
;
then
totalSuccess
=
`
expr
$totalSuccess
-
$totalBasic
`
totalSuccess
=
`
expr
$totalSuccess
-
$totalBasic
`
echo
-e
"
${
GREEN
}
### Total
$totalSuccess
TSIM case(s) succeed! ###
${
NC
}
"
fi
fi
totalFailed
=
`
grep
-w
'failed\|fault'
out.txt |
wc
-l
`
echo
-e
"
${
GREEN
}
### Total
$totalSuccess
TSIM case(s) succeed! ###
${
NC
}
"
totalFailed
=
`
grep
'failed\|fault'
out.txt |
wc
-l
`
echo
-e
"
${
RED
}
### Total
$totalFailed
TSIM case(s) failed! ###
${
NC
}
"
if
[
"
$totalFailed
"
-ne
"0"
]
;
then
if
[
"
$totalFailed
"
-ne
"0"
]
;
then
echo
-e
"
${
RED
}
### Total
$totalFailed
TSIM case(s) failed! ###
${
NC
}
"
#
echo -e "${RED} ### Total $totalFailed TSIM case(s) failed! ### ${NC}"
exit
$totalFailed
exit
$totalFailed
fi
fi
echo
"### run Python script ###"
cd
../pytest
cd
../pytest
if
[
"
$1
"
==
"cron"
]
;
then
if
[
"
$1
"
==
"cron"
]
;
then
...
...
tests/tsim/src/simExe.c
浏览文件 @
c4b6d452
...
@@ -733,6 +733,7 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) {
...
@@ -733,6 +733,7 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) {
break
;
break
;
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_NCHAR
:
case
TSDB_DATA_TYPE_NCHAR
:
memset
(
value
,
0
,
MAX_QUERY_VALUE_LEN
);
memcpy
(
value
,
row
[
i
],
fields
[
i
].
bytes
);
memcpy
(
value
,
row
[
i
],
fields
[
i
].
bytes
);
value
[
fields
[
i
].
bytes
]
=
0
;
value
[
fields
[
i
].
bytes
]
=
0
;
// snprintf(value, fields[i].bytes, "%s", (char *)row[i]);
// snprintf(value, fields[i].bytes, "%s", (char *)row[i]);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录