Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0f7d9f3a
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
0f7d9f3a
编写于
4月 27, 2022
作者:
W
wenzhouwww@live.cn
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' into test/3.0_math_functions
上级
e49c0925
15a0befa
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
320 addition
and
225 deletion
+320
-225
contrib/CMakeLists.txt
contrib/CMakeLists.txt
+13
-13
include/dnode/mnode/sdb/sdb.h
include/dnode/mnode/sdb/sdb.h
+27
-2
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+8
-7
source/dnode/mgmt/exe/dmMain.c
source/dnode/mgmt/exe/dmMain.c
+2
-2
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+4
-4
source/dnode/mnode/impl/inc/mndTrans.h
source/dnode/mnode/impl/inc/mndTrans.h
+10
-1
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+65
-14
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+72
-73
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+2
-2
source/dnode/mnode/sdb/inc/sdbInt.h
source/dnode/mnode/sdb/inc/sdbInt.h
+0
-24
source/dnode/mnode/sdb/src/sdb.c
source/dnode/mnode/sdb/src/sdb.c
+1
-1
source/dnode/mnode/sdb/src/sdbHash.c
source/dnode/mnode/sdb/src/sdbHash.c
+8
-8
source/dnode/mnode/sdb/src/sdbRaw.c
source/dnode/mnode/sdb/src/sdbRaw.c
+3
-1
source/dnode/mnode/sdb/src/sdbRow.c
source/dnode/mnode/sdb/src/sdbRow.c
+2
-2
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+36
-16
source/libs/function/src/tudf.c
source/libs/function/src/tudf.c
+1
-1
source/util/src/tconfig.c
source/util/src/tconfig.c
+6
-6
tests/pytest/util/dnodes.py
tests/pytest/util/dnodes.py
+13
-3
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+2
-2
tests/script/tsim/db/alter_option.sim
tests/script/tsim/db/alter_option.sim
+43
-43
tools/shell/src/shellMain.c
tools/shell/src/shellMain.c
+2
-0
未找到文件。
contrib/CMakeLists.txt
浏览文件 @
0f7d9f3a
...
...
@@ -110,7 +110,7 @@ execute_process(COMMAND "${CMAKE_COMMAND}" --build .
# ================================================================================================
# googletest
if
(
${
BUILD_TEST
}
)
add_subdirectory
(
googletest
)
add_subdirectory
(
googletest
EXCLUDE_FROM_ALL
)
target_include_directories
(
gtest
PUBLIC $<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
/cpp-stub/src>
...
...
@@ -143,7 +143,7 @@ set(CMAKE_PROJECT_INCLUDE_BEFORE "${TD_SUPPORT_DIR}/EnableCMP0048.txt.in")
option
(
ENABLE_CJSON_TEST
"Enable building cJSON test"
OFF
)
option
(
CJSON_OVERRIDE_BUILD_SHARED_LIBS
"Override BUILD_SHARED_LIBS with CJSON_BUILD_SHARED_LIBS"
ON
)
option
(
CJSON_BUILD_SHARED_LIBS
"Overrides BUILD_SHARED_LIBS if CJSON_OVERRIDE_BUILD_SHARED_LIBS is enabled"
OFF
)
add_subdirectory
(
cJson
)
add_subdirectory
(
cJson
EXCLUDE_FROM_ALL
)
target_include_directories
(
cjson
# see https://stackoverflow.com/questions/25676277/cmake-target-include-directories-prints-an-error-when-i-try-to-add-the-source
...
...
@@ -152,7 +152,7 @@ target_include_directories(
unset
(
CMAKE_PROJECT_INCLUDE_BEFORE
)
# lz4
add_subdirectory
(
lz4/build/cmake
)
add_subdirectory
(
lz4/build/cmake
EXCLUDE_FROM_ALL
)
target_include_directories
(
lz4_static
PUBLIC
${
CMAKE_CURRENT_SOURCE_DIR
}
/lz4/lib
...
...
@@ -160,7 +160,7 @@ target_include_directories(
# zlib
set
(
CMAKE_PROJECT_INCLUDE_BEFORE
"
${
TD_SUPPORT_DIR
}
/EnableCMP0048.txt.in"
)
add_subdirectory
(
zlib
)
add_subdirectory
(
zlib
EXCLUDE_FROM_ALL
)
target_include_directories
(
zlibstatic
PUBLIC
${
CMAKE_CURRENT_BINARY_DIR
}
/zlib
...
...
@@ -176,7 +176,7 @@ unset(CMAKE_PROJECT_INCLUDE_BEFORE)
# leveldb
if
(
${
BUILD_WITH_LEVELDB
}
)
option
(
LEVELDB_BUILD_TESTS
""
OFF
)
add_subdirectory
(
leveldb
)
add_subdirectory
(
leveldb
EXCLUDE_FROM_ALL
)
target_include_directories
(
leveldb
PUBLIC $<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
/leveldb/include>
...
...
@@ -192,7 +192,7 @@ if(${BUILD_WITH_ROCKSDB})
option
(
WITH_TOOLS
""
OFF
)
option
(
WITH_LIBURING
""
OFF
)
option
(
ROCKSDB_BUILD_SHARED
"Build shared versions of the RocksDB libraries"
OFF
)
add_subdirectory
(
rocksdb
)
add_subdirectory
(
rocksdb
EXCLUDE_FROM_ALL
)
target_include_directories
(
rocksdb
PUBLIC $<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
/rocksdb/include>
...
...
@@ -203,7 +203,7 @@ endif(${BUILD_WITH_ROCKSDB})
# To support build on ubuntu: sudo apt-get install libboost-all-dev
if
(
${
BUILD_WITH_LUCENE
}
)
option
(
ENABLE_TEST
"Enable the tests"
OFF
)
add_subdirectory
(
lucene
)
add_subdirectory
(
lucene
EXCLUDE_FROM_ALL
)
target_include_directories
(
lucene++
PUBLIC $<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
/lucene/include>
...
...
@@ -213,14 +213,14 @@ endif(${BUILD_WITH_LUCENE})
# NuRaft
if
(
${
BUILD_WITH_NURAFT
}
)
add_subdirectory
(
nuraft
)
add_subdirectory
(
nuraft
EXCLUDE_FROM_ALL
)
endif
(
${
BUILD_WITH_NURAFT
}
)
# pthread
if
(
${
BUILD_PTHREAD
}
)
set
(
CMAKE_BUILD_TYPE release
)
add_definitions
(
-DPTW32_STATIC_LIB
)
add_subdirectory
(
pthread
)
add_subdirectory
(
pthread
EXCLUDE_FROM_ALL
)
set_target_properties
(
libpthreadVC3 PROPERTIES OUTPUT_NAME pthread
)
add_library
(
pthread STATIC IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET pthread PROPERTY IMPORTED_LOCATION
${
LIBRARY_OUTPUT_PATH
}
/pthread.lib
)
...
...
@@ -228,12 +228,12 @@ endif()
# iconv
if
(
${
BUILD_WITH_ICONV
}
)
add_subdirectory
(
iconv
)
add_subdirectory
(
iconv
EXCLUDE_FROM_ALL
)
endif
(
${
BUILD_WITH_ICONV
}
)
# wingetopt
if
(
${
BUILD_WINGETOPT
}
)
add_subdirectory
(
wingetopt
)
add_subdirectory
(
wingetopt
EXCLUDE_FROM_ALL
)
endif
(
${
BUILD_WINGETOPT
}
)
# msvcregex
...
...
@@ -293,7 +293,7 @@ if(${BUILD_WITH_UV})
MESSAGE
(
"Windows need set no-sign-compare"
)
add_compile_options
(
-Wno-sign-compare
)
endif
()
add_subdirectory
(
libuv
)
add_subdirectory
(
libuv
EXCLUDE_FROM_ALL
)
endif
(
${
BUILD_WITH_UV
}
)
# BDB
...
...
@@ -334,5 +334,5 @@ endif(${BUILD_WITH_SQLITE})
# Build test
# ================================================================================================
if
(
${
BUILD_DEPENDENCY_TESTS
}
)
add_subdirectory
(
test
)
add_subdirectory
(
test
EXCLUDE_FROM_ALL
)
endif
(
${
BUILD_DEPENDENCY_TESTS
}
)
include/dnode/mnode/sdb/sdb.h
浏览文件 @
0f7d9f3a
...
...
@@ -18,6 +18,11 @@
#include "os.h"
#include "thash.h"
#include "tlockfree.h"
#include "tlog.h"
#include "tmsg.h"
#ifdef __cplusplus
extern
"C"
{
#endif
...
...
@@ -135,7 +140,7 @@ typedef enum {
typedef
struct
SSdb
SSdb
;
typedef
int32_t
(
*
SdbInsertFp
)(
SSdb
*
pSdb
,
void
*
pObj
);
typedef
int32_t
(
*
SdbUpdateFp
)(
SSdb
*
pSdb
,
void
*
pSrcObj
,
void
*
pDstObj
);
typedef
int32_t
(
*
SdbDeleteFp
)(
SSdb
*
pSdb
,
void
*
pObj
);
typedef
int32_t
(
*
SdbDeleteFp
)(
SSdb
*
pSdb
,
void
*
pObj
,
bool
callFunc
);
typedef
int32_t
(
*
SdbDeployFp
)(
SMnode
*
pMnode
);
typedef
SSdbRow
*
(
*
SdbDecodeFp
)(
SSdbRaw
*
pRaw
);
typedef
SSdbRaw
*
(
*
SdbEncodeFp
)(
void
*
pObj
);
...
...
@@ -326,9 +331,29 @@ int32_t sdbGetRawSoftVer(SSdbRaw *pRaw, int8_t *sver);
int32_t
sdbGetRawTotalSize
(
SSdbRaw
*
pRaw
);
SSdbRow
*
sdbAllocRow
(
int32_t
objSize
);
void
sdbFreeRow
(
SSdb
*
pSdb
,
SSdbRow
*
pRow
);
void
sdbFreeRow
(
SSdb
*
pSdb
,
SSdbRow
*
pRow
,
bool
callFunc
);
void
*
sdbGetRowObj
(
SSdbRow
*
pRow
);
typedef
struct
SSdb
{
SMnode
*
pMnode
;
char
*
currDir
;
char
*
syncDir
;
char
*
tmpDir
;
int64_t
lastCommitVer
;
int64_t
curVer
;
int64_t
tableVer
[
SDB_MAX
];
int64_t
maxId
[
SDB_MAX
];
EKeyType
keyTypes
[
SDB_MAX
];
SHashObj
*
hashObjs
[
SDB_MAX
];
SRWLatch
locks
[
SDB_MAX
];
SdbInsertFp
insertFps
[
SDB_MAX
];
SdbUpdateFp
updateFps
[
SDB_MAX
];
SdbDeleteFp
deleteFps
[
SDB_MAX
];
SdbDeployFp
deployFps
[
SDB_MAX
];
SdbEncodeFp
encodeFps
[
SDB_MAX
];
SdbDecodeFp
decodeFps
[
SDB_MAX
];
}
SSdb
;
#ifdef __cplusplus
}
#endif
...
...
source/common/src/tdatablock.c
浏览文件 @
0f7d9f3a
...
...
@@ -117,22 +117,23 @@ int32_t colDataAppend(SColumnInfoData* pColumnInfoData, uint32_t currentRow, con
int32_t
type
=
pColumnInfoData
->
info
.
type
;
if
(
IS_VAR_DATA_TYPE
(
type
))
{
int32_t
dataLen
=
varDataTLen
(
pData
);
if
(
type
==
TSDB_DATA_TYPE_JSON
)
{
if
(
*
pData
==
TSDB_DATA_TYPE_NULL
)
{
if
(
type
==
TSDB_DATA_TYPE_JSON
)
{
if
(
*
pData
==
TSDB_DATA_TYPE_NULL
)
{
dataLen
=
0
;
}
else
if
(
*
pData
==
TSDB_DATA_TYPE_NCHAR
)
{
dataLen
=
varDataTLen
(
pData
+
CHAR_BYTES
);
}
else
if
(
*
pData
==
TSDB_DATA_TYPE_BIGINT
||
*
pData
==
TSDB_DATA_TYPE_DOUBLE
)
{
}
else
if
(
*
pData
==
TSDB_DATA_TYPE_NCHAR
)
{
dataLen
=
varDataTLen
(
pData
+
CHAR_BYTES
);
}
else
if
(
*
pData
==
TSDB_DATA_TYPE_BIGINT
||
*
pData
==
TSDB_DATA_TYPE_DOUBLE
)
{
dataLen
=
LONG_BYTES
;
}
else
if
(
*
pData
==
TSDB_DATA_TYPE_BOOL
)
{
}
else
if
(
*
pData
==
TSDB_DATA_TYPE_BOOL
)
{
dataLen
=
CHAR_BYTES
;
}
dataLen
+=
CHAR_BYTES
;
}
SVarColAttr
*
pAttr
=
&
pColumnInfoData
->
varmeta
;
if
(
pAttr
->
allocLen
<
pAttr
->
length
+
dataLen
)
{
uint32_t
newSize
=
pAttr
->
allocLen
;
if
(
newSize
==
0
)
{
if
(
newSize
<=
1
)
{
newSize
=
8
;
}
...
...
source/dnode/mgmt/exe/dmMain.c
浏览文件 @
0f7d9f3a
...
...
@@ -69,8 +69,8 @@ static void dmSetSignalHandle() {
static
int32_t
dmParseArgs
(
int32_t
argc
,
char
const
*
argv
[])
{
int32_t
cmdEnvIndex
=
0
;
if
(
argc
<
2
)
return
0
;
global
.
envCmd
=
taosMemoryMalloc
(
argc
-
1
);
memset
(
global
.
envCmd
,
0
,
argc
-
1
);
global
.
envCmd
=
taosMemoryMalloc
(
(
argc
-
1
)
*
sizeof
(
char
*
)
);
memset
(
global
.
envCmd
,
0
,
(
argc
-
1
)
*
sizeof
(
char
*
)
);
for
(
int32_t
i
=
1
;
i
<
argc
;
++
i
)
{
if
(
strcmp
(
argv
[
i
],
"-c"
)
==
0
)
{
if
(
i
<
argc
-
1
)
{
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
0f7d9f3a
...
...
@@ -126,8 +126,6 @@ typedef enum {
DND_REASON_OTHERS
}
EDndReason
;
typedef
void
(
*
TransCbFp
)(
SMnode
*
pMnode
,
void
*
param
);
typedef
struct
{
int32_t
id
;
ETrnStage
stage
;
...
...
@@ -150,8 +148,10 @@ typedef struct {
int64_t
dbUid
;
char
dbname
[
TSDB_DB_FNAME_LEN
];
char
lastError
[
TSDB_TRANS_ERROR_LEN
];
TransCbFp
transCbFp
;
void
*
transCbParam
;
int32_t
startFunc
;
int32_t
stopFunc
;
int32_t
paramLen
;
void
*
param
;
}
STrans
;
typedef
struct
{
...
...
source/dnode/mnode/impl/inc/mndTrans.h
浏览文件 @
0f7d9f3a
...
...
@@ -33,6 +33,15 @@ typedef struct {
void
*
pCont
;
}
STransAction
;
typedef
enum
{
TEST_TRANS_START_FUNC
=
1
,
TEST_TRANS_STOP_FUNC
=
2
,
CONSUME_TRANS_START_FUNC
=
3
,
CONSUME_TRANS_STOP_FUNC
=
4
,
}
ETrnFuncType
;
typedef
void
(
*
TransCbFp
)(
SMnode
*
pMnode
,
void
*
param
,
int32_t
paramLen
);
int32_t
mndInitTrans
(
SMnode
*
pMnode
);
void
mndCleanupTrans
(
SMnode
*
pMnode
);
...
...
@@ -44,7 +53,7 @@ int32_t mndTransAppendCommitlog(STrans *pTrans, SSdbRaw *pRaw);
int32_t
mndTransAppendRedoAction
(
STrans
*
pTrans
,
STransAction
*
pAction
);
int32_t
mndTransAppendUndoAction
(
STrans
*
pTrans
,
STransAction
*
pAction
);
void
mndTransSetRpcRsp
(
STrans
*
pTrans
,
void
*
pCont
,
int32_t
contLen
);
void
mndTransSetCb
(
STrans
*
pTrans
,
TransCbFp
fp
,
void
*
param
);
void
mndTransSetCb
(
STrans
*
pTrans
,
ETrnFuncType
startFunc
,
ETrnFuncType
stopFunc
,
void
*
param
,
int32_t
paramLen
);
void
mndTransSetDbInfo
(
STrans
*
pTrans
,
SDbObj
*
pDb
);
int32_t
mndTransPrepare
(
SMnode
*
pMnode
,
STrans
*
pTrans
);
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
0f7d9f3a
...
...
@@ -29,7 +29,7 @@ static SSdbRaw *mndTransActionEncode(STrans *pTrans);
static
SSdbRow
*
mndTransActionDecode
(
SSdbRaw
*
pRaw
);
static
int32_t
mndTransActionInsert
(
SSdb
*
pSdb
,
STrans
*
pTrans
);
static
int32_t
mndTransActionUpdate
(
SSdb
*
pSdb
,
STrans
*
OldTrans
,
STrans
*
pOld
);
static
int32_t
mndTransActionDelete
(
SSdb
*
pSdb
,
STrans
*
pTrans
);
static
int32_t
mndTransActionDelete
(
SSdb
*
pSdb
,
STrans
*
pTrans
,
bool
callFunc
);
static
int32_t
mndTransAppendLog
(
SArray
*
pArray
,
SSdbRaw
*
pRaw
);
static
int32_t
mndTransAppendAction
(
SArray
*
pArray
,
STransAction
*
pAction
);
...
...
@@ -174,6 +174,13 @@ static SSdbRaw *mndTransActionEncode(STrans *pTrans) {
SDB_SET_BINARY
(
pRaw
,
dataPos
,
(
void
*
)
pAction
->
pCont
,
pAction
->
contLen
,
TRANS_ENCODE_OVER
)
}
SDB_SET_INT32
(
pRaw
,
dataPos
,
pTrans
->
startFunc
,
TRANS_ENCODE_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pTrans
->
stopFunc
,
TRANS_ENCODE_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pTrans
->
paramLen
,
TRANS_ENCODE_OVER
)
if
(
pTrans
->
param
!=
NULL
)
{
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pTrans
->
param
,
pTrans
->
paramLen
,
TRANS_ENCODE_OVER
)
}
SDB_SET_RESERVE
(
pRaw
,
dataPos
,
MND_TRANS_RESERVE_SIZE
,
TRANS_ENCODE_OVER
)
SDB_SET_DATALEN
(
pRaw
,
dataPos
,
TRANS_ENCODE_OVER
)
...
...
@@ -305,6 +312,14 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
action
.
pCont
=
NULL
;
}
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pTrans
->
startFunc
,
TRANS_DECODE_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pTrans
->
stopFunc
,
TRANS_DECODE_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pTrans
->
paramLen
,
TRANS_DECODE_OVER
)
if
(
pTrans
->
paramLen
!=
0
)
{
pTrans
->
param
=
taosMemoryMalloc
(
pTrans
->
paramLen
);
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pTrans
->
param
,
pTrans
->
paramLen
,
TRANS_DECODE_OVER
);
}
SDB_GET_RESERVE
(
pRaw
,
dataPos
,
MND_TRANS_RESERVE_SIZE
,
TRANS_DECODE_OVER
)
terrno
=
0
;
...
...
@@ -413,9 +428,36 @@ static const char *mndTransType(ETrnType type) {
}
}
static
void
mndTransTestStartFunc
(
SMnode
*
pMnode
,
void
*
param
,
int32_t
paramLen
)
{
mInfo
(
"test trans start, param:%s, len:%d"
,
(
char
*
)
param
,
paramLen
);
}
static
void
mndTransTestStopFunc
(
SMnode
*
pMnode
,
void
*
param
,
int32_t
paramLen
)
{
mInfo
(
"test trans stop, param:%s, len:%d"
,
(
char
*
)
param
,
paramLen
);
}
static
TransCbFp
mndTransGetCbFp
(
ETrnFuncType
ftype
)
{
switch
(
ftype
)
{
case
TEST_TRANS_START_FUNC
:
return
mndTransTestStartFunc
;
case
TEST_TRANS_STOP_FUNC
:
return
mndTransTestStopFunc
;
default:
return
NULL
;
}
}
static
int32_t
mndTransActionInsert
(
SSdb
*
pSdb
,
STrans
*
pTrans
)
{
// pTrans->stage = TRN_STAGE_PREPARE;
mTrace
(
"trans:%d, perform insert action, row:%p stage:%s"
,
pTrans
->
id
,
pTrans
,
mndTransStr
(
pTrans
->
stage
));
if
(
pTrans
->
startFunc
>
0
)
{
TransCbFp
fp
=
mndTransGetCbFp
(
pTrans
->
startFunc
);
if
(
fp
)
{
(
*
fp
)(
pSdb
->
pMnode
,
pTrans
->
param
,
pTrans
->
paramLen
);
}
}
return
0
;
}
...
...
@@ -430,10 +472,23 @@ static void mndTransDropData(STrans *pTrans) {
pTrans
->
rpcRsp
=
NULL
;
pTrans
->
rpcRspLen
=
0
;
}
if
(
pTrans
->
param
!=
NULL
)
{
taosMemoryFree
(
pTrans
->
param
);
pTrans
->
param
=
NULL
;
pTrans
->
paramLen
=
0
;
}
}
static
int32_t
mndTransActionDelete
(
SSdb
*
pSdb
,
STrans
*
pTrans
)
{
mTrace
(
"trans:%d, perform delete action, row:%p stage:%s"
,
pTrans
->
id
,
pTrans
,
mndTransStr
(
pTrans
->
stage
));
static
int32_t
mndTransActionDelete
(
SSdb
*
pSdb
,
STrans
*
pTrans
,
bool
callFunc
)
{
mDebug
(
"trans:%d, perform delete action, row:%p stage:%s callfunc:%d"
,
pTrans
->
id
,
pTrans
,
mndTransStr
(
pTrans
->
stage
),
callFunc
);
if
(
pTrans
->
stopFunc
>
0
&&
callFunc
)
{
TransCbFp
fp
=
mndTransGetCbFp
(
pTrans
->
stopFunc
);
if
(
fp
)
{
(
*
fp
)(
pSdb
->
pMnode
,
pTrans
->
param
,
pTrans
->
paramLen
);
}
}
mndTransDropData
(
pTrans
);
return
0
;
}
...
...
@@ -498,7 +553,7 @@ STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnType type, const S
return
NULL
;
}
mDebug
(
"trans:%d, is created, data:%p"
,
pTrans
->
id
,
pTrans
);
mDebug
(
"trans:%d,
local var
is created, data:%p"
,
pTrans
->
id
,
pTrans
);
return
pTrans
;
}
...
...
@@ -525,7 +580,7 @@ static void mndTransDropActions(SArray *pArray) {
void
mndTransDrop
(
STrans
*
pTrans
)
{
if
(
pTrans
!=
NULL
)
{
mndTransDropData
(
pTrans
);
mDebug
(
"trans:%d,
is dropp
ed, data:%p"
,
pTrans
->
id
,
pTrans
);
mDebug
(
"trans:%d,
local var is fre
ed, data:%p"
,
pTrans
->
id
,
pTrans
);
taosMemoryFreeClear
(
pTrans
);
}
}
...
...
@@ -574,9 +629,11 @@ void mndTransSetRpcRsp(STrans *pTrans, void *pCont, int32_t contLen) {
pTrans
->
rpcRspLen
=
contLen
;
}
void
mndTransSetCb
(
STrans
*
pTrans
,
TransCbFp
fp
,
void
*
param
)
{
pTrans
->
transCbFp
=
fp
;
pTrans
->
transCbParam
=
param
;
void
mndTransSetCb
(
STrans
*
pTrans
,
ETrnFuncType
startFunc
,
ETrnFuncType
stopFunc
,
void
*
param
,
int32_t
paramLen
)
{
pTrans
->
startFunc
=
startFunc
;
pTrans
->
stopFunc
=
stopFunc
;
pTrans
->
param
=
param
;
pTrans
->
paramLen
=
paramLen
;
}
void
mndTransSetDbInfo
(
STrans
*
pTrans
,
SDbObj
*
pDb
)
{
...
...
@@ -712,8 +769,6 @@ int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) {
pNew
->
rpcRefId
=
pTrans
->
rpcRefId
;
pNew
->
rpcRsp
=
pTrans
->
rpcRsp
;
pNew
->
rpcRspLen
=
pTrans
->
rpcRspLen
;
pNew
->
transCbFp
=
pTrans
->
transCbFp
;
pNew
->
transCbParam
=
pTrans
->
transCbParam
;
pTrans
->
rpcRsp
=
NULL
;
pTrans
->
rpcRspLen
=
0
;
...
...
@@ -1125,10 +1180,6 @@ static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans) {
mDebug
(
"trans:%d, finished, code:0x%04x, failedTimes:%d"
,
pTrans
->
id
,
pTrans
->
code
,
pTrans
->
failedTimes
);
if
(
pTrans
->
transCbFp
!=
NULL
)
{
(
*
pTrans
->
transCbFp
)(
pMnode
,
pTrans
->
transCbParam
);
}
return
continueExec
;
}
...
...
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
0f7d9f3a
...
...
@@ -96,36 +96,36 @@ static SSdbRaw *mndUserActionEncode(SUserObj *pUser) {
int32_t
size
=
sizeof
(
SUserObj
)
+
USER_RESERVE_SIZE
+
(
numOfReadDbs
+
numOfWriteDbs
)
*
TSDB_DB_FNAME_LEN
;
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_USER
,
USER_VER_NUMBER
,
size
);
if
(
pRaw
==
NULL
)
goto
USER_ENCODE
_OVER
;
if
(
pRaw
==
NULL
)
goto
_OVER
;
int32_t
dataPos
=
0
;
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pUser
->
user
,
TSDB_USER_LEN
,
USER_ENCODE
_OVER
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pUser
->
pass
,
TSDB_PASSWORD_LEN
,
USER_ENCODE
_OVER
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pUser
->
acct
,
TSDB_USER_LEN
,
USER_ENCODE
_OVER
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pUser
->
createdTime
,
USER_ENCODE
_OVER
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pUser
->
updateTime
,
USER_ENCODE
_OVER
)
SDB_SET_INT8
(
pRaw
,
dataPos
,
pUser
->
superUser
,
USER_ENCODE
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
numOfReadDbs
,
USER_ENCODE
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
numOfWriteDbs
,
USER_ENCODE
_OVER
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pUser
->
user
,
TSDB_USER_LEN
,
_OVER
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pUser
->
pass
,
TSDB_PASSWORD_LEN
,
_OVER
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pUser
->
acct
,
TSDB_USER_LEN
,
_OVER
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pUser
->
createdTime
,
_OVER
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pUser
->
updateTime
,
_OVER
)
SDB_SET_INT8
(
pRaw
,
dataPos
,
pUser
->
superUser
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
numOfReadDbs
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
numOfWriteDbs
,
_OVER
)
char
*
db
=
taosHashIterate
(
pUser
->
readDbs
,
NULL
);
while
(
db
!=
NULL
)
{
SDB_SET_BINARY
(
pRaw
,
dataPos
,
db
,
TSDB_DB_FNAME_LEN
,
USER_ENCODE
_OVER
);
SDB_SET_BINARY
(
pRaw
,
dataPos
,
db
,
TSDB_DB_FNAME_LEN
,
_OVER
);
db
=
taosHashIterate
(
pUser
->
readDbs
,
db
);
}
db
=
taosHashIterate
(
pUser
->
writeDbs
,
NULL
);
while
(
db
!=
NULL
)
{
SDB_SET_BINARY
(
pRaw
,
dataPos
,
db
,
TSDB_DB_FNAME_LEN
,
USER_ENCODE
_OVER
);
SDB_SET_BINARY
(
pRaw
,
dataPos
,
db
,
TSDB_DB_FNAME_LEN
,
_OVER
);
db
=
taosHashIterate
(
pUser
->
writeDbs
,
db
);
}
SDB_SET_RESERVE
(
pRaw
,
dataPos
,
USER_RESERVE_SIZE
,
USER_ENCODE
_OVER
)
SDB_SET_DATALEN
(
pRaw
,
dataPos
,
USER_ENCODE
_OVER
)
SDB_SET_RESERVE
(
pRaw
,
dataPos
,
USER_RESERVE_SIZE
,
_OVER
)
SDB_SET_DATALEN
(
pRaw
,
dataPos
,
_OVER
)
terrno
=
0
;
USER_ENCODE
_OVER:
_OVER:
if
(
terrno
!=
0
)
{
mError
(
"user:%s, failed to encode to raw:%p since %s"
,
pUser
->
user
,
pRaw
,
terrstr
());
sdbFreeRaw
(
pRaw
);
...
...
@@ -140,55 +140,54 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
int8_t
sver
=
0
;
if
(
sdbGetRawSoftVer
(
pRaw
,
&
sver
)
!=
0
)
goto
USER_DECODE
_OVER
;
if
(
sdbGetRawSoftVer
(
pRaw
,
&
sver
)
!=
0
)
goto
_OVER
;
if
(
sver
!=
USER_VER_NUMBER
)
{
terrno
=
TSDB_CODE_SDB_INVALID_DATA_VER
;
goto
USER_DECODE
_OVER
;
goto
_OVER
;
}
SSdbRow
*
pRow
=
sdbAllocRow
(
sizeof
(
SUserObj
));
if
(
pRow
==
NULL
)
goto
USER_DECODE
_OVER
;
if
(
pRow
==
NULL
)
goto
_OVER
;
SUserObj
*
pUser
=
sdbGetRowObj
(
pRow
);
if
(
pUser
==
NULL
)
goto
USER_DECODE_OVER
;
pUser
->
readDbs
=
taosHashInit
(
4
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
true
);
pUser
->
writeDbs
=
taosHashInit
(
4
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
true
);
if
(
pUser
->
readDbs
==
NULL
||
pUser
->
writeDbs
==
NULL
)
goto
USER_DECODE_OVER
;
if
(
pUser
==
NULL
)
goto
_OVER
;
int32_t
dataPos
=
0
;
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pUser
->
user
,
TSDB_USER_LEN
,
USER_DECODE
_OVER
)
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pUser
->
pass
,
TSDB_PASSWORD_LEN
,
USER_DECODE
_OVER
)
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pUser
->
acct
,
TSDB_USER_LEN
,
USER_DECODE
_OVER
)
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pUser
->
createdTime
,
USER_DECODE
_OVER
)
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pUser
->
updateTime
,
USER_DECODE
_OVER
)
SDB_GET_INT8
(
pRaw
,
dataPos
,
&
pUser
->
superUser
,
USER_DECODE
_OVER
)
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pUser
->
user
,
TSDB_USER_LEN
,
_OVER
)
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pUser
->
pass
,
TSDB_PASSWORD_LEN
,
_OVER
)
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pUser
->
acct
,
TSDB_USER_LEN
,
_OVER
)
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pUser
->
createdTime
,
_OVER
)
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pUser
->
updateTime
,
_OVER
)
SDB_GET_INT8
(
pRaw
,
dataPos
,
&
pUser
->
superUser
,
_OVER
)
int32_t
numOfReadDbs
=
0
;
int32_t
numOfWriteDbs
=
0
;
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
numOfReadDbs
,
USER_DECODE_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
numOfWriteDbs
,
USER_DECODE_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
numOfReadDbs
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
numOfWriteDbs
,
_OVER
)
pUser
->
readDbs
=
taosHashInit
(
numOfReadDbs
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
true
);
pUser
->
writeDbs
=
taosHashInit
(
numOfWriteDbs
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
true
);
if
(
pUser
->
readDbs
==
NULL
||
pUser
->
writeDbs
==
NULL
)
goto
_OVER
;
for
(
int32_t
i
=
0
;
i
<
numOfReadDbs
;
++
i
)
{
char
db
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
SDB_GET_BINARY
(
pRaw
,
dataPos
,
db
,
TSDB_DB_FNAME_LEN
,
USER_DECODE
_OVER
)
SDB_GET_BINARY
(
pRaw
,
dataPos
,
db
,
TSDB_DB_FNAME_LEN
,
_OVER
)
int32_t
len
=
strlen
(
db
)
+
1
;
taosHashPut
(
pUser
->
readDbs
,
db
,
len
,
db
,
TSDB_DB_FNAME_LEN
);
}
for
(
int32_t
i
=
0
;
i
<
numOfWriteDbs
;
++
i
)
{
char
db
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
SDB_GET_BINARY
(
pRaw
,
dataPos
,
db
,
TSDB_DB_FNAME_LEN
,
USER_DECODE
_OVER
)
SDB_GET_BINARY
(
pRaw
,
dataPos
,
db
,
TSDB_DB_FNAME_LEN
,
_OVER
)
int32_t
len
=
strlen
(
db
)
+
1
;
taosHashPut
(
pUser
->
writeDbs
,
db
,
len
,
db
,
TSDB_DB_FNAME_LEN
);
}
SDB_GET_RESERVE
(
pRaw
,
dataPos
,
USER_RESERVE_SIZE
,
USER_DECODE
_OVER
)
SDB_GET_RESERVE
(
pRaw
,
dataPos
,
USER_RESERVE_SIZE
,
_OVER
)
terrno
=
0
;
USER_DECODE
_OVER:
_OVER:
if
(
terrno
!=
0
)
{
mError
(
"user:%s, failed to decode from raw:%p since %s"
,
pUser
->
user
,
pRaw
,
terrstr
());
taosHashCleanup
(
pUser
->
readDbs
);
...
...
@@ -220,6 +219,8 @@ static int32_t mndUserActionDelete(SSdb *pSdb, SUserObj *pUser) {
mTrace
(
"user:%s, perform delete action, row:%p"
,
pUser
->
user
,
pUser
);
taosHashCleanup
(
pUser
->
readDbs
);
taosHashCleanup
(
pUser
->
writeDbs
);
pUser
->
readDbs
=
NULL
;
pUser
->
writeDbs
=
NULL
;
return
0
;
}
...
...
@@ -228,13 +229,8 @@ static int32_t mndUserActionUpdate(SSdb *pSdb, SUserObj *pOld, SUserObj *pNew) {
memcpy
(
pOld
->
pass
,
pNew
->
pass
,
TSDB_PASSWORD_LEN
);
pOld
->
updateTime
=
pNew
->
updateTime
;
void
*
tmp1
=
pOld
->
readDbs
;
pOld
->
readDbs
=
pNew
->
readDbs
;
pNew
->
readDbs
=
tmp1
;
void
*
tmp2
=
pOld
->
writeDbs
;
pOld
->
writeDbs
=
pNew
->
writeDbs
;
pNew
->
writeDbs
=
tmp2
;
TSWAP
(
pOld
->
readDbs
,
pNew
->
readDbs
,
(
void
*
));
TSWAP
(
pOld
->
writeDbs
,
pNew
->
writeDbs
,
(
void
*
));
return
0
;
}
...
...
@@ -277,6 +273,9 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, SCreateUserReq *pCreate
}
sdbSetRawStatus
(
pRedoRaw
,
SDB_STATUS_READY
);
char
*
param
=
strdup
(
"====> test code to be deleted later <====="
);
mndTransSetCb
(
pTrans
,
TEST_TRANS_START_FUNC
,
TEST_TRANS_STOP_FUNC
,
param
,
strlen
(
param
)
+
1
);
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
{
mError
(
"trans:%d, failed to prepare since %s"
,
pTrans
->
id
,
terrstr
());
mndTransDrop
(
pTrans
);
...
...
@@ -296,41 +295,41 @@ static int32_t mndProcessCreateUserReq(SNodeMsg *pReq) {
if
(
tDeserializeSCreateUserReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
CREATE_USER
_OVER
;
goto
_OVER
;
}
mDebug
(
"user:%s, start to create"
,
createReq
.
user
);
if
(
createReq
.
user
[
0
]
==
0
)
{
terrno
=
TSDB_CODE_MND_INVALID_USER_FORMAT
;
goto
CREATE_USER
_OVER
;
goto
_OVER
;
}
if
(
createReq
.
pass
[
0
]
==
0
)
{
terrno
=
TSDB_CODE_MND_INVALID_PASS_FORMAT
;
goto
CREATE_USER
_OVER
;
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
createReq
.
user
);
if
(
pUser
!=
NULL
)
{
terrno
=
TSDB_CODE_MND_USER_ALREADY_EXIST
;
goto
CREATE_USER
_OVER
;
goto
_OVER
;
}
pOperUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pOperUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
CREATE_USER
_OVER
;
goto
_OVER
;
}
if
(
mndCheckCreateUserAuth
(
pOperUser
)
!=
0
)
{
goto
CREATE_USER
_OVER
;
goto
_OVER
;
}
code
=
mndCreateUser
(
pMnode
,
pOperUser
->
acct
,
&
createReq
,
pReq
);
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
CREATE_USER
_OVER:
_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"user:%s, failed to create since %s"
,
createReq
.
user
,
terrstr
());
}
...
...
@@ -399,38 +398,38 @@ static int32_t mndProcessAlterUserReq(SNodeMsg *pReq) {
if
(
tDeserializeSAlterUserReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
alterReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
ALTER_USER
_OVER
;
goto
_OVER
;
}
mDebug
(
"user:%s, start to alter"
,
alterReq
.
user
);
if
(
alterReq
.
user
[
0
]
==
0
)
{
terrno
=
TSDB_CODE_MND_INVALID_USER_FORMAT
;
goto
ALTER_USER
_OVER
;
goto
_OVER
;
}
if
(
alterReq
.
pass
[
0
]
==
0
)
{
terrno
=
TSDB_CODE_MND_INVALID_PASS_FORMAT
;
goto
ALTER_USER
_OVER
;
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
alterReq
.
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_USER_NOT_EXIST
;
goto
ALTER_USER
_OVER
;
goto
_OVER
;
}
pOperUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pOperUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
ALTER_USER
_OVER
;
goto
_OVER
;
}
memcpy
(
&
newUser
,
pUser
,
sizeof
(
SUserObj
));
newUser
.
readDbs
=
mndDupDbHash
(
pUser
->
readDbs
);
newUser
.
writeDbs
=
mndDupDbHash
(
pUser
->
writeDbs
);
if
(
newUser
.
readDbs
==
NULL
||
newUser
.
writeDbs
==
NULL
)
{
goto
ALTER_USER
_OVER
;
goto
_OVER
;
}
int32_t
len
=
strlen
(
alterReq
.
dbname
)
+
1
;
...
...
@@ -446,50 +445,50 @@ static int32_t mndProcessAlterUserReq(SNodeMsg *pReq) {
}
else
if
(
alterReq
.
alterType
==
TSDB_ALTER_USER_ADD_READ_DB
)
{
if
(
pDb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DB_NOT_EXIST
;
goto
ALTER_USER
_OVER
;
goto
_OVER
;
}
if
(
taosHashPut
(
newUser
.
readDbs
,
alterReq
.
dbname
,
len
,
alterReq
.
dbname
,
TSDB_DB_FNAME_LEN
)
!=
0
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
ALTER_USER
_OVER
;
goto
_OVER
;
}
}
else
if
(
alterReq
.
alterType
==
TSDB_ALTER_USER_REMOVE_READ_DB
)
{
if
(
taosHashRemove
(
newUser
.
readDbs
,
alterReq
.
dbname
,
len
)
!=
0
)
{
terrno
=
TSDB_CODE_MND_DB_NOT_EXIST
;
goto
ALTER_USER
_OVER
;
goto
_OVER
;
}
}
else
if
(
alterReq
.
alterType
==
TSDB_ALTER_USER_CLEAR_READ_DB
)
{
taosHashClear
(
newUser
.
readDbs
);
}
else
if
(
alterReq
.
alterType
==
TSDB_ALTER_USER_ADD_WRITE_DB
)
{
if
(
pDb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DB_NOT_EXIST
;
goto
ALTER_USER
_OVER
;
goto
_OVER
;
}
if
(
taosHashPut
(
newUser
.
writeDbs
,
alterReq
.
dbname
,
len
,
alterReq
.
dbname
,
TSDB_DB_FNAME_LEN
)
!=
0
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
ALTER_USER
_OVER
;
goto
_OVER
;
}
}
else
if
(
alterReq
.
alterType
==
TSDB_ALTER_USER_REMOVE_WRITE_DB
)
{
if
(
taosHashRemove
(
newUser
.
writeDbs
,
alterReq
.
dbname
,
len
)
!=
0
)
{
terrno
=
TSDB_CODE_MND_DB_NOT_EXIST
;
goto
ALTER_USER
_OVER
;
goto
_OVER
;
}
}
else
if
(
alterReq
.
alterType
==
TSDB_ALTER_USER_CLEAR_WRITE_DB
)
{
taosHashClear
(
newUser
.
writeDbs
);
}
else
{
terrno
=
TSDB_CODE_MND_INVALID_ALTER_OPER
;
goto
ALTER_USER
_OVER
;
goto
_OVER
;
}
newUser
.
updateTime
=
taosGetTimestampMs
();
if
(
mndCheckAlterUserAuth
(
pOperUser
,
pUser
,
pDb
,
&
alterReq
)
!=
0
)
{
goto
ALTER_USER
_OVER
;
goto
_OVER
;
}
code
=
mndUpdateUser
(
pMnode
,
pUser
,
&
newUser
,
pReq
);
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
ALTER_USER
_OVER:
_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"user:%s, failed to alter since %s"
,
alterReq
.
user
,
terrstr
());
}
...
...
@@ -537,36 +536,36 @@ static int32_t mndProcessDropUserReq(SNodeMsg *pReq) {
if
(
tDeserializeSDropUserReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
DROP_USER
_OVER
;
goto
_OVER
;
}
mDebug
(
"user:%s, start to drop"
,
dropReq
.
user
);
if
(
dropReq
.
user
[
0
]
==
0
)
{
terrno
=
TSDB_CODE_MND_INVALID_USER_FORMAT
;
goto
DROP_USER
_OVER
;
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
dropReq
.
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_USER_NOT_EXIST
;
goto
DROP_USER
_OVER
;
goto
_OVER
;
}
pOperUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pOperUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
DROP_USER
_OVER
;
goto
_OVER
;
}
if
(
mndCheckDropUserAuth
(
pOperUser
)
!=
0
)
{
goto
DROP_USER
_OVER
;
goto
_OVER
;
}
code
=
mndDropUser
(
pMnode
,
pReq
,
pUser
);
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
DROP_USER
_OVER:
_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"user:%s, failed to drop since %s"
,
dropReq
.
user
,
terrstr
());
}
...
...
@@ -586,7 +585,7 @@ static int32_t mndProcessGetUserAuthReq(SNodeMsg *pReq) {
if
(
tDeserializeSGetUserAuthReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
authReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
GET_AUTH
_OVER
;
goto
_OVER
;
}
mTrace
(
"user:%s, start to get auth"
,
authReq
.
user
);
...
...
@@ -594,7 +593,7 @@ static int32_t mndProcessGetUserAuthReq(SNodeMsg *pReq) {
pUser
=
mndAcquireUser
(
pMnode
,
authReq
.
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_USER_NOT_EXIST
;
goto
GET_AUTH
_OVER
;
goto
_OVER
;
}
memcpy
(
authRsp
.
user
,
pUser
->
user
,
TSDB_USER_LEN
);
...
...
@@ -622,7 +621,7 @@ static int32_t mndProcessGetUserAuthReq(SNodeMsg *pReq) {
void
*
pRsp
=
rpcMallocCont
(
contLen
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
GET_AUTH
_OVER
;
goto
_OVER
;
}
tSerializeSGetUserAuthRsp
(
pRsp
,
contLen
,
&
authRsp
);
...
...
@@ -631,7 +630,7 @@ static int32_t mndProcessGetUserAuthReq(SNodeMsg *pReq) {
pReq
->
rspLen
=
contLen
;
code
=
0
;
GET_AUTH
_OVER:
_OVER:
mndReleaseUser
(
pMnode
,
pUser
);
taosHashCleanup
(
authRsp
.
readDbs
);
taosHashCleanup
(
authRsp
.
writeDbs
);
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
0f7d9f3a
...
...
@@ -45,8 +45,8 @@ int32_t mndInitVgroup(SMnode *pMnode) {
.
encodeFp
=
(
SdbEncodeFp
)
mndVgroupActionEncode
,
.
decodeFp
=
(
SdbDecodeFp
)
mndVgroupActionDecode
,
.
insertFp
=
(
SdbInsertFp
)
mndVgroupActionInsert
,
.
updateFp
=
(
SdbUpdateFp
)
mndVgroupAction
Dele
te
,
.
deleteFp
=
(
SdbDeleteFp
)
mndVgroupAction
Upda
te
};
.
updateFp
=
(
SdbUpdateFp
)
mndVgroupAction
Upda
te
,
.
deleteFp
=
(
SdbDeleteFp
)
mndVgroupAction
Dele
te
};
mndSetMsgHandle
(
pMnode
,
TDMT_DND_CREATE_VNODE_RSP
,
mndProcessCreateVnodeRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_VND_ALTER_VNODE_RSP
,
mndProcessAlterVnodeRsp
);
...
...
source/dnode/mnode/sdb/inc/sdbInt.h
浏览文件 @
0f7d9f3a
...
...
@@ -19,10 +19,6 @@
#include "os.h"
#include "sdb.h"
#include "thash.h"
#include "tlockfree.h"
#include "tlog.h"
#include "tmsg.h"
#ifdef __cplusplus
extern
"C"
{
...
...
@@ -53,26 +49,6 @@ typedef struct SSdbRow {
char
pObj
[];
}
SSdbRow
;
typedef
struct
SSdb
{
SMnode
*
pMnode
;
char
*
currDir
;
char
*
syncDir
;
char
*
tmpDir
;
int64_t
lastCommitVer
;
int64_t
curVer
;
int64_t
tableVer
[
SDB_MAX
];
int64_t
maxId
[
SDB_MAX
];
EKeyType
keyTypes
[
SDB_MAX
];
SHashObj
*
hashObjs
[
SDB_MAX
];
SRWLatch
locks
[
SDB_MAX
];
SdbInsertFp
insertFps
[
SDB_MAX
];
SdbUpdateFp
updateFps
[
SDB_MAX
];
SdbDeleteFp
deleteFps
[
SDB_MAX
];
SdbDeployFp
deployFps
[
SDB_MAX
];
SdbEncodeFp
encodeFps
[
SDB_MAX
];
SdbDecodeFp
decodeFps
[
SDB_MAX
];
}
SSdb
;
const
char
*
sdbTableName
(
ESdbType
type
);
void
sdbPrintOper
(
SSdb
*
pSdb
,
SSdbRow
*
pRow
,
const
char
*
oper
);
...
...
source/dnode/mnode/sdb/src/sdb.c
浏览文件 @
0f7d9f3a
...
...
@@ -87,7 +87,7 @@ void sdbCleanup(SSdb *pSdb) {
SSdbRow
*
pRow
=
*
ppRow
;
if
(
pRow
==
NULL
)
continue
;
sdbFreeRow
(
pSdb
,
pRow
);
sdbFreeRow
(
pSdb
,
pRow
,
true
);
ppRow
=
taosHashIterate
(
hash
,
ppRow
);
}
}
...
...
source/dnode/mnode/sdb/src/sdbHash.c
浏览文件 @
0f7d9f3a
...
...
@@ -137,7 +137,7 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow *
SSdbRow
*
pOldRow
=
taosHashGet
(
hash
,
pRow
->
pObj
,
keySize
);
if
(
pOldRow
!=
NULL
)
{
taosWUnLockLatch
(
pLock
);
sdbFreeRow
(
pSdb
,
pRow
);
sdbFreeRow
(
pSdb
,
pRow
,
false
);
terrno
=
TSDB_CODE_SDB_OBJ_ALREADY_THERE
;
return
terrno
;
}
...
...
@@ -148,7 +148,7 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow *
if
(
taosHashPut
(
hash
,
pRow
->
pObj
,
keySize
,
&
pRow
,
sizeof
(
void
*
))
!=
0
)
{
taosWUnLockLatch
(
pLock
);
sdbFreeRow
(
pSdb
,
pRow
);
sdbFreeRow
(
pSdb
,
pRow
,
false
);
terrno
=
TSDB_CODE_SDB_OBJ_ALREADY_THERE
;
return
terrno
;
}
...
...
@@ -164,7 +164,7 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow *
taosWLockLatch
(
pLock
);
taosHashRemove
(
hash
,
pRow
->
pObj
,
keySize
);
taosWUnLockLatch
(
pLock
);
sdbFreeRow
(
pSdb
,
pRow
);
sdbFreeRow
(
pSdb
,
pRow
,
false
);
terrno
=
code
;
return
terrno
;
}
...
...
@@ -202,7 +202,7 @@ static int32_t sdbUpdateRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow *
code
=
(
*
updateFp
)(
pSdb
,
pOldRow
->
pObj
,
pNewRow
->
pObj
);
}
sdbFreeRow
(
pSdb
,
pNewRow
);
sdbFreeRow
(
pSdb
,
pNewRow
,
false
);
pSdb
->
tableVer
[
pOldRow
->
type
]
++
;
return
code
;
...
...
@@ -215,7 +215,7 @@ static int32_t sdbDeleteRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow *
SSdbRow
**
ppOldRow
=
taosHashGet
(
hash
,
pRow
->
pObj
,
keySize
);
if
(
ppOldRow
==
NULL
||
*
ppOldRow
==
NULL
)
{
taosWUnLockLatch
(
pLock
);
sdbFreeRow
(
pSdb
,
pRow
);
sdbFreeRow
(
pSdb
,
pRow
,
false
);
terrno
=
TSDB_CODE_SDB_OBJ_NOT_THERE
;
return
terrno
;
}
...
...
@@ -228,7 +228,7 @@ static int32_t sdbDeleteRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow *
taosWUnLockLatch
(
pLock
);
pSdb
->
tableVer
[
pOldRow
->
type
]
++
;
sdbFreeRow
(
pSdb
,
pRow
);
sdbFreeRow
(
pSdb
,
pRow
,
false
);
sdbCheck
(
pSdb
,
pOldRow
);
// sdbRelease(pSdb, pOldRow->pObj);
...
...
@@ -322,7 +322,7 @@ static void sdbCheck(SSdb *pSdb, SSdbRow *pRow) {
int32_t
ref
=
atomic_load_32
(
&
pRow
->
refCount
);
sdbPrintOper
(
pSdb
,
pRow
,
"check"
);
if
(
ref
<=
0
&&
pRow
->
status
==
SDB_STATUS_DROPPED
)
{
sdbFreeRow
(
pSdb
,
pRow
);
sdbFreeRow
(
pSdb
,
pRow
,
true
);
}
taosRUnLockLatch
(
pLock
);
...
...
@@ -340,7 +340,7 @@ void sdbRelease(SSdb *pSdb, void *pObj) {
int32_t
ref
=
atomic_sub_fetch_32
(
&
pRow
->
refCount
,
1
);
sdbPrintOper
(
pSdb
,
pRow
,
"release"
);
if
(
ref
<=
0
&&
pRow
->
status
==
SDB_STATUS_DROPPED
)
{
sdbFreeRow
(
pSdb
,
pRow
);
sdbFreeRow
(
pSdb
,
pRow
,
true
);
}
taosRUnLockLatch
(
pLock
);
...
...
source/dnode/mnode/sdb/src/sdbRaw.c
浏览文件 @
0f7d9f3a
...
...
@@ -107,7 +107,9 @@ int32_t sdbSetRawBinary(SSdbRaw *pRaw, int32_t dataPos, const char *pVal, int32_
return
-
1
;
}
memcpy
(
pRaw
->
pData
+
dataPos
,
pVal
,
valLen
);
if
(
pVal
!=
NULL
)
{
memcpy
(
pRaw
->
pData
+
dataPos
,
pVal
,
valLen
);
}
return
0
;
}
...
...
source/dnode/mnode/sdb/src/sdbRow.c
浏览文件 @
0f7d9f3a
...
...
@@ -36,11 +36,11 @@ void *sdbGetRowObj(SSdbRow *pRow) {
return
pRow
->
pObj
;
}
void
sdbFreeRow
(
SSdb
*
pSdb
,
SSdbRow
*
pRow
)
{
void
sdbFreeRow
(
SSdb
*
pSdb
,
SSdbRow
*
pRow
,
bool
callFunc
)
{
// remove attached object such as trans
SdbDeleteFp
deleteFp
=
pSdb
->
deleteFps
[
pRow
->
type
];
if
(
deleteFp
!=
NULL
)
{
(
*
deleteFp
)(
pSdb
,
pRow
->
pObj
);
(
*
deleteFp
)(
pSdb
,
pRow
->
pObj
,
callFunc
);
}
sdbPrintOper
(
pSdb
,
pRow
,
"free"
);
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
0f7d9f3a
...
...
@@ -1034,7 +1034,7 @@ void setInputDataBlock(SOperatorInfo* pOperator, SqlFunctionCtx* pCtx, SSDataBlo
}
}
static
int32_t
doCreateConstantValColumnInfo
(
SInputColumnInfoData
*
pInput
,
SFunctParam
*
pFuncParam
,
int32_t
type
,
static
int32_t
doCreateConstantValColumnInfo
(
SInputColumnInfoData
*
pInput
,
SFunctParam
*
pFuncParam
,
int32_t
paramIndex
,
int32_t
numOfRows
)
{
SColumnInfoData
*
pColInfo
=
NULL
;
if
(
pInput
->
pData
[
paramIndex
]
==
NULL
)
{
...
...
@@ -1044,17 +1044,17 @@ static int32_t doCreateConstantValColumnInfo(SInputColumnInfoData* pInput, SFunc
}
// Set the correct column info (data type and bytes)
pColInfo
->
info
.
type
=
t
ype
;
pColInfo
->
info
.
bytes
=
tDataTypes
[
type
].
bytes
;
pColInfo
->
info
.
type
=
pFuncParam
->
param
.
nT
ype
;
pColInfo
->
info
.
bytes
=
pFuncParam
->
param
.
nLen
;
pInput
->
pData
[
paramIndex
]
=
pColInfo
;
}
else
{
pColInfo
=
pInput
->
pData
[
paramIndex
];
}
ASSERT
(
!
IS_VAR_DATA_TYPE
(
type
));
colInfoDataEnsureCapacity
(
pColInfo
,
0
,
numOfRows
);
int8_t
type
=
pFuncParam
->
param
.
nType
;
if
(
type
==
TSDB_DATA_TYPE_BIGINT
||
type
==
TSDB_DATA_TYPE_UBIGINT
)
{
int64_t
v
=
pFuncParam
->
param
.
i
;
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
...
...
@@ -1065,6 +1065,12 @@ static int32_t doCreateConstantValColumnInfo(SInputColumnInfoData* pInput, SFunc
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
colDataAppendDouble
(
pColInfo
,
i
,
&
v
);
}
}
else
if
(
type
==
TSDB_DATA_TYPE_VARCHAR
)
{
char
*
tmp
=
taosMemoryMalloc
(
pFuncParam
->
param
.
nLen
+
VARSTR_HEADER_SIZE
);
STR_WITH_SIZE_TO_VARSTR
(
tmp
,
pFuncParam
->
param
.
pz
,
pFuncParam
->
param
.
nLen
);
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
colDataAppend
(
pColInfo
,
i
,
tmp
,
false
);
}
}
return
TSDB_CODE_SUCCESS
;
...
...
@@ -1104,7 +1110,7 @@ static int32_t doSetInputDataBlock(SOperatorInfo* pOperator, SqlFunctionCtx* pCt
pInput
->
numOfRows
=
pBlock
->
info
.
rows
;
pInput
->
startRowIndex
=
0
;
code
=
doCreateConstantValColumnInfo
(
pInput
,
pFuncParam
,
pFuncParam
->
param
.
nType
,
j
,
pBlock
->
info
.
rows
);
code
=
doCreateConstantValColumnInfo
(
pInput
,
pFuncParam
,
j
,
pBlock
->
info
.
rows
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -6684,18 +6690,32 @@ SArray* extractColumnInfo(SNodeList* pNodeList) {
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
STargetNode
*
pNode
=
(
STargetNode
*
)
nodesListGetNode
(
pNodeList
,
i
);
SColumnNode
*
pColNode
=
(
SColumnNode
*
)
pNode
->
pExpr
;
// todo extract method
SColumn
c
=
{
0
};
c
.
slotId
=
pColNode
->
slotId
;
c
.
colId
=
pColNode
->
colId
;
c
.
type
=
pColNode
->
node
.
resType
.
type
;
c
.
bytes
=
pColNode
->
node
.
resType
.
bytes
;
c
.
precision
=
pColNode
->
node
.
resType
.
precision
;
c
.
scale
=
pColNode
->
node
.
resType
.
scale
;
taosArrayPush
(
pList
,
&
c
);
if
(
nodeType
(
pNode
->
pExpr
)
==
QUERY_NODE_COLUMN
)
{
SColumnNode
*
pColNode
=
(
SColumnNode
*
)
pNode
->
pExpr
;
// todo extract method
SColumn
c
=
{
0
};
c
.
slotId
=
pColNode
->
slotId
;
c
.
colId
=
pColNode
->
colId
;
c
.
type
=
pColNode
->
node
.
resType
.
type
;
c
.
bytes
=
pColNode
->
node
.
resType
.
bytes
;
c
.
scale
=
pColNode
->
node
.
resType
.
scale
;
c
.
precision
=
pColNode
->
node
.
resType
.
precision
;
taosArrayPush
(
pList
,
&
c
);
}
else
if
(
nodeType
(
pNode
->
pExpr
)
==
QUERY_NODE_VALUE
)
{
SValueNode
*
pValNode
=
(
SValueNode
*
)
pNode
->
pExpr
;
SColumn
c
=
{
0
};
c
.
slotId
=
pNode
->
slotId
;
c
.
colId
=
pNode
->
slotId
;
c
.
type
=
pValNode
->
node
.
type
;
c
.
bytes
=
pValNode
->
node
.
resType
.
bytes
;
c
.
scale
=
pValNode
->
node
.
resType
.
scale
;
c
.
precision
=
pValNode
->
node
.
resType
.
precision
;
taosArrayPush
(
pList
,
&
c
);
}
}
return
pList
;
...
...
source/libs/function/src/tudf.c
浏览文件 @
0f7d9f3a
...
...
@@ -213,7 +213,7 @@ enum {
int32_t
getUdfdPipeName
(
char
*
pipeName
,
int32_t
size
)
{
char
dnodeId
[
8
]
=
{
0
};
size_t
dnodeIdSize
;
size_t
dnodeIdSize
=
sizeof
(
dnodeId
)
;
int32_t
err
=
uv_os_getenv
(
UDF_DNODE_ID_ENV_NAME
,
dnodeId
,
&
dnodeIdSize
);
if
(
err
!=
0
)
{
dnodeId
[
0
]
=
'1'
;
...
...
source/util/src/tconfig.c
浏览文件 @
0f7d9f3a
...
...
@@ -823,7 +823,7 @@ int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) {
}
p
++
;
if
(
mem
cmp
(
url
,
"jsonFile"
,
8
)
==
0
)
{
if
(
strn
cmp
(
url
,
"jsonFile"
,
8
)
==
0
)
{
char
*
filepath
=
p
;
if
(
!
taosCheckExistFile
(
filepath
))
{
uError
(
"fial to load json file: %s"
,
filepath
);
...
...
@@ -893,8 +893,8 @@ int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) {
}
tjsonDelete
(
pJson
);
// } else if (
mem
cmp(url, "jsonUrl", 7) == 0) {
// } else if (
mem
cmp(url, "etcdUrl", 7) == 0) {
// } else if (
strn
cmp(url, "jsonUrl", 7) == 0) {
// } else if (
strn
cmp(url, "etcdUrl", 7) == 0) {
}
else
{
uError
(
"Unsupported url: %s"
,
url
);
return
-
1
;
...
...
@@ -908,7 +908,7 @@ int32_t cfgGetApollUrl(const char **envCmd, const char *envFile, char* apolloUrl
int32_t
index
=
0
;
if
(
envCmd
==
NULL
)
return
0
;
while
(
envCmd
[
index
]
!=
NULL
)
{
if
(
mem
cmp
(
envCmd
[
index
],
"TAOS_APOLLO_URL"
,
14
)
==
0
)
{
if
(
strn
cmp
(
envCmd
[
index
],
"TAOS_APOLLO_URL"
,
14
)
==
0
)
{
char
*
p
=
strchr
(
envCmd
[
index
],
'='
);
if
(
p
!=
NULL
)
{
p
++
;
...
...
@@ -934,7 +934,7 @@ int32_t cfgGetApollUrl(const char **envCmd, const char *envFile, char* apolloUrl
break
;
}
if
(
line
[
_bytes
-
1
]
==
'\n'
)
line
[
_bytes
-
1
]
=
0
;
if
(
mem
cmp
(
line
,
"TAOS_APOLLO_URL"
,
14
)
==
0
)
{
if
(
strn
cmp
(
line
,
"TAOS_APOLLO_URL"
,
14
)
==
0
)
{
char
*
p
=
strchr
(
line
,
'='
);
if
(
p
!=
NULL
)
{
p
++
;
...
...
@@ -975,7 +975,7 @@ int32_t cfgGetApollUrl(const char **envCmd, const char *envFile, char* apolloUrl
break
;
}
if
(
line
[
_bytes
-
1
]
==
'\n'
)
line
[
_bytes
-
1
]
=
0
;
if
(
mem
cmp
(
line
,
"TAOS_APOLLO_URL"
,
14
)
==
0
)
{
if
(
strn
cmp
(
line
,
"TAOS_APOLLO_URL"
,
14
)
==
0
)
{
char
*
p
=
strchr
(
line
,
'='
);
if
(
p
!=
NULL
)
{
p
++
;
...
...
tests/pytest/util/dnodes.py
浏览文件 @
0f7d9f3a
...
...
@@ -63,7 +63,7 @@ class TDSimClient:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
def
deploy
(
self
):
def
deploy
(
self
,
*
updatecfgDict
):
self
.
logDir
=
"%s/sim/psim/log"
%
(
self
.
path
)
self
.
cfgDir
=
"%s/sim/psim/cfg"
%
(
self
.
path
)
self
.
cfgPath
=
"%s/sim/psim/cfg/taos.cfg"
%
(
self
.
path
)
...
...
@@ -95,6 +95,14 @@ class TDSimClient:
for
key
,
value
in
self
.
cfgDict
.
items
():
self
.
cfg
(
key
,
value
)
try
:
if
bool
(
updatecfgDict
)
and
updatecfgDict
[
0
]
and
updatecfgDict
[
0
][
0
]:
clientCfg
=
dict
(
updatecfgDict
[
0
][
0
].
get
(
'clientCfg'
))
for
key
,
value
in
clientCfg
.
items
():
self
.
cfg
(
key
,
value
)
except
Exception
:
pass
tdLog
.
debug
(
"psim is deployed and configured by %s"
%
(
self
.
cfgPath
))
...
...
@@ -214,9 +222,11 @@ class TDDnode:
# self.cfg("logDir",self.logDir)
# print(updatecfgDict)
isFirstDir
=
1
if
updatecfgDict
[
0
]
and
updatecfgDict
[
0
][
0
]:
if
bool
(
updatecfgDict
)
and
updatecfgDict
[
0
]
and
updatecfgDict
[
0
][
0
]:
print
(
updatecfgDict
[
0
][
0
])
for
key
,
value
in
updatecfgDict
[
0
][
0
].
items
():
if
key
==
"clientCfg"
:
continue
if
value
==
'dataDir'
:
if
isFirstDir
:
self
.
cfgDict
.
pop
(
'dataDir'
)
...
...
@@ -491,7 +501,7 @@ class TDDnodes:
self
.
sim
.
setTestCluster
(
self
.
testCluster
)
if
(
self
.
simDeployed
==
False
):
self
.
sim
.
deploy
()
self
.
sim
.
deploy
(
updatecfgDict
)
self
.
simDeployed
=
True
self
.
check
(
index
)
...
...
tests/script/jenkins/basic.txt
浏览文件 @
0f7d9f3a
...
...
@@ -6,7 +6,7 @@
# ---- db
./test.sh -f tsim/db/create_all_options.sim
#
./test.sh -f tsim/db/alter_option.sim
./test.sh -f tsim/db/alter_option.sim
./test.sh -f tsim/db/basic1.sim
./test.sh -f tsim/db/basic2.sim
./test.sh -f tsim/db/basic3.sim
...
...
@@ -87,6 +87,6 @@
# ./test.sh -f tsim/sma/tsmaCreateInsertData.sim
# --- valgrind
#
./test.sh -f tsim/valgrind/checkError.sim -v
./test.sh -f tsim/valgrind/checkError.sim -v
#======================b1-end===============
tests/script/tsim/db/alter_option.sim
浏览文件 @
0f7d9f3a
...
...
@@ -66,7 +66,7 @@ print ============= create database
# | REPLICA value [1 | 3]
# | WAL value [1 | 2]
sql create database db BLOCKS 7 CACHE 3 CACHELAST 3 COMP 0 DAYS 345600 FSYNC 1000 MAXROWS 8000 MINROWS 10 KEEP 1440000 PRECISION 'ns' REPLICA
3
TTL 7 WAL 2 VGROUPS 6 SINGLE_STABLE 1 STREAM_MODE 1
sql create database db BLOCKS 7 CACHE 3 CACHELAST 3 COMP 0 DAYS 345600 FSYNC 1000 MAXROWS 8000 MINROWS 10 KEEP 1440000 PRECISION 'ns' REPLICA
1
TTL 7 WAL 2 VGROUPS 6 SINGLE_STABLE 1 STREAM_MODE 1
sql show databases
print rows: $rows
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
...
...
@@ -86,7 +86,7 @@ endi
if $data3_db != 0 then # ntables
return -1
endi
if $data4_db !=
3
then # replica
if $data4_db !=
1
then # replica
return -1
endi
if $data5_db != nostrict then # strict
...
...
@@ -127,47 +127,47 @@ if $data16_db != ns then # precision
endi
sleep 3000
sql show db.vgroups
if $data[0][4] == LEADER then
if $data[0][6] != FOLLOWER then
return -1
endi
if $data[0][8] != FOLLOWER then
return -1
endi
endi
if $data[0][6] == LEADER then
if $data[0][4] != FOLLOWER then
return -1
endi
if $data[0][8] != FOLLOWER then
return -1
endi
endi
if $data[0][8] == LEADER then
if $data[0][4] != FOLLOWER then
return -1
endi
if $data[0][6] != FOLLOWER then
return -1
endi
endi
if $data[0][4] != LEADER then
if $data[0][4] != FOLLOWER then
return -1
endi
endi
if $data[0][6] != LEADER then
if $data[0][6] != FOLLOWER then
return -1
endi
endi
if $data[0][8] != LEADER then
if $data[0][8] != FOLLOWER then
return -1
endi
endi
#
sql show db.vgroups
#
if $data[0][4] == LEADER then
#
if $data[0][6] != FOLLOWER then
#
return -1
#
endi
#
if $data[0][8] != FOLLOWER then
#
return -1
#
endi
#
endi
#
if $data[0][6] == LEADER then
#
if $data[0][4] != FOLLOWER then
#
return -1
#
endi
#
if $data[0][8] != FOLLOWER then
#
return -1
#
endi
#
endi
#
if $data[0][8] == LEADER then
#
if $data[0][4] != FOLLOWER then
#
return -1
#
endi
#
if $data[0][6] != FOLLOWER then
#
return -1
#
endi
#
endi
#
#
if $data[0][4] != LEADER then
#
if $data[0][4] != FOLLOWER then
#
return -1
#
endi
#
endi
#
if $data[0][6] != LEADER then
#
if $data[0][6] != FOLLOWER then
#
return -1
#
endi
#
endi
#
if $data[0][8] != LEADER then
#
if $data[0][8] != FOLLOWER then
#
return -1
#
endi
#
endi
print ============== not support modify options: name, create_time, vgroups, ntables
sql_error alter database db name dba
...
...
tools/shell/src/shellMain.c
浏览文件 @
0f7d9f3a
...
...
@@ -42,6 +42,8 @@ int main(int argc, char *argv[]) {
return
0
;
}
taos_init
();
if
(
shell
.
args
.
is_dump_config
)
{
shellDumpConfig
();
taos_cleanup
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录