Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
KASAKI11
TDengine
提交
c3e3875b
T
TDengine
项目概览
KASAKI11
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c3e3875b
编写于
7月 16, 2020
作者:
P
Ping Xiao
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into null_value_query_test
上级
66bb6617
5931be60
变更
43
隐藏空白更改
内联
并排
Showing
43 changed file
with
501 addition
and
201 deletion
+501
-201
importSampleData/bin/taosimport
importSampleData/bin/taosimport
+0
-0
src/client/inc/tscLog.h
src/client/inc/tscLog.h
+5
-5
src/client/src/TSDBJNIConnector.c
src/client/src/TSDBJNIConnector.c
+4
-4
src/client/src/tscAsync.c
src/client/src/tscAsync.c
+19
-1
src/client/src/tscServer.c
src/client/src/tscServer.c
+40
-31
src/client/src/tscSql.c
src/client/src/tscSql.c
+21
-1
src/common/inc/tulog.h
src/common/inc/tulog.h
+6
-6
src/common/src/tglobal.c
src/common/src/tglobal.c
+3
-3
src/connector/jdbc/src/test/java/com/taosdata/jdbc/BatchInsertTest.java
...jdbc/src/test/java/com/taosdata/jdbc/BatchInsertTest.java
+123
-0
src/dnode/inc/dnodeInt.h
src/dnode/inc/dnodeInt.h
+4
-4
src/dnode/src/dnodeMgmt.c
src/dnode/src/dnodeMgmt.c
+27
-4
src/dnode/src/dnodePeer.c
src/dnode/src/dnodePeer.c
+1
-0
src/dnode/src/dnodeSystem.c
src/dnode/src/dnodeSystem.c
+1
-1
src/inc/taos.h
src/inc/taos.h
+3
-0
src/inc/taosmsg.h
src/inc/taosmsg.h
+2
-2
src/mnode/inc/mnodeInt.h
src/mnode/inc/mnodeInt.h
+8
-8
src/mnode/inc/mnodeVgroup.h
src/mnode/inc/mnodeVgroup.h
+1
-1
src/mnode/src/mnodeDb.c
src/mnode/src/mnodeDb.c
+1
-1
src/mnode/src/mnodeVgroup.c
src/mnode/src/mnodeVgroup.c
+61
-11
src/plugins/http/inc/httpLog.h
src/plugins/http/inc/httpLog.h
+5
-5
src/plugins/monitor/src/monitorMain.c
src/plugins/monitor/src/monitorMain.c
+4
-4
src/plugins/mqtt/inc/mqttLog.h
src/plugins/mqtt/inc/mqttLog.h
+4
-4
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+1
-1
src/query/inc/queryLog.h
src/query/inc/queryLog.h
+4
-4
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+2
-1
src/rpc/inc/rpcLog.h
src/rpc/inc/rpcLog.h
+4
-4
src/tsdb/inc/tsdbMain.h
src/tsdb/inc/tsdbMain.h
+5
-6
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+2
-0
src/util/inc/tcache.h
src/util/inc/tcache.h
+1
-1
src/util/inc/tlockfree.h
src/util/inc/tlockfree.h
+52
-4
src/util/inc/trwlatch.h
src/util/inc/trwlatch.h
+0
-36
src/util/src/tlockfree.c
src/util/src/tlockfree.c
+1
-2
src/util/src/ttimer.c
src/util/src/ttimer.c
+4
-4
src/vnode/inc/vnodeInt.h
src/vnode/inc/vnodeInt.h
+4
-4
src/wal/src/walMain.c
src/wal/src/walMain.c
+4
-4
tests/pytest/crash_gen.py
tests/pytest/crash_gen.py
+7
-1
tests/pytest/query/queryNullValueTest.py
tests/pytest/query/queryNullValueTest.py
+40
-1
tests/pytest/util/dnodes-no-random-fail.py
tests/pytest/util/dnodes-no-random-fail.py
+2
-1
tests/pytest/util/dnodes-random-fail.py
tests/pytest/util/dnodes-random-fail.py
+2
-1
tests/pytest/util/dnodes.py
tests/pytest/util/dnodes.py
+2
-1
tests/script/sh/deploy.sh
tests/script/sh/deploy.sh
+15
-15
tests/script/tmp/prepare.sim
tests/script/tmp/prepare.sim
+2
-10
tests/tsim/inc/sim.h
tests/tsim/inc/sim.h
+4
-4
未找到文件。
importSampleData/bin/taosimport
已删除
100755 → 0
浏览文件 @
66bb6617
文件已删除
src/client/inc/tscLog.h
浏览文件 @
c3e3875b
...
...
@@ -27,11 +27,11 @@ extern int32_t tscEmbedded;
#define tscFatal(...) { if (cDebugFlag & DEBUG_FATAL) { taosPrintLog("TSC FATAL ", tscEmbedded ? 255 : cDebugFlag, __VA_ARGS__); }}
#define tscError(...) { if (cDebugFlag & DEBUG_ERROR) { taosPrintLog("TSC ERROR ", tscEmbedded ? 255 : cDebugFlag, __VA_ARGS__); }}
#define tscWarn(...) { if (cDebugFlag & DEBUG_WARN) { taosPrintLog("TSC WARN
", tscEmbedded ? 255 : cDebugFlag, __VA_ARGS__); }}
#define tscInfo(...) { if (cDebugFlag & DEBUG_INFO) { taosPrintLog("TSC
INFO
", tscEmbedded ? 255 : cDebugFlag, __VA_ARGS__); }}
#define tscDebug(...) { if (cDebugFlag & DEBUG_DEBUG) { taosPrintLog("TSC
DEBUG
", cDebugFlag, __VA_ARGS__); }}
#define tscTrace(...) { if (cDebugFlag & DEBUG_TRACE) { taosPrintLog("TSC
TRACE
", cDebugFlag, __VA_ARGS__); }}
#define tscDebugL(...){ if (cDebugFlag & DEBUG_DEBUG) { taosPrintLongString("TSC
DEBUG
", cDebugFlag, __VA_ARGS__); }}
#define tscWarn(...) { if (cDebugFlag & DEBUG_WARN) { taosPrintLog("TSC WARN ", tscEmbedded ? 255 : cDebugFlag, __VA_ARGS__); }}
#define tscInfo(...) { if (cDebugFlag & DEBUG_INFO) { taosPrintLog("TSC ", tscEmbedded ? 255 : cDebugFlag, __VA_ARGS__); }}
#define tscDebug(...) { if (cDebugFlag & DEBUG_DEBUG) { taosPrintLog("TSC ", cDebugFlag, __VA_ARGS__); }}
#define tscTrace(...) { if (cDebugFlag & DEBUG_TRACE) { taosPrintLog("TSC ", cDebugFlag, __VA_ARGS__); }}
#define tscDebugL(...){ if (cDebugFlag & DEBUG_DEBUG) { taosPrintLongString("TSC ", cDebugFlag, __VA_ARGS__); }}
#ifdef __cplusplus
}
...
...
src/client/src/TSDBJNIConnector.c
浏览文件 @
c3e3875b
...
...
@@ -24,10 +24,10 @@
#define jniFatal(...) { if (jniDebugFlag & DEBUG_FATAL) { taosPrintLog("JNI FATAL ", tscEmbedded ? 255 : jniDebugFlag, __VA_ARGS__); }}
#define jniError(...) { if (jniDebugFlag & DEBUG_ERROR) { taosPrintLog("JNI ERROR ", tscEmbedded ? 255 : jniDebugFlag, __VA_ARGS__); }}
#define jniWarn(...) { if (jniDebugFlag & DEBUG_WARN) { taosPrintLog("JNI WARN
", tscEmbedded ? 255 : jniDebugFlag, __VA_ARGS__); }}
#define jniInfo(...) { if (jniDebugFlag & DEBUG_INFO) { taosPrintLog("JNI
INFO
", tscEmbedded ? 255 : jniDebugFlag, __VA_ARGS__); }}
#define jniDebug(...) { if (jniDebugFlag & DEBUG_DEBUG) { taosPrintLog("JNI
DEBUG
", jniDebugFlag, __VA_ARGS__); }}
#define jniTrace(...) { if (jniDebugFlag & DEBUG_TRACE) { taosPrintLog("JNI
TRACE
", jniDebugFlag, __VA_ARGS__); }}
#define jniWarn(...) { if (jniDebugFlag & DEBUG_WARN) { taosPrintLog("JNI WARN ", tscEmbedded ? 255 : jniDebugFlag, __VA_ARGS__); }}
#define jniInfo(...) { if (jniDebugFlag & DEBUG_INFO) { taosPrintLog("JNI ", tscEmbedded ? 255 : jniDebugFlag, __VA_ARGS__); }}
#define jniDebug(...) { if (jniDebugFlag & DEBUG_DEBUG) { taosPrintLog("JNI ", jniDebugFlag, __VA_ARGS__); }}
#define jniTrace(...) { if (jniDebugFlag & DEBUG_TRACE) { taosPrintLog("JNI ", jniDebugFlag, __VA_ARGS__); }}
int
__init
=
0
;
...
...
src/client/src/tscAsync.c
浏览文件 @
c3e3875b
...
...
@@ -478,6 +478,8 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
tscDebug
(
"%p redo parse sql string to build submit block"
,
pSql
);
pCmd
->
parseFinished
=
false
;
tscResetSqlCmdObj
(
pCmd
);
code
=
tsParseSql
(
pSql
,
true
);
if
(
code
==
TSDB_CODE_TSC_ACTION_IN_PROGRESS
)
{
...
...
@@ -492,7 +494,23 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
*/
pSql
->
fp
=
pSql
->
fetchFp
;
// restore the fp
tscHandleInsertRetry
(
pSql
);
}
else
{
// in case of other query type, continue
}
else
if
(
pCmd
->
command
==
TSDB_SQL_SELECT
)
{
// in case of other query type, continue
tscDebug
(
"%p redo parse sql string and proceed"
,
pSql
);
//tscDebug("before %p fp:%p, fetchFp:%p", pSql, pSql->fp, pSql->fetchFp);
pCmd
->
parseFinished
=
false
;
tscResetSqlCmdObj
(
pCmd
);
//tscDebug("after %p fp:%p, fetchFp:%p", pSql, pSql->fp, pSql->fetchFp);
code
=
tsParseSql
(
pSql
,
true
);
if
(
code
==
TSDB_CODE_TSC_ACTION_IN_PROGRESS
)
{
return
;
}
else
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
tscProcessSql
(
pSql
);
}
else
{
// in all other cases, simple retry
tscProcessSql
(
pSql
);
}
...
...
src/client/src/tscServer.c
浏览文件 @
c3e3875b
...
...
@@ -246,43 +246,52 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) {
rpcMsg
->
code
=
TSDB_CODE_RPC_NETWORK_UNAVAIL
;
}
else
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
if
(
rpcMsg
->
code
==
TSDB_CODE_TDB_INVALID_TABLE_ID
||
rpcMsg
->
code
==
TSDB_CODE_VND_INVALID_VGROUP_ID
||
rpcMsg
->
code
==
TSDB_CODE_RPC_NETWORK_UNAVAIL
||
rpcMsg
->
code
==
TSDB_CODE_TDB_TABLE_RECONFIGURE
)
{
if
(
pCmd
->
command
==
TSDB_SQL_CONNECT
)
{
rpcMsg
->
code
=
TSDB_CODE_RPC_NETWORK_UNAVAIL
;
rpcFreeCont
(
rpcMsg
->
pCont
);
return
;
}
else
if
(
pCmd
->
command
==
TSDB_SQL_HB
)
{
rpcMsg
->
code
=
TSDB_CODE_RPC_NOT_READY
;
rpcFreeCont
(
rpcMsg
->
pCont
);
return
;
}
else
if
(
pCmd
->
command
==
TSDB_SQL_META
)
{
// get table meta query will not retry, do nothing
}
else
{
tscWarn
(
"%p it shall renew table meta, code:%s, retry:%d"
,
pSql
,
tstrerror
(
rpcMsg
->
code
),
++
pSql
->
retry
);
// if (rpcMsg->code != TSDB_CODE_RPC_NETWORK_UNAVAIL) {
// if (pCmd->command == TSDB_SQL_CONNECT) {
// rpcMsg->code = TSDB_CODE_RPC_NETWORK_UNAVAIL;
// rpcFreeCont(rpcMsg->pCont);
// return;
// }
// if (pCmd->command == TSDB_SQL_HB) {
// rpcMsg->code = TSDB_CODE_RPC_NOT_READY;
// rpcFreeCont(rpcMsg->pCont);
// return;
// }
// if (pCmd->command == TSDB_SQL_META || pCmd->command == TSDB_SQL_DESCRIBE_TABLE ||
// pCmd->command == TSDB_SQL_STABLEVGROUP || pCmd->command == TSDB_SQL_SHOW ||
// pCmd->command == TSDB_SQL_RETRIEVE) {
// // get table meta/vgroup query will not retry, do nothing
// }
// }
if
((
pCmd
->
command
==
TSDB_SQL_SELECT
||
pCmd
->
command
==
TSDB_SQL_FETCH
||
pCmd
->
command
==
TSDB_SQL_INSERT
||
pCmd
->
command
==
TSDB_SQL_UPDATE_TAGS_VAL
)
&&
(
rpcMsg
->
code
==
TSDB_CODE_TDB_INVALID_TABLE_ID
||
rpcMsg
->
code
==
TSDB_CODE_VND_INVALID_VGROUP_ID
||
rpcMsg
->
code
==
TSDB_CODE_RPC_NETWORK_UNAVAIL
||
rpcMsg
->
code
==
TSDB_CODE_TDB_TABLE_RECONFIGURE
))
{
tscWarn
(
"%p it shall renew table meta, code:%s, retry:%d"
,
pSql
,
tstrerror
(
rpcMsg
->
code
),
++
pSql
->
retry
);
// set the flag to denote that sql string needs to be re-parsed and build submit block with table schema
if
(
rpcMsg
->
code
==
TSDB_CODE_TDB_TABLE_RECONFIGURE
)
{
pSql
->
cmd
.
submitSchema
=
1
;
}
// set the flag to denote that sql string needs to be re-parsed and build submit block with table schema
if
(
rpcMsg
->
code
==
TSDB_CODE_TDB_TABLE_RECONFIGURE
)
{
pSql
->
cmd
.
submitSchema
=
1
;
}
pSql
->
res
.
code
=
rpcMsg
->
code
;
// keep the previous error code
if
(
pSql
->
retry
>
pSql
->
maxRetry
)
{
tscError
(
"%p max retry %d reached, give up"
,
pSql
,
pSql
->
maxRetry
);
}
else
{
rpcMsg
->
code
=
tscRenewTableMeta
(
pSql
,
pTableMetaInfo
->
name
);
pSql
->
res
.
code
=
rpcMsg
->
code
;
// keep the previous error code
if
(
pSql
->
retry
>
pSql
->
maxRetry
)
{
tscError
(
"%p max retry %d reached, give up"
,
pSql
,
pSql
->
maxRetry
);
}
else
{
rpcMsg
->
code
=
tscRenewTableMeta
(
pSql
,
pTableMetaInfo
->
name
);
// if there is an error occurring, proceed to the following error handling procedure.
// todo add test cases
if
(
rpcMsg
->
code
==
TSDB_CODE_TSC_ACTION_IN_PROGRESS
)
{
rpcFreeCont
(
rpcMsg
->
pCont
);
return
;
}
// if there is an error occurring, proceed to the following error handling procedure.
// todo add test cases
if
(
rpcMsg
->
code
==
TSDB_CODE_TSC_ACTION_IN_PROGRESS
)
{
rpcFreeCont
(
rpcMsg
->
pCont
);
return
;
}
}
}
}
pRes
->
rspLen
=
0
;
if
(
pRes
->
code
!=
TSDB_CODE_TSC_QUERY_CANCELLED
)
{
...
...
src/client/src/tscSql.c
浏览文件 @
c3e3875b
...
...
@@ -181,6 +181,19 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha
return
NULL
;
}
TAOS
*
taos_connect_c
(
const
char
*
ip
,
uint8_t
ipLen
,
const
char
*
user
,
uint8_t
userLen
,
const
char
*
pass
,
uint8_t
passLen
,
const
char
*
db
,
uint8_t
dbLen
,
uint16_t
port
)
{
char
ipBuf
[
TSDB_EP_LEN
]
=
{
0
};
char
userBuf
[
TSDB_USER_LEN
]
=
{
0
};
char
passBuf
[
TSDB_PASSWORD_LEN
]
=
{
0
};
char
dbBuf
[
TSDB_DB_NAME_LEN
]
=
{
0
};
strncpy
(
ipBuf
,
ip
,
MIN
(
TSDB_EP_LEN
-
1
,
ipLen
));
strncpy
(
userBuf
,
user
,
MIN
(
TSDB_USER_LEN
-
1
,
userLen
));
strncpy
(
passBuf
,
pass
,
MIN
(
TSDB_PASSWORD_LEN
-
1
,
passLen
));
strncpy
(
dbBuf
,
db
,
MIN
(
TSDB_DB_NAME_LEN
-
1
,
dbLen
));
return
taos_connect
(
ipBuf
,
userBuf
,
passBuf
,
dbBuf
,
port
);
}
TAOS
*
taos_connect_a
(
char
*
ip
,
char
*
user
,
char
*
pass
,
char
*
db
,
uint16_t
port
,
void
(
*
fp
)(
void
*
,
TAOS_RES
*
,
int
),
void
*
param
,
void
**
taos
)
{
...
...
@@ -249,7 +262,14 @@ TAOS_RES* taos_query(TAOS *taos, const char *sqlstr) {
tsem_wait
(
&
pSql
->
rspSem
);
return
pSql
;
}
TAOS_RES
*
taos_query_c
(
TAOS
*
taos
,
const
char
*
sqlstr
,
uint32_t
sqlLen
)
{
char
*
buf
=
malloc
(
sqlLen
+
1
);
buf
[
sqlLen
]
=
0
;
strncpy
(
buf
,
sqlstr
,
sqlLen
);
TAOS_RES
*
res
=
taos_query
(
taos
,
buf
);
free
(
buf
);
return
res
;
}
int
taos_result_precision
(
TAOS_RES
*
res
)
{
SSqlObj
*
pSql
=
(
SSqlObj
*
)
res
;
if
(
pSql
==
NULL
||
pSql
->
signature
!=
pSql
)
return
0
;
...
...
src/common/inc/tulog.h
浏览文件 @
c3e3875b
...
...
@@ -25,15 +25,15 @@ extern "C" {
extern
int32_t
uDebugFlag
;
extern
int32_t
tscEmbedded
;
#define uFatal(...) { if (uDebugFlag & DEBUG_FATAL) { taosPrintLog("UTL FATAL
", tscEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
#define uFatal(...) { if (uDebugFlag & DEBUG_FATAL) { taosPrintLog("UTL FATAL", tscEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
#define uError(...) { if (uDebugFlag & DEBUG_ERROR) { taosPrintLog("UTL ERROR ", tscEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
#define uWarn(...) { if (uDebugFlag & DEBUG_WARN) { taosPrintLog("UTL WARN
", tscEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
#define uInfo(...) { if (uDebugFlag & DEBUG_INFO) { taosPrintLog("UTL
INFO
", tscEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
#define uDebug(...) { if (uDebugFlag & DEBUG_DEBUG) { taosPrintLog("UTL
DEBUG
", uDebugFlag, __VA_ARGS__); }}
#define uTrace(...) { if (uDebugFlag & DEBUG_TRACE) { taosPrintLog("UTL
TRACE
", uDebugFlag, __VA_ARGS__); }}
#define uWarn(...) { if (uDebugFlag & DEBUG_WARN) { taosPrintLog("UTL WARN ", tscEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
#define uInfo(...) { if (uDebugFlag & DEBUG_INFO) { taosPrintLog("UTL ", tscEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
#define uDebug(...) { if (uDebugFlag & DEBUG_DEBUG) { taosPrintLog("UTL ", uDebugFlag, __VA_ARGS__); }}
#define uTrace(...) { if (uDebugFlag & DEBUG_TRACE) { taosPrintLog("UTL ", uDebugFlag, __VA_ARGS__); }}
#define pError(...) { taosPrintLog("APP ERROR ", 255, __VA_ARGS__); }
#define pPrint(...) { taosPrintLog("APP
INFO
", 255, __VA_ARGS__); }
#define pPrint(...) { taosPrintLog("APP ", 255, __VA_ARGS__); }
#ifdef __cplusplus
}
...
...
src/common/src/tglobal.c
浏览文件 @
c3e3875b
...
...
@@ -194,7 +194,7 @@ int32_t monitorDebugFlag = 131;
int32_t
qDebugFlag
=
131
;
int32_t
rpcDebugFlag
=
131
;
int32_t
uDebugFlag
=
131
;
int32_t
debugFlag
=
131
;
int32_t
debugFlag
=
0
;
int32_t
sDebugFlag
=
135
;
int32_t
wDebugFlag
=
135
;
int32_t
tsdbDebugFlag
=
131
;
...
...
@@ -202,7 +202,7 @@ int32_t tsdbDebugFlag = 131;
static
pthread_once_t
tsInitGlobalCfgOnce
=
PTHREAD_ONCE_INIT
;
void
taosSetAllDebugFlag
()
{
for
(
int32_t
i
=
0
;
i
<
tsGlobalConfigNum
;
++
i
)
{
if
(
debugFlag
!=
0
)
{
mDebugFlag
=
debugFlag
;
sdbDebugFlag
=
debugFlag
;
dDebugFlag
=
debugFlag
;
...
...
@@ -219,8 +219,8 @@ void taosSetAllDebugFlag() {
wDebugFlag
=
debugFlag
;
tsdbDebugFlag
=
debugFlag
;
qDebugFlag
=
debugFlag
;
uInfo
(
"all debug flag are set to %d"
,
debugFlag
);
}
uInfo
(
"all debug flag are set to %d"
,
debugFlag
);
}
bool
taosCfgDynamicOptions
(
char
*
msg
)
{
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/BatchInsertTest.java
0 → 100644
浏览文件 @
c3e3875b
package
com.taosdata.jdbc
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Test
;
import
java.sql.*
;
import
java.util.Properties
;
import
java.util.Random
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
java.util.Properties
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.*
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
public
class
BatchInsertTest
extends
BaseTest
{
static
Connection
connection
=
null
;
static
Statement
statement
=
null
;
static
String
dbName
=
"test"
;
static
String
stbName
=
"meters"
;
static
String
host
=
"localhost"
;
static
int
numOfTables
=
30
;
final
static
int
numOfRecordsPerTable
=
1000
;
static
long
ts
=
1496732686000
l
;
final
static
String
tablePrefix
=
"t"
;
@Before
public
void
createDatabase
()
throws
SQLException
{
try
{
Class
.
forName
(
"com.taosdata.jdbc.TSDBDriver"
);
}
catch
(
ClassNotFoundException
e
)
{
return
;
}
Properties
properties
=
new
Properties
();
properties
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_HOST
,
host
);
properties
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_CHARSET
,
"UTF-8"
);
properties
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_LOCALE
,
"en_US.UTF-8"
);
properties
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_TIME_ZONE
,
"UTC-8"
);
connection
=
DriverManager
.
getConnection
(
"jdbc:TAOS://"
+
host
+
":0/"
+
"?user=root&password=taosdata"
,
properties
);
statement
=
connection
.
createStatement
();
statement
.
executeUpdate
(
"drop database if exists "
+
dbName
);
statement
.
executeUpdate
(
"create database if not exists "
+
dbName
);
statement
.
executeUpdate
(
"use "
+
dbName
);
String
createTableSql
=
"create table "
+
stbName
+
"(ts timestamp, f1 int, f2 int, f3 int) tags(areaid int, loc binary(20))"
;
statement
.
executeUpdate
(
createTableSql
);
for
(
int
i
=
0
;
i
<
numOfTables
;
i
++)
{
String
loc
=
i
%
2
==
0
?
"beijing"
:
"shanghai"
;
String
createSubTalbesSql
=
"create table "
+
tablePrefix
+
i
+
" using "
+
stbName
+
" tags("
+
i
+
", '"
+
loc
+
"')"
;
statement
.
executeUpdate
(
createSubTalbesSql
);
}
}
@Test
public
void
testBatchInsert
()
throws
SQLException
{
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
numOfTables
);
for
(
int
i
=
0
;
i
<
numOfTables
;
i
++)
{
final
int
index
=
i
;
executorService
.
execute
(
new
Runnable
()
{
@Override
public
void
run
()
{
try
{
long
startTime
=
System
.
currentTimeMillis
();
Statement
statement
=
connection
.
createStatement
();
// get statement
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"INSERT INTO "
+
tablePrefix
+
index
+
" VALUES"
);
Random
rand
=
new
Random
();
for
(
int
j
=
1
;
j
<=
numOfRecordsPerTable
;
j
++)
{
sb
.
append
(
"("
+
(
ts
+
j
)
+
", "
);
sb
.
append
(
rand
.
nextInt
(
100
)
+
", "
);
sb
.
append
(
rand
.
nextInt
(
100
)
+
", "
);
sb
.
append
(
rand
.
nextInt
(
100
)
+
")"
);
}
statement
.
addBatch
(
sb
.
toString
());
statement
.
executeBatch
();
long
endTime
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"Thread "
+
index
+
" takes "
+
(
endTime
-
startTime
)
+
" microseconds"
);
connection
.
commit
();
statement
.
close
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
});
}
executorService
.
shutdown
();
try
{
executorService
.
awaitTermination
(
Long
.
MAX_VALUE
,
TimeUnit
.
NANOSECONDS
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
Statement
statement
=
connection
.
createStatement
();
ResultSet
rs
=
statement
.
executeQuery
(
"select * from meters"
);
int
num
=
0
;
while
(
rs
.
next
())
{
num
++;
}
assertEquals
(
num
,
numOfTables
*
numOfRecordsPerTable
);
rs
.
close
();
}
@After
public
void
close
()
throws
Exception
{
statement
.
close
();
connection
.
close
();
Thread
.
sleep
(
10
);
}
}
\ No newline at end of file
src/dnode/inc/dnodeInt.h
浏览文件 @
c3e3875b
...
...
@@ -26,10 +26,10 @@ extern int32_t dDebugFlag;
#define dFatal(...) { if (dDebugFlag & DEBUG_FATAL) { taosPrintLog("DND FATAL ", 255, __VA_ARGS__); }}
#define dError(...) { if (dDebugFlag & DEBUG_ERROR) { taosPrintLog("DND ERROR ", 255, __VA_ARGS__); }}
#define dWarn(...) { if (dDebugFlag & DEBUG_WARN) { taosPrintLog("DND WARN
", 255, __VA_ARGS__); }}
#define dInfo(...) { if (dDebugFlag & DEBUG_INFO) { taosPrintLog("DND
INFO
", 255, __VA_ARGS__); }}
#define dDebug(...) { if (dDebugFlag & DEBUG_DEBUG) { taosPrintLog("DND
DEBUG
", dDebugFlag, __VA_ARGS__); }}
#define dTrace(...) { if (dDebugFlag & DEBUG_TRACE) { taosPrintLog("DND
TRACE
", dDebugFlag, __VA_ARGS__); }}
#define dWarn(...) { if (dDebugFlag & DEBUG_WARN) { taosPrintLog("DND WARN ", 255, __VA_ARGS__); }}
#define dInfo(...) { if (dDebugFlag & DEBUG_INFO) { taosPrintLog("DND ", 255, __VA_ARGS__); }}
#define dDebug(...) { if (dDebugFlag & DEBUG_DEBUG) { taosPrintLog("DND ", dDebugFlag, __VA_ARGS__); }}
#define dTrace(...) { if (dDebugFlag & DEBUG_TRACE) { taosPrintLog("DND ", dDebugFlag, __VA_ARGS__); }}
#ifdef __cplusplus
}
...
...
src/dnode/src/dnodeMgmt.c
浏览文件 @
c3e3875b
...
...
@@ -72,6 +72,7 @@ static void *dnodeProcessMgmtQueue(void *param);
static
int32_t
dnodeOpenVnodes
();
static
void
dnodeCloseVnodes
();
static
int32_t
dnodeProcessCreateVnodeMsg
(
SRpcMsg
*
pMsg
);
static
int32_t
dnodeProcessAlterVnodeMsg
(
SRpcMsg
*
pMsg
);
static
int32_t
dnodeProcessDropVnodeMsg
(
SRpcMsg
*
pMsg
);
static
int32_t
dnodeProcessAlterStreamMsg
(
SRpcMsg
*
pMsg
);
static
int32_t
dnodeProcessConfigDnodeMsg
(
SRpcMsg
*
pMsg
);
...
...
@@ -79,6 +80,7 @@ static int32_t (*dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *pMsg);
int32_t
dnodeInitMgmt
()
{
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_MD_CREATE_VNODE
]
=
dnodeProcessCreateVnodeMsg
;
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_MD_ALTER_VNODE
]
=
dnodeProcessAlterVnodeMsg
;
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_MD_DROP_VNODE
]
=
dnodeProcessDropVnodeMsg
;
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_MD_ALTER_STREAM
]
=
dnodeProcessAlterStreamMsg
;
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_MD_CONFIG_DNODE
]
=
dnodeProcessConfigDnodeMsg
;
...
...
@@ -388,7 +390,7 @@ static void dnodeCloseVnodes() {
dInfo
(
"total vnodes:%d are all closed"
,
numOfVnodes
);
}
static
int32_t
dnodeProcessCreat
eVnodeMsg
(
SRpcMsg
*
rpcMsg
)
{
static
void
*
dnodePars
eVnodeMsg
(
SRpcMsg
*
rpcMsg
)
{
SMDCreateVnodeMsg
*
pCreate
=
rpcMsg
->
pCont
;
pCreate
->
cfg
.
vgId
=
htonl
(
pCreate
->
cfg
.
vgId
);
pCreate
->
cfg
.
cfgVersion
=
htonl
(
pCreate
->
cfg
.
cfgVersion
);
...
...
@@ -408,17 +410,38 @@ static int32_t dnodeProcessCreateVnodeMsg(SRpcMsg *rpcMsg) {
pCreate
->
nodes
[
j
].
nodeId
=
htonl
(
pCreate
->
nodes
[
j
].
nodeId
);
}
return
pCreate
;
}
static
int32_t
dnodeProcessCreateVnodeMsg
(
SRpcMsg
*
rpcMsg
)
{
SMDCreateVnodeMsg
*
pCreate
=
dnodeParseVnodeMsg
(
rpcMsg
);
void
*
pVnode
=
vnodeAcquireVnode
(
pCreate
->
cfg
.
vgId
);
if
(
pVnode
!=
NULL
)
{
dDebug
(
"vgId:%d, already exist, processed as alter msg"
,
pCreate
->
cfg
.
vgId
);
int32_t
code
=
vnodeAlter
(
pVnode
,
pCreate
);
dDebug
(
"vgId:%d, already exist, return success"
,
pCreate
->
cfg
.
vgId
);
vnodeRelease
(
pVnode
);
return
code
;
return
TSDB_CODE_SUCCESS
;
}
else
{
dDebug
(
"vgId:%d, create vnode msg is received"
,
pCreate
->
cfg
.
vgId
);
return
vnodeCreate
(
pCreate
);
}
}
static
int32_t
dnodeProcessAlterVnodeMsg
(
SRpcMsg
*
rpcMsg
)
{
SMDAlterVnodeMsg
*
pAlter
=
dnodeParseVnodeMsg
(
rpcMsg
);
void
*
pVnode
=
vnodeAcquireVnode
(
pAlter
->
cfg
.
vgId
);
if
(
pVnode
!=
NULL
)
{
dDebug
(
"vgId:%d, alter vnode msg is received"
,
pAlter
->
cfg
.
vgId
);
int32_t
code
=
vnodeAlter
(
pVnode
,
pAlter
);
vnodeRelease
(
pVnode
);
return
code
;
}
else
{
dError
(
"vgId:%d, vnode not exist, can't alter it"
,
pAlter
->
cfg
.
vgId
);
return
TSDB_CODE_VND_INVALID_VGROUP_ID
;
}
}
static
int32_t
dnodeProcessDropVnodeMsg
(
SRpcMsg
*
rpcMsg
)
{
SMDDropVnodeMsg
*
pDrop
=
rpcMsg
->
pCont
;
pDrop
->
vgId
=
htonl
(
pDrop
->
vgId
);
...
...
src/dnode/src/dnodePeer.c
浏览文件 @
c3e3875b
...
...
@@ -44,6 +44,7 @@ int32_t dnodeInitServer() {
dnodeProcessReqMsgFp
[
TSDB_MSG_TYPE_MD_DROP_STABLE
]
=
dnodeDispatchToVnodeWriteQueue
;
dnodeProcessReqMsgFp
[
TSDB_MSG_TYPE_MD_CREATE_VNODE
]
=
dnodeDispatchToMgmtQueue
;
dnodeProcessReqMsgFp
[
TSDB_MSG_TYPE_MD_ALTER_VNODE
]
=
dnodeDispatchToMgmtQueue
;
dnodeProcessReqMsgFp
[
TSDB_MSG_TYPE_MD_DROP_VNODE
]
=
dnodeDispatchToMgmtQueue
;
dnodeProcessReqMsgFp
[
TSDB_MSG_TYPE_MD_ALTER_STREAM
]
=
dnodeDispatchToMgmtQueue
;
dnodeProcessReqMsgFp
[
TSDB_MSG_TYPE_MD_CONFIG_DNODE
]
=
dnodeDispatchToMgmtQueue
;
...
...
src/dnode/src/dnodeSystem.c
浏览文件 @
c3e3875b
...
...
@@ -135,7 +135,7 @@ int32_t main(int32_t argc, char *argv[]) {
static
void
signal_handler
(
int32_t
signum
,
siginfo_t
*
sigInfo
,
void
*
context
)
{
if
(
signum
==
SIGUSR1
)
{
taosCfgDynamicOptions
(
"debugFlag 1
51
"
);
taosCfgDynamicOptions
(
"debugFlag 1
43
"
);
return
;
}
if
(
signum
==
SIGUSR2
)
{
...
...
src/inc/taos.h
浏览文件 @
c3e3875b
...
...
@@ -67,6 +67,8 @@ DLL_EXPORT void taos_init();
DLL_EXPORT
void
taos_cleanup
();
DLL_EXPORT
int
taos_options
(
TSDB_OPTION
option
,
const
void
*
arg
,
...);
DLL_EXPORT
TAOS
*
taos_connect
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
db
,
uint16_t
port
);
DLL_EXPORT
TAOS
*
taos_connect_c
(
const
char
*
ip
,
uint8_t
ipLen
,
const
char
*
user
,
uint8_t
userLen
,
const
char
*
pass
,
uint8_t
passLen
,
const
char
*
db
,
uint8_t
dbLen
,
uint16_t
port
);
DLL_EXPORT
void
taos_close
(
TAOS
*
taos
);
typedef
struct
TAOS_BIND
{
...
...
@@ -88,6 +90,7 @@ TAOS_RES * taos_stmt_use_result(TAOS_STMT *stmt);
int
taos_stmt_close
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
TAOS_RES
*
taos_query
(
TAOS
*
taos
,
const
char
*
sql
);
DLL_EXPORT
TAOS_RES
*
taos_query_c
(
TAOS
*
taos
,
const
char
*
sql
,
uint32_t
sqlLen
);
DLL_EXPORT
TAOS_ROW
taos_fetch_row
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_result_precision
(
TAOS_RES
*
res
);
// get the time precision of result
DLL_EXPORT
void
taos_free_result
(
TAOS_RES
*
res
);
...
...
src/inc/taosmsg.h
浏览文件 @
c3e3875b
...
...
@@ -58,7 +58,7 @@ TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_DROP_VNODE, "drop-vnode" )
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_MD_DROP_STABLE
,
"drop-stable"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_MD_ALTER_STREAM
,
"alter-stream"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_MD_CONFIG_DNODE
,
"config-dnode"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_
DUMMY4
,
"dummy4
"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_
MD_ALTER_VNODE
,
"alter-vnode
"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_DUMMY5
,
"dummy5"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_DUMMY6
,
"dummy6"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_DUMMY7
,
"dummy7"
)
...
...
@@ -628,7 +628,7 @@ typedef struct {
char
db
[
TSDB_ACCT_LEN
+
TSDB_DB_NAME_LEN
];
SMDVnodeCfg
cfg
;
SMDVnodeDesc
nodes
[
TSDB_MAX_REPLICA
];
}
SMDCreateVnodeMsg
;
}
SMDCreateVnodeMsg
,
SMDAlterVnodeMsg
;
typedef
struct
{
char
tableId
[
TSDB_TABLE_ID_LEN
];
...
...
src/mnode/inc/mnodeInt.h
浏览文件 @
c3e3875b
...
...
@@ -29,17 +29,17 @@ extern int32_t sdbDebugFlag;
// mnode log function
#define mFatal(...) { if (mDebugFlag & DEBUG_FATAL) { taosPrintLog("MND FATAL ", 255, __VA_ARGS__); }}
#define mError(...) { if (mDebugFlag & DEBUG_ERROR) { taosPrintLog("MND ERROR ", 255, __VA_ARGS__); }}
#define mWarn(...) { if (mDebugFlag & DEBUG_WARN) { taosPrintLog("MND WARN
", 255, __VA_ARGS__); }}
#define mInfo(...) { if (mDebugFlag & DEBUG_INFO) { taosPrintLog("MND
INFO
", 255, __VA_ARGS__); }}
#define mDebug(...) { if (mDebugFlag & DEBUG_DEBUG) { taosPrintLog("MND
DEBUG
", mDebugFlag, __VA_ARGS__); }}
#define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND
TRACE
", mDebugFlag, __VA_ARGS__); }}
#define mWarn(...) { if (mDebugFlag & DEBUG_WARN) { taosPrintLog("MND WARN ", 255, __VA_ARGS__); }}
#define mInfo(...) { if (mDebugFlag & DEBUG_INFO) { taosPrintLog("MND ", 255, __VA_ARGS__); }}
#define mDebug(...) { if (mDebugFlag & DEBUG_DEBUG) { taosPrintLog("MND ", mDebugFlag, __VA_ARGS__); }}
#define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", mDebugFlag, __VA_ARGS__); }}
#define sdbFatal(...) { if (sdbDebugFlag & DEBUG_FATAL) { taosPrintLog("SDB FATAL ", 255, __VA_ARGS__); }}
#define sdbError(...) { if (sdbDebugFlag & DEBUG_ERROR) { taosPrintLog("SDB ERROR ", 255, __VA_ARGS__); }}
#define sdbWarn(...) { if (sdbDebugFlag & DEBUG_WARN) { taosPrintLog("SDB WARN
", 255, __VA_ARGS__); }}
#define sdbInfo(...) { if (sdbDebugFlag & DEBUG_INFO) { taosPrintLog("SDB
INFO
", 255, __VA_ARGS__); }}
#define sdbDebug(...) { if (sdbDebugFlag & DEBUG_DEBUG) { taosPrintLog("SDB
DEBUG
", sdbDebugFlag, __VA_ARGS__); }}
#define sdbTrace(...) { if (sdbDebugFlag & DEBUG_TRACE) { taosPrintLog("SDB
TRACE
", sdbDebugFlag, __VA_ARGS__); }}
#define sdbWarn(...) { if (sdbDebugFlag & DEBUG_WARN) { taosPrintLog("SDB WARN ", 255, __VA_ARGS__); }}
#define sdbInfo(...) { if (sdbDebugFlag & DEBUG_INFO) { taosPrintLog("SDB ", 255, __VA_ARGS__); }}
#define sdbDebug(...) { if (sdbDebugFlag & DEBUG_DEBUG) { taosPrintLog("SDB ", sdbDebugFlag, __VA_ARGS__); }}
#define sdbTrace(...) { if (sdbDebugFlag & DEBUG_TRACE) { taosPrintLog("SDB ", sdbDebugFlag, __VA_ARGS__); }}
#define mLError(...) { monitorSaveLog(2, __VA_ARGS__); mError(__VA_ARGS__) }
#define mLWarn(...) { monitorSaveLog(1, __VA_ARGS__); mWarn(__VA_ARGS__) }
...
...
src/mnode/inc/mnodeVgroup.h
浏览文件 @
c3e3875b
...
...
@@ -44,9 +44,9 @@ int32_t mnodeGetAvailableVgroup(struct SMnodeMsg *pMsg, SVgObj **pVgroup, int32_
void
mnodeAddTableIntoVgroup
(
SVgObj
*
pVgroup
,
SChildTableObj
*
pTable
);
void
mnodeRemoveTableFromVgroup
(
SVgObj
*
pVgroup
,
SChildTableObj
*
pTable
);
void
mnodeSendCreateVnodeMsg
(
SVgObj
*
pVgroup
,
SRpcIpSet
*
ipSet
,
void
*
ahandle
);
void
mnodeSendDropVnodeMsg
(
int32_t
vgId
,
SRpcIpSet
*
ipSet
,
void
*
ahandle
);
void
mnodeSendCreateVgroupMsg
(
SVgObj
*
pVgroup
,
void
*
ahandle
);
void
mnodeSendAlterVgroupMsg
(
SVgObj
*
pVgroup
);
SRpcIpSet
mnodeGetIpSetFromVgroup
(
SVgObj
*
pVgroup
);
SRpcIpSet
mnodeGetIpSetFromIp
(
char
*
ep
);
...
...
src/mnode/src/mnodeDb.c
浏览文件 @
c3e3875b
...
...
@@ -913,7 +913,7 @@ static int32_t mnodeAlterDbCb(SMnodeMsg *pMsg, int32_t code) {
pIter
=
mnodeGetNextVgroup
(
pIter
,
&
pVgroup
);
if
(
pVgroup
==
NULL
)
break
;
if
(
pVgroup
->
pDb
==
pDb
)
{
mnodeSend
CreateVgroupMsg
(
pVgroup
,
NULL
);
mnodeSend
AlterVgroupMsg
(
pVgroup
);
}
mnodeDecVgroupRef
(
pVgroup
);
}
...
...
src/mnode/src/mnodeVgroup.c
浏览文件 @
c3e3875b
...
...
@@ -40,9 +40,18 @@
typedef
enum
{
TAOS_VG_STATUS_READY
,
TAOS_VG_STATUS_DROPPING
TAOS_VG_STATUS_DROPPING
,
TAOS_VG_STATUS_CREATING
,
TAOS_VG_STATUS_UPDATING
,
}
EVgroupStatus
;
char
*
vgroupStatus
[]
=
{
"ready"
,
"dropping"
,
"creating"
,
"updating"
};
static
void
*
tsVgroupSdb
=
NULL
;
static
int32_t
tsVgUpdateSize
=
0
;
...
...
@@ -50,6 +59,7 @@ static int32_t mnodeAllocVgroupIdPool(SVgObj *pInputVgroup);
static
int32_t
mnodeGetVgroupMeta
(
STableMetaMsg
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
static
int32_t
mnodeRetrieveVgroups
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
);
static
void
mnodeProcessCreateVnodeRsp
(
SRpcMsg
*
rpcMsg
);
static
void
mnodeProcessAlterVnodeRsp
(
SRpcMsg
*
rpcMsg
);
static
void
mnodeProcessDropVnodeRsp
(
SRpcMsg
*
rpcMsg
);
static
int32_t
mnodeProcessVnodeCfgMsg
(
SMnodeMsg
*
pMsg
)
;
static
void
mnodeSendDropVgroupMsg
(
SVgObj
*
pVgroup
,
void
*
ahandle
);
...
...
@@ -83,6 +93,7 @@ static int32_t mnodeVgroupActionInsert(SSdbOper *pOper) {
}
pVgroup
->
pDb
=
pDb
;
pVgroup
->
status
=
TAOS_VG_STATUS_CREATING
;
pVgroup
->
accessState
=
TSDB_VN_ALL_ACCCESS
;
if
(
mnodeAllocVgroupIdPool
(
pVgroup
)
<
0
)
{
mError
(
"vgId:%d, failed to init idpool for vgroups"
,
pVgroup
->
vgId
);
...
...
@@ -217,6 +228,7 @@ int32_t mnodeInitVgroups() {
mnodeAddShowMetaHandle
(
TSDB_MGMT_TABLE_VGROUP
,
mnodeGetVgroupMeta
);
mnodeAddShowRetrieveHandle
(
TSDB_MGMT_TABLE_VGROUP
,
mnodeRetrieveVgroups
);
mnodeAddPeerRspHandle
(
TSDB_MSG_TYPE_MD_CREATE_VNODE_RSP
,
mnodeProcessCreateVnodeRsp
);
mnodeAddPeerRspHandle
(
TSDB_MSG_TYPE_MD_ALTER_VNODE_RSP
,
mnodeProcessAlterVnodeRsp
);
mnodeAddPeerRspHandle
(
TSDB_MSG_TYPE_MD_DROP_VNODE_RSP
,
mnodeProcessDropVnodeRsp
);
mnodeAddPeerMsgHandle
(
TSDB_MSG_TYPE_DM_CONFIG_VNODE
,
mnodeProcessVnodeCfgMsg
);
...
...
@@ -247,7 +259,7 @@ void mnodeUpdateVgroup(SVgObj *pVgroup) {
if
(
sdbUpdateRow
(
&
oper
)
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"vgId:%d, failed to update vgroup"
,
pVgroup
->
vgId
);
}
mnodeSend
CreateVgroupMsg
(
pVgroup
,
NULL
);
mnodeSend
AlterVgroupMsg
(
pVgroup
);
}
/*
...
...
@@ -271,10 +283,17 @@ void mnodeCheckUnCreatedVgroup(SDnodeObj *pDnode, SVnodeLoad *pVloads, int32_t o
pNextV
++
;
}
if
(
i
==
openVnodes
&&
pVgroup
->
status
==
TAOS_VG_STATUS_READY
)
{
mnodeSendCreateVgroupMsg
(
pVgroup
,
NULL
);
if
(
i
==
openVnodes
)
{
if
(
pVgroup
->
status
==
TAOS_VG_STATUS_CREATING
||
pVgroup
->
status
==
TAOS_VG_STATUS_DROPPING
)
{
mDebug
(
"vgId:%d, not exist in dnode:%d and status is %s, do nothing"
,
pVgroup
->
vgId
,
pDnode
->
dnodeId
,
vgroupStatus
[
pVgroup
->
status
]);
}
else
{
mDebug
(
"vgId:%d, not exist in dnode:%d and status is %s, send create msg"
,
pVgroup
->
vgId
,
pDnode
->
dnodeId
,
vgroupStatus
[
pVgroup
->
status
]);
mnodeSendCreateVgroupMsg
(
pVgroup
,
NULL
);
}
}
mnodeDecVgroupRef
(
pVgroup
);
}
...
...
@@ -314,7 +333,7 @@ void mnodeUpdateVgroupStatus(SVgObj *pVgroup, SDnodeObj *pDnode, SVnodeLoad *pVl
mError
(
"dnode:%d, vgId:%d, vnode cfgVersion:%d repica:%d not match with mnode cfgVersion:%d replica:%d"
,
pDnode
->
dnodeId
,
pVload
->
vgId
,
pVload
->
cfgVersion
,
pVload
->
replica
,
pVgroup
->
pDb
->
cfgVersion
,
pVgroup
->
numOfVnodes
);
mnodeSend
CreateVgroupMsg
(
pVgroup
,
NULL
);
mnodeSend
AlterVgroupMsg
(
pVgroup
);
}
}
...
...
@@ -461,6 +480,10 @@ static int32_t mnodeCreateVgroupCb(SMnodeMsg *pMsg, int32_t code) {
SSdbOper
desc
=
{.
type
=
SDB_OPER_GLOBAL
,
.
pObj
=
pVgroup
,
.
table
=
tsVgroupSdb
};
sdbDeleteRow
(
&
desc
);
return
code
;
}
else
{
pVgroup
->
status
=
TAOS_VG_STATUS_READY
;
SSdbOper
desc
=
{.
type
=
SDB_OPER_GLOBAL
,
.
pObj
=
pVgroup
,
.
table
=
tsVgroupSdb
};
sdbUpdateRow
(
&
desc
);
}
mInfo
(
"app:%p:%p, vgId:%d, is created in mnode, db:%s replica:%d"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pVgroup
->
vgId
,
...
...
@@ -536,7 +559,7 @@ void mnodeCleanupVgroups() {
tsVgroupSdb
=
NULL
;
}
int32_t
mnodeGetVgroupMeta
(
STableMetaMsg
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
static
int32_t
mnodeGetVgroupMeta
(
STableMetaMsg
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
SDbObj
*
pDb
=
mnodeGetDb
(
pShow
->
db
);
if
(
pDb
==
NULL
)
{
return
TSDB_CODE_MND_DB_NOT_SELECTED
;
...
...
@@ -630,7 +653,7 @@ static bool mnodeFilterVgroups(SVgObj *pVgroup, STableObj *pTable) {
}
}
int32_t
mnodeRetrieveVgroups
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
)
{
static
int32_t
mnodeRetrieveVgroups
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
)
{
int32_t
numOfRows
=
0
;
SVgObj
*
pVgroup
=
NULL
;
int32_t
cols
=
0
;
...
...
@@ -733,7 +756,7 @@ void mnodeRemoveTableFromVgroup(SVgObj *pVgroup, SChildTableObj *pTable) {
}
}
SMDCreateVnodeMsg
*
mnodeBuildCreate
VnodeMsg
(
SVgObj
*
pVgroup
)
{
static
SMDCreateVnodeMsg
*
mnodeBuild
VnodeMsg
(
SVgObj
*
pVgroup
)
{
SDbObj
*
pDb
=
pVgroup
->
pDb
;
if
(
pDb
==
NULL
)
return
NULL
;
...
...
@@ -800,8 +823,31 @@ SRpcIpSet mnodeGetIpSetFromIp(char *ep) {
return
ipSet
;
}
void
mnodeSendCreateVnodeMsg
(
SVgObj
*
pVgroup
,
SRpcIpSet
*
ipSet
,
void
*
ahandle
)
{
SMDCreateVnodeMsg
*
pCreate
=
mnodeBuildCreateVnodeMsg
(
pVgroup
);
static
void
mnodeSendAlterVnodeMsg
(
SVgObj
*
pVgroup
,
SRpcIpSet
*
ipSet
)
{
SMDAlterVnodeMsg
*
pAlter
=
mnodeBuildVnodeMsg
(
pVgroup
);
SRpcMsg
rpcMsg
=
{
.
ahandle
=
NULL
,
.
pCont
=
pAlter
,
.
contLen
=
pAlter
?
sizeof
(
SMDAlterVnodeMsg
)
:
0
,
.
code
=
0
,
.
msgType
=
TSDB_MSG_TYPE_MD_ALTER_VNODE
};
dnodeSendMsgToDnode
(
ipSet
,
&
rpcMsg
);
}
void
mnodeSendAlterVgroupMsg
(
SVgObj
*
pVgroup
)
{
mDebug
(
"vgId:%d, send alter all vnodes msg, numOfVnodes:%d db:%s"
,
pVgroup
->
vgId
,
pVgroup
->
numOfVnodes
,
pVgroup
->
dbName
);
for
(
int32_t
i
=
0
;
i
<
pVgroup
->
numOfVnodes
;
++
i
)
{
SRpcIpSet
ipSet
=
mnodeGetIpSetFromIp
(
pVgroup
->
vnodeGid
[
i
].
pDnode
->
dnodeEp
);
mDebug
(
"vgId:%d, index:%d, send alter vnode msg to dnode %s"
,
pVgroup
->
vgId
,
i
,
pVgroup
->
vnodeGid
[
i
].
pDnode
->
dnodeEp
);
mnodeSendAlterVnodeMsg
(
pVgroup
,
&
ipSet
);
}
}
static
void
mnodeSendCreateVnodeMsg
(
SVgObj
*
pVgroup
,
SRpcIpSet
*
ipSet
,
void
*
ahandle
)
{
SMDCreateVnodeMsg
*
pCreate
=
mnodeBuildVnodeMsg
(
pVgroup
);
SRpcMsg
rpcMsg
=
{
.
ahandle
=
ahandle
,
.
pCont
=
pCreate
,
...
...
@@ -823,6 +869,10 @@ void mnodeSendCreateVgroupMsg(SVgObj *pVgroup, void *ahandle) {
}
}
static
void
mnodeProcessAlterVnodeRsp
(
SRpcMsg
*
rpcMsg
)
{
mDebug
(
"alter vnode rsp received"
);
}
static
void
mnodeProcessCreateVnodeRsp
(
SRpcMsg
*
rpcMsg
)
{
if
(
rpcMsg
->
ahandle
==
NULL
)
return
;
...
...
src/plugins/http/inc/httpLog.h
浏览文件 @
c3e3875b
...
...
@@ -22,10 +22,10 @@ extern int32_t httpDebugFlag;
#define httpFatal(...) { if (httpDebugFlag & DEBUG_FATAL) { taosPrintLog("HTP FATAL ", 255, __VA_ARGS__); }}
#define httpError(...) { if (httpDebugFlag & DEBUG_ERROR) { taosPrintLog("HTP ERROR ", 255, __VA_ARGS__); }}
#define httpWarn(...) { if (httpDebugFlag & DEBUG_WARN) { taosPrintLog("HTP WARN
", 255, __VA_ARGS__); }}
#define httpInfo(...) { if (httpDebugFlag & DEBUG_INFO) { taosPrintLog("HTP
INFO
", 255, __VA_ARGS__); }}
#define httpDebug(...) { if (httpDebugFlag & DEBUG_DEBUG) { taosPrintLog("HTP
DEBUG
", httpDebugFlag, __VA_ARGS__); }}
#define httpTrace(...) { if (httpDebugFlag & DEBUG_TRACE) { taosPrintLog("HTP
TRACE
", httpDebugFlag, __VA_ARGS__); }}
#define httpTraceL(...){ if (httpDebugFlag & DEBUG_TRACE) { taosPrintLongString("HTP
TRACE
", httpDebugFlag, __VA_ARGS__); }}
#define httpWarn(...) { if (httpDebugFlag & DEBUG_WARN) { taosPrintLog("HTP WARN ", 255, __VA_ARGS__); }}
#define httpInfo(...) { if (httpDebugFlag & DEBUG_INFO) { taosPrintLog("HTP ", 255, __VA_ARGS__); }}
#define httpDebug(...) { if (httpDebugFlag & DEBUG_DEBUG) { taosPrintLog("HTP ", httpDebugFlag, __VA_ARGS__); }}
#define httpTrace(...) { if (httpDebugFlag & DEBUG_TRACE) { taosPrintLog("HTP ", httpDebugFlag, __VA_ARGS__); }}
#define httpTraceL(...){ if (httpDebugFlag & DEBUG_TRACE) { taosPrintLongString("HTP ", httpDebugFlag, __VA_ARGS__); }}
#endif
src/plugins/monitor/src/monitorMain.c
浏览文件 @
c3e3875b
...
...
@@ -30,10 +30,10 @@
#define monitorFatal(...) { if (monitorDebugFlag & DEBUG_FATAL) { taosPrintLog("MON FATAL ", 255, __VA_ARGS__); }}
#define monitorError(...) { if (monitorDebugFlag & DEBUG_ERROR) { taosPrintLog("MON ERROR ", 255, __VA_ARGS__); }}
#define monitorWarn(...) { if (monitorDebugFlag & DEBUG_WARN) { taosPrintLog("MON WARN
", 255, __VA_ARGS__); }}
#define monitorInfo(...) { if (monitorDebugFlag & DEBUG_INFO) { taosPrintLog("MON
INFO
", 255, __VA_ARGS__); }}
#define monitorDebug(...) { if (monitorDebugFlag & DEBUG_DEBUG) { taosPrintLog("MON
DEBUG
", monitorDebugFlag, __VA_ARGS__); }}
#define monitorTrace(...) { if (monitorDebugFlag & DEBUG_TRACE) { taosPrintLog("MON
TRACE
", monitorDebugFlag, __VA_ARGS__); }}
#define monitorWarn(...) { if (monitorDebugFlag & DEBUG_WARN) { taosPrintLog("MON WARN ", 255, __VA_ARGS__); }}
#define monitorInfo(...) { if (monitorDebugFlag & DEBUG_INFO) { taosPrintLog("MON ", 255, __VA_ARGS__); }}
#define monitorDebug(...) { if (monitorDebugFlag & DEBUG_DEBUG) { taosPrintLog("MON ", monitorDebugFlag, __VA_ARGS__); }}
#define monitorTrace(...) { if (monitorDebugFlag & DEBUG_TRACE) { taosPrintLog("MON ", monitorDebugFlag, __VA_ARGS__); }}
#define SQL_LENGTH 1024
#define LOG_LEN_STR 100
...
...
src/plugins/mqtt/inc/mqttLog.h
浏览文件 @
c3e3875b
...
...
@@ -22,9 +22,9 @@ extern int32_t mqttDebugFlag;
#define mqttFatal(...) { if (mqttDebugFlag & DEBUG_FATAL) { taosPrintLog("MQT FATAL ", 255, __VA_ARGS__); }}
#define mqttError(...) { if (mqttDebugFlag & DEBUG_ERROR) { taosPrintLog("MQT ERROR ", 255, __VA_ARGS__); }}
#define mqttWarn(...) { if (mqttDebugFlag & DEBUG_WARN) { taosPrintLog("MQT WARN
", 255, __VA_ARGS__); }}
#define mqttInfo(...) { if (mqttDebugFlag & DEBUG_INFO) { taosPrintLog("MQT
INFO
", 255, __VA_ARGS__); }}
#define mqttDebug(...) { if (mqttDebugFlag & DEBUG_DEBUG) { taosPrintLog("MQT
DEBUG
", mqttDebugFlag, __VA_ARGS__); }}
#define mqttTrace(...) { if (mqttDebugFlag & DEBUG_TRACE) { taosPrintLog("MQT
TRACE
", mqttDebugFlag, __VA_ARGS__); }}
#define mqttWarn(...) { if (mqttDebugFlag & DEBUG_WARN) { taosPrintLog("MQT WARN ", 255, __VA_ARGS__); }}
#define mqttInfo(...) { if (mqttDebugFlag & DEBUG_INFO) { taosPrintLog("MQT ", 255, __VA_ARGS__); }}
#define mqttDebug(...) { if (mqttDebugFlag & DEBUG_DEBUG) { taosPrintLog("MQT ", mqttDebugFlag, __VA_ARGS__); }}
#define mqttTrace(...) { if (mqttDebugFlag & DEBUG_TRACE) { taosPrintLog("MQT ", mqttDebugFlag, __VA_ARGS__); }}
#endif
src/query/inc/qExecutor.h
浏览文件 @
c3e3875b
...
...
@@ -24,7 +24,7 @@
#include "qtsbuf.h"
#include "taosdef.h"
#include "tarray.h"
#include "t
ref
.h"
#include "t
lockfree
.h"
#include "tsdb.h"
#include "tsqlfunction.h"
#include "query.h"
...
...
src/query/inc/queryLog.h
浏览文件 @
c3e3875b
...
...
@@ -27,10 +27,10 @@ extern int32_t tscEmbedded;
#define qFatal(...) { if (qDebugFlag & DEBUG_FATAL) { taosPrintLog("QRY FATAL ", 255, __VA_ARGS__); }}
#define qError(...) { if (qDebugFlag & DEBUG_ERROR) { taosPrintLog("QRY ERROR ", 255, __VA_ARGS__); }}
#define qWarn(...) { if (qDebugFlag & DEBUG_WARN) { taosPrintLog("QRY WARN
", 255, __VA_ARGS__); }}
#define qInfo(...) { if (qDebugFlag & DEBUG_INFO) { taosPrintLog("QRY
INFO
", 255, __VA_ARGS__); }}
#define qDebug(...) { if (qDebugFlag & DEBUG_DEBUG) { taosPrintLog("QRY
DEBUG
", qDebugFlag, __VA_ARGS__); }}
#define qTrace(...) { if (qDebugFlag & DEBUG_TRACE) { taosPrintLog("QRY
TRACE
", qDebugFlag, __VA_ARGS__); }}
#define qWarn(...) { if (qDebugFlag & DEBUG_WARN) { taosPrintLog("QRY WARN ", 255, __VA_ARGS__); }}
#define qInfo(...) { if (qDebugFlag & DEBUG_INFO) { taosPrintLog("QRY ", 255, __VA_ARGS__); }}
#define qDebug(...) { if (qDebugFlag & DEBUG_DEBUG) { taosPrintLog("QRY ", qDebugFlag, __VA_ARGS__); }}
#define qTrace(...) { if (qDebugFlag & DEBUG_TRACE) { taosPrintLog("QRY ", qDebugFlag, __VA_ARGS__); }}
#ifdef __cplusplus
}
...
...
src/query/src/qExecutor.c
浏览文件 @
c3e3875b
...
...
@@ -6552,7 +6552,8 @@ void* qOpenQueryMgmt(int32_t vgId) {
}
static
void
queryMgmtKillQueryFn
(
void
*
handle
)
{
qKillQuery
(
handle
);
void
**
fp
=
(
void
**
)
handle
;
qKillQuery
(
*
fp
);
}
void
qQueryMgmtNotifyClosed
(
void
*
pQMgmt
)
{
...
...
src/rpc/inc/rpcLog.h
浏览文件 @
c3e3875b
...
...
@@ -27,10 +27,10 @@ extern int32_t tscEmbedded;
#define tFatal(...) { if (rpcDebugFlag & DEBUG_FATAL) { taosPrintLog("RPC FATAL ", tscEmbedded ? 255 : rpcDebugFlag, __VA_ARGS__); }}
#define tError(...) { if (rpcDebugFlag & DEBUG_ERROR) { taosPrintLog("RPC ERROR ", tscEmbedded ? 255 : rpcDebugFlag, __VA_ARGS__); }}
#define tWarn(...) { if (rpcDebugFlag & DEBUG_WARN) { taosPrintLog("RPC WARN
", tscEmbedded ? 255 : rpcDebugFlag, __VA_ARGS__); }}
#define tInfo(...) { if (rpcDebugFlag & DEBUG_INFO) { taosPrintLog("RPC
INFO
", tscEmbedded ? 255 : rpcDebugFlag, __VA_ARGS__); }}
#define tDebug(...) { if (rpcDebugFlag & DEBUG_DEBUG) { taosPrintLog("RPC
DEBUG
", rpcDebugFlag, __VA_ARGS__); }}
#define tTrace(...) { if (rpcDebugFlag & DEBUG_TRACE) { taosPrintLog("RPC
TRACE
", rpcDebugFlag, __VA_ARGS__); }}
#define tWarn(...) { if (rpcDebugFlag & DEBUG_WARN) { taosPrintLog("RPC WARN ", tscEmbedded ? 255 : rpcDebugFlag, __VA_ARGS__); }}
#define tInfo(...) { if (rpcDebugFlag & DEBUG_INFO) { taosPrintLog("RPC ", tscEmbedded ? 255 : rpcDebugFlag, __VA_ARGS__); }}
#define tDebug(...) { if (rpcDebugFlag & DEBUG_DEBUG) { taosPrintLog("RPC ", rpcDebugFlag, __VA_ARGS__); }}
#define tTrace(...) { if (rpcDebugFlag & DEBUG_TRACE) { taosPrintLog("RPC ", rpcDebugFlag, __VA_ARGS__); }}
#define tDump(x, y) { if (rpcDebugFlag & DEBUG_DUMP) { taosDumpData((unsigned char *)x, y); }}
#ifdef __cplusplus
...
...
src/tsdb/inc/tsdbMain.h
浏览文件 @
c3e3875b
...
...
@@ -21,11 +21,10 @@
#include "tkvstore.h"
#include "tlist.h"
#include "tlog.h"
#include "t
ref
.h"
#include "t
lockfree
.h"
#include "tsdb.h"
#include "tskiplist.h"
#include "tutil.h"
#include "trwlatch.h"
#ifdef __cplusplus
extern
"C"
{
...
...
@@ -35,10 +34,10 @@ extern int tsdbDebugFlag;
#define tsdbFatal(...) { if (tsdbDebugFlag & DEBUG_FATAL) { taosPrintLog("TDB FATAL ", 255, __VA_ARGS__); }}
#define tsdbError(...) { if (tsdbDebugFlag & DEBUG_ERROR) { taosPrintLog("TDB ERROR ", 255, __VA_ARGS__); }}
#define tsdbWarn(...) { if (tsdbDebugFlag & DEBUG_WARN) { taosPrintLog("TDB WARN
", 255, __VA_ARGS__); }}
#define tsdbInfo(...) { if (tsdbDebugFlag & DEBUG_INFO) { taosPrintLog("TDB
INFO
", 255, __VA_ARGS__); }}
#define tsdbDebug(...) { if (tsdbDebugFlag & DEBUG_DEBUG) { taosPrintLog("TDB
DEBUG
", tsdbDebugFlag, __VA_ARGS__); }}
#define tsdbTrace(...) { if (tsdbDebugFlag & DEBUG_TRACE) { taosPrintLog("TDB
TRACE
", tsdbDebugFlag, __VA_ARGS__); }}
#define tsdbWarn(...) { if (tsdbDebugFlag & DEBUG_WARN) { taosPrintLog("TDB WARN ", 255, __VA_ARGS__); }}
#define tsdbInfo(...) { if (tsdbDebugFlag & DEBUG_INFO) { taosPrintLog("TDB ", 255, __VA_ARGS__); }}
#define tsdbDebug(...) { if (tsdbDebugFlag & DEBUG_DEBUG) { taosPrintLog("TDB ", tsdbDebugFlag, __VA_ARGS__); }}
#define tsdbTrace(...) { if (tsdbDebugFlag & DEBUG_TRACE) { taosPrintLog("TDB ", tsdbDebugFlag, __VA_ARGS__); }}
#define TSDB_MAX_TABLE_SCHEMAS 16
#define TSDB_FILE_HEAD_SIZE 512
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
c3e3875b
...
...
@@ -1241,10 +1241,12 @@ static int32_t dataBlockOrderCompar(const void* pLeft, const void* pRight, void*
STableBlockInfo
*
pRightBlockInfoEx
=
&
pSupporter
->
pDataBlockInfo
[
rightTableIndex
][
rightTableBlockIndex
];
// assert(pLeftBlockInfoEx->compBlock->offset != pRightBlockInfoEx->compBlock->offset);
#if 0 // TODO: temporarily comment off requested by Dr. Liao
if (pLeftBlockInfoEx->compBlock->offset == pRightBlockInfoEx->compBlock->offset &&
pLeftBlockInfoEx->compBlock->last == pRightBlockInfoEx->compBlock->last) {
tsdbError("error in header file, two block with same offset:%" PRId64, (int64_t)pLeftBlockInfoEx->compBlock->offset);
}
#endif
return
pLeftBlockInfoEx
->
compBlock
->
offset
>
pRightBlockInfoEx
->
compBlock
->
offset
?
1
:
-
1
;
}
...
...
src/util/inc/tcache.h
浏览文件 @
c3e3875b
...
...
@@ -21,7 +21,7 @@ extern "C" {
#endif
#include "os.h"
#include "t
ref
.h"
#include "t
lockfree
.h"
#include "hash.h"
typedef
void
(
*
__cache_free_fn_t
)(
void
*
);
...
...
src/util/inc/t
ref
.h
→
src/util/inc/t
lockfree
.h
浏览文件 @
c3e3875b
...
...
@@ -12,12 +12,17 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TDENGINE_TREF_H
#define TDENGINE_TREF_H
#ifndef __TD_LOCK_FREE_H__
#define __TD_LOCK_FREE_H__
#include "os.h"
#ifdef __cplusplus
extern
"C"
{
#endif
// reference counting
typedef
void
(
*
_ref_fn_t
)(
const
void
*
pObj
);
#define T_REF_DECLARE() \
...
...
@@ -55,4 +60,47 @@ typedef void (*_ref_fn_t)(const void* pObj);
#define T_REF_VAL_GET(x) (x)->_ref.val
#endif // TDENGINE_TREF_H
// single writer multiple reader lock
typedef
int32_t
SRWLatch
;
void
taosInitRWLatch
(
SRWLatch
*
pLatch
);
void
taosWLockLatch
(
SRWLatch
*
pLatch
);
void
taosWUnLockLatch
(
SRWLatch
*
pLatch
);
void
taosRLockLatch
(
SRWLatch
*
pLatch
);
void
taosRUnLockLatch
(
SRWLatch
*
pLatch
);
// copy on read
#define taosCorBeginRead(x) for (uint32_t i_ = 1; 1; ++i_) { \
int32_t old_ = atomic_load_32(x); \
if (old_ & 0x00000001) { \
if (i_ % 1000 == 0) { \
sched_yield(); \
} \
continue; \
}
#define taosCorEndRead(x) \
if (atomic_load_32(x) == old_) { \
break; \
} \
}
#define taosCorBeginWrite(x) taosCorBeginRead(x) \
if (atomic_val_compare_exchange_32((x), old_, old_ + 1) != old_) { \
continue; \
}
#define taosCorEndWrite(x) atomic_add_fetch_32((x), 1); \
break; \
}
#ifdef __cplusplus
}
#endif
#endif
src/util/inc/trwlatch.h
已删除
100644 → 0
浏览文件 @
66bb6617
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __TD_RWLATCH_H__
#define __TD_RWLATCH_H__
#ifdef __cplusplus
extern
"C"
{
#endif
#include <stdint.h>
typedef
int32_t
SRWLatch
;
void
taosInitRWLatch
(
SRWLatch
*
pLatch
);
void
taosWLockLatch
(
SRWLatch
*
pLatch
);
void
taosWUnLockLatch
(
SRWLatch
*
pLatch
);
void
taosRLockLatch
(
SRWLatch
*
pLatch
);
void
taosRUnLockLatch
(
SRWLatch
*
pLatch
);
#ifdef __cplusplus
}
#endif
#endif
src/util/src/t
rwlatch
.c
→
src/util/src/t
lockfree
.c
浏览文件 @
c3e3875b
...
...
@@ -15,8 +15,7 @@
// #define _GNU_SOURCE
// #include <pthread.h>
#include "trwlatch.h"
#include "os.h"
#include "tlockfree.h"
#define TD_RWLATCH_WRITE_FLAG 0x40000000
...
...
src/util/src/ttimer.c
浏览文件 @
c3e3875b
...
...
@@ -24,10 +24,10 @@ extern int32_t tscEmbedded;
#define tmrFatal(...) { if (tmrDebugFlag & DEBUG_FATAL) { taosPrintLog("TMR FATAL ", tscEmbedded ? 255 : tmrDebugFlag, __VA_ARGS__); }}
#define tmrError(...) { if (tmrDebugFlag & DEBUG_ERROR) { taosPrintLog("TMR ERROR ", tscEmbedded ? 255 : tmrDebugFlag, __VA_ARGS__); }}
#define tmrWarn(...) { if (tmrDebugFlag & DEBUG_WARN) { taosPrintLog("TMR WARN
", tscEmbedded ? 255 : tmrDebugFlag, __VA_ARGS__); }}
#define tmrInfo(...) { if (tmrDebugFlag & DEBUG_INFO) { taosPrintLog("TMR
INFO
", tscEmbedded ? 255 : tmrDebugFlag, __VA_ARGS__); }}
#define tmrDebug(...) { if (tmrDebugFlag & DEBUG_DEBUG) { taosPrintLog("TMR
DEBUG
", tmrDebugFlag, __VA_ARGS__); }}
#define tmrTrace(...) { if (tmrDebugFlag & DEBUG_TRACE) { taosPrintLog("TMR
TRACE
", tmrDebugFlag, __VA_ARGS__); }}
#define tmrWarn(...) { if (tmrDebugFlag & DEBUG_WARN) { taosPrintLog("TMR WARN ", tscEmbedded ? 255 : tmrDebugFlag, __VA_ARGS__); }}
#define tmrInfo(...) { if (tmrDebugFlag & DEBUG_INFO) { taosPrintLog("TMR ", tscEmbedded ? 255 : tmrDebugFlag, __VA_ARGS__); }}
#define tmrDebug(...) { if (tmrDebugFlag & DEBUG_DEBUG) { taosPrintLog("TMR ", tmrDebugFlag, __VA_ARGS__); }}
#define tmrTrace(...) { if (tmrDebugFlag & DEBUG_TRACE) { taosPrintLog("TMR ", tmrDebugFlag, __VA_ARGS__); }}
#define TIMER_STATE_WAITING 0
#define TIMER_STATE_EXPIRED 1
...
...
src/vnode/inc/vnodeInt.h
浏览文件 @
c3e3875b
...
...
@@ -29,10 +29,10 @@ extern int32_t vDebugFlag;
#define vFatal(...) { if (vDebugFlag & DEBUG_FATAL) { taosPrintLog("VND FATAL ", 255, __VA_ARGS__); }}
#define vError(...) { if (vDebugFlag & DEBUG_ERROR) { taosPrintLog("VND ERROR ", 255, __VA_ARGS__); }}
#define vWarn(...) { if (vDebugFlag & DEBUG_WARN) { taosPrintLog("VND WARN
", 255, __VA_ARGS__); }}
#define vInfo(...) { if (vDebugFlag & DEBUG_INFO) { taosPrintLog("VND
INFO
", 255, __VA_ARGS__); }}
#define vDebug(...) { if (vDebugFlag & DEBUG_DEBUG) { taosPrintLog("VND
DEBUG
", vDebugFlag, __VA_ARGS__); }}
#define vTrace(...) { if (vDebugFlag & DEBUG_TRACE) { taosPrintLog("VND
TRACE
", vDebugFlag, __VA_ARGS__); }}
#define vWarn(...) { if (vDebugFlag & DEBUG_WARN) { taosPrintLog("VND WARN ", 255, __VA_ARGS__); }}
#define vInfo(...) { if (vDebugFlag & DEBUG_INFO) { taosPrintLog("VND ", 255, __VA_ARGS__); }}
#define vDebug(...) { if (vDebugFlag & DEBUG_DEBUG) { taosPrintLog("VND ", vDebugFlag, __VA_ARGS__); }}
#define vTrace(...) { if (vDebugFlag & DEBUG_TRACE) { taosPrintLog("VND ", vDebugFlag, __VA_ARGS__); }}
typedef
struct
{
int32_t
vgId
;
// global vnode group ID
...
...
src/wal/src/walMain.c
浏览文件 @
c3e3875b
...
...
@@ -35,10 +35,10 @@
#define wFatal(...) { if (wDebugFlag & DEBUG_FATAL) { taosPrintLog("WAL FATAL ", 255, __VA_ARGS__); }}
#define wError(...) { if (wDebugFlag & DEBUG_ERROR) { taosPrintLog("WAL ERROR ", 255, __VA_ARGS__); }}
#define wWarn(...) { if (wDebugFlag & DEBUG_WARN) { taosPrintLog("WAL WARN
", 255, __VA_ARGS__); }}
#define wInfo(...) { if (wDebugFlag & DEBUG_INFO) { taosPrintLog("WAL
INFO
", 255, __VA_ARGS__); }}
#define wDebug(...) { if (wDebugFlag & DEBUG_DEBUG) { taosPrintLog("WAL
DEBUG
", wDebugFlag, __VA_ARGS__); }}
#define wTrace(...) { if (wDebugFlag & DEBUG_TRACE) { taosPrintLog("WAL
TRACE
", wDebugFlag, __VA_ARGS__); }}
#define wWarn(...) { if (wDebugFlag & DEBUG_WARN) { taosPrintLog("WAL WARN ", 255, __VA_ARGS__); }}
#define wInfo(...) { if (wDebugFlag & DEBUG_INFO) { taosPrintLog("WAL ", 255, __VA_ARGS__); }}
#define wDebug(...) { if (wDebugFlag & DEBUG_DEBUG) { taosPrintLog("WAL ", wDebugFlag, __VA_ARGS__); }}
#define wTrace(...) { if (wDebugFlag & DEBUG_TRACE) { taosPrintLog("WAL ", wDebugFlag, __VA_ARGS__); }}
typedef
struct
{
uint64_t
version
;
...
...
tests/pytest/crash_gen.py
浏览文件 @
c3e3875b
...
...
@@ -763,10 +763,16 @@ class DbConnNative(DbConn):
break
return
buildPath
connInfoDisplayed
=
False
def
openByType
(
self
):
# Open connection
cfgPath
=
self
.
getBuildPath
()
+
"/test/cfg"
hostAddr
=
"127.0.0.1"
if
not
self
.
connInfoDisplayed
:
logger
.
info
(
"Initiating TAOS native connection to {}, using config at {}"
.
format
(
hostAddr
,
cfgPath
))
self
.
connInfoDisplayed
=
True
self
.
_conn
=
taos
.
connect
(
host
=
"127.0.0.1"
,
host
=
hostAddr
,
config
=
cfgPath
)
# TODO: make configurable
self
.
_cursor
=
self
.
_conn
.
cursor
()
...
...
tests/pytest/query/queryNullValueTest.py
浏览文件 @
c3e3875b
...
...
@@ -61,71 +61,107 @@ class TDTestCase:
tdSql
.
execute
(
"alter table meters add column col2 tinyint"
)
tdSql
.
execute
(
"alter table meters drop column col1"
)
tdSql
.
query
(
"select * from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select col2 from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
execute
(
"alter table meters add column col1 int"
)
tdSql
.
query
(
"select * from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select col1 from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
execute
(
"alter table meters add column col3 smallint"
)
tdSql
.
query
(
"select * from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select col3 from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
execute
(
"alter table meters add column col4 bigint"
)
tdSql
.
query
(
"select * from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select col4 from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
execute
(
"alter table meters add column col5 float"
)
tdSql
.
query
(
"select * from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select col5 from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
execute
(
"alter table meters add column col6 double"
)
tdSql
.
query
(
"select * from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select col6 from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
execute
(
"alter table meters add column col7 bool"
)
tdSql
.
query
(
"select * from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select col7 from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
execute
(
"alter table meters add column col8 binary(20)"
)
tdSql
.
query
(
"select * from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select col8 from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
execute
(
"alter table meters add column col9 nchar(20)"
)
tdSql
.
query
(
"select * from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select col9 from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
execute
(
"alter table meters add tag tgcol2 tinyint"
)
tdSql
.
query
(
"select * from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select tgcol2 from meters"
)
tdSql
.
checkRows
(
1
)
tdSql
.
execute
(
"alter table meters add tag tgcol3 smallint"
)
tdSql
.
query
(
"select * from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select tgcol3 from meters"
)
tdSql
.
checkRows
(
1
)
tdSql
.
execute
(
"alter table meters add tag tgcol4 bigint"
)
tdSql
.
query
(
"select * from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select tgcol4 from meters"
)
tdSql
.
checkRows
(
1
)
tdSql
.
execute
(
"alter table meters add tag tgcol5 float"
)
tdSql
.
query
(
"select * from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select tgcol5 from meters"
)
tdSql
.
checkRows
(
1
)
tdSql
.
execute
(
"alter table meters add tag tgcol6 double"
)
tdSql
.
query
(
"select * from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select tgcol6 from meters"
)
tdSql
.
checkRows
(
1
)
tdSql
.
execute
(
"alter table meters add tag tgcol7 bool"
)
tdSql
.
query
(
"select * from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select tgcol7 from meters"
)
tdSql
.
checkRows
(
1
)
tdSql
.
execute
(
"alter table meters add tag tgcol8 binary(20)"
)
tdSql
.
query
(
"select * from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select tgcol8 from meters"
)
tdSql
.
checkRows
(
1
)
tdSql
.
execute
(
"alter table meters add tag tgcol9 nchar(20)"
)
tdSql
.
query
(
"select * from meters"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select tgcol9 from meters"
)
tdSql
.
checkRows
(
1
)
self
.
restartTaosd
()
tdSql
.
query
(
"select * from meters"
)
...
...
@@ -133,6 +169,9 @@ class TDTestCase:
if
self
.
checkNullValue
(
tdSql
.
queryResult
)
is
False
:
tdLog
.
exit
(
"non None value is detected"
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
tests/pytest/util/dnodes-no-random-fail.py
浏览文件 @
c3e3875b
...
...
@@ -175,7 +175,8 @@ class TDDnode:
self
.
cfg
(
"logDir"
,
self
.
logDir
)
self
.
cfg
(
"numOfLogLines"
,
"100000000"
)
self
.
cfg
(
"mnodeEqualVnodeNum"
,
"0"
)
self
.
cfg
(
"walLevel"
,
"1"
)
self
.
cfg
(
"walLevel"
,
"2"
)
self
.
cfg
(
"fsync"
,
"1000"
)
self
.
cfg
(
"statusInterval"
,
"1"
)
self
.
cfg
(
"numOfTotalVnodes"
,
"64"
)
self
.
cfg
(
"numOfMnodes"
,
"3"
)
...
...
tests/pytest/util/dnodes-random-fail.py
浏览文件 @
c3e3875b
...
...
@@ -175,7 +175,8 @@ class TDDnode:
self
.
cfg
(
"logDir"
,
self
.
logDir
)
self
.
cfg
(
"numOfLogLines"
,
"100000000"
)
self
.
cfg
(
"mnodeEqualVnodeNum"
,
"0"
)
self
.
cfg
(
"walLevel"
,
"1"
)
self
.
cfg
(
"walLevel"
,
"2"
)
self
.
cfg
(
"fsync"
,
"1000"
)
self
.
cfg
(
"statusInterval"
,
"1"
)
self
.
cfg
(
"numOfTotalVnodes"
,
"64"
)
self
.
cfg
(
"numOfMnodes"
,
"3"
)
...
...
tests/pytest/util/dnodes.py
浏览文件 @
c3e3875b
...
...
@@ -177,7 +177,8 @@ class TDDnode:
self
.
cfg
(
"logDir"
,
self
.
logDir
)
self
.
cfg
(
"numOfLogLines"
,
"100000000"
)
self
.
cfg
(
"mnodeEqualVnodeNum"
,
"0"
)
self
.
cfg
(
"walLevel"
,
"1"
)
self
.
cfg
(
"walLevel"
,
"2"
)
self
.
cfg
(
"fsync"
,
"1000"
)
self
.
cfg
(
"statusInterval"
,
"1"
)
self
.
cfg
(
"numOfTotalVnodes"
,
"64"
)
self
.
cfg
(
"numOfMnodes"
,
"3"
)
...
...
tests/script/sh/deploy.sh
浏览文件 @
c3e3875b
...
...
@@ -110,24 +110,24 @@ echo "second ${HOSTNAME}:7200" >> $TAOS_CFG
echo
"serverPort
${
NODE
}
"
>>
$TAOS_CFG
echo
"dataDir
$DATA_DIR
"
>>
$TAOS_CFG
echo
"logDir
$LOG_DIR
"
>>
$TAOS_CFG
echo
"debugFlag
131"
>>
$TAOS_CFG
echo
"mDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"sdbDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"dDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"vDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"tsdbDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"debugFlag
0"
>>
$TAOS_CFG
echo
"mDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"sdbDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"dDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"vDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"tsdbDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"cDebugFlag 135"
>>
$TAOS_CFG
echo
"jnidebugFlag 13
1
"
>>
$TAOS_CFG
echo
"odbcdebugFlag 13
1
"
>>
$TAOS_CFG
echo
"jnidebugFlag 13
5
"
>>
$TAOS_CFG
echo
"odbcdebugFlag 13
5
"
>>
$TAOS_CFG
echo
"httpDebugFlag 143"
>>
$TAOS_CFG
echo
"monitorDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"mqttDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"qdebugFlag 13
1
"
>>
$TAOS_CFG
echo
"rpcDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"monitorDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"mqttDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"qdebugFlag 13
5
"
>>
$TAOS_CFG
echo
"rpcDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"tmrDebugFlag 131"
>>
$TAOS_CFG
echo
"udebugFlag 1
31
"
>>
$TAOS_CFG
echo
"sdebugFlag 13
1
"
>>
$TAOS_CFG
echo
"wdebugFlag 13
1
"
>>
$TAOS_CFG
echo
"udebugFlag 1
43
"
>>
$TAOS_CFG
echo
"sdebugFlag 13
5
"
>>
$TAOS_CFG
echo
"wdebugFlag 13
5
"
>>
$TAOS_CFG
echo
"monitor 0"
>>
$TAOS_CFG
echo
"monitorInterval 1"
>>
$TAOS_CFG
echo
"http 0"
>>
$TAOS_CFG
...
...
tests/script/tmp/prepare.sim
浏览文件 @
c3e3875b
...
...
@@ -15,21 +15,13 @@ system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1
system sh/cfg.sh -n dnode1 -c activeCode -v eglxDLzRpslJWl7OxrPZ2K3sQ5631AP9SVpezsaz2dhJWl7OxrPZ2ElaXs7Gs9nYSVpezsaz2djGIj5StnQ3ZvLHcsE8cwcN
system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 20
system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 20
system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 20
system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 20
system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 2
system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 2
system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 2
system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 2
system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 100000
system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 100000
system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 100000
...
...
tests/tsim/inc/sim.h
浏览文件 @
c3e3875b
...
...
@@ -53,10 +53,10 @@
#define simFatal(...) { if (simDebugFlag & DEBUG_FATAL) { taosPrintLog("SIM FATAL ", 255, __VA_ARGS__); }}
#define simError(...) { if (simDebugFlag & DEBUG_ERROR) { taosPrintLog("SIM ERROR ", 255, __VA_ARGS__); }}
#define simWarn(...) { if (simDebugFlag & DEBUG_WARN) { taosPrintLog("SIM WARN
", 255, __VA_ARGS__); }}
#define simInfo(...) { if (simDebugFlag & DEBUG_INFO) { taosPrintLog("SIM
INFO
", 255, __VA_ARGS__); }}
#define simDebug(...) { if (simDebugFlag & DEBUG_DEBUG) { taosPrintLog("SIM
DEBUG
", simDebugFlag, __VA_ARGS__); }}
#define simTrace(...) { if (simDebugFlag & DEBUG_TRACE) { taosPrintLog("SIM
TRACE
", simDebugFlag, __VA_ARGS__); }}
#define simWarn(...) { if (simDebugFlag & DEBUG_WARN) { taosPrintLog("SIM WARN ", 255, __VA_ARGS__); }}
#define simInfo(...) { if (simDebugFlag & DEBUG_INFO) { taosPrintLog("SIM ", 255, __VA_ARGS__); }}
#define simDebug(...) { if (simDebugFlag & DEBUG_DEBUG) { taosPrintLog("SIM ", simDebugFlag, __VA_ARGS__); }}
#define simTrace(...) { if (simDebugFlag & DEBUG_TRACE) { taosPrintLog("SIM ", simDebugFlag, __VA_ARGS__); }}
enum
{
SIM_SCRIPT_TYPE_MAIN
,
SIM_SCRIPT_TYPE_BACKGROUND
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录