Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
哥们要飞
TDengine
提交
6a810583
T
TDengine
项目概览
哥们要飞
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
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,发现更多精彩内容 >>
未验证
提交
6a810583
编写于
5月 16, 2021
作者:
S
Shengliang Guan
提交者:
GitHub
5月 16, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #6140 from taosdata/feature/m2d
Feature/m2d
上级
2ba34f5e
34972fbf
变更
20
隐藏空白更改
内联
并排
Showing
20 changed file
with
506 addition
and
250 deletion
+506
-250
src/client/src/tscProfile.c
src/client/src/tscProfile.c
+2
-2
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+9
-4
src/client/tests/timeParseTest.cpp
src/client/tests/timeParseTest.cpp
+2
-2
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBConstants.java
...r/jdbc/src/main/java/com/taosdata/jdbc/TSDBConstants.java
+1
-0
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java
.../src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java
+123
-29
src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/UtcTimestampUtil.java
...c/main/java/com/taosdata/jdbc/utils/UtcTimestampUtil.java
+0
-12
src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/Utils.java
...tor/jdbc/src/main/java/com/taosdata/jdbc/utils/Utils.java
+52
-0
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterRestfulTest.java
...aosdata/jdbc/cases/InsertSpecialCharacterRestfulTest.java
+0
-1
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TD4174Test.java
...dbc/src/test/java/com/taosdata/jdbc/cases/TD4174Test.java
+62
-0
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TwoTypeTimestampPercisionInRestfulTest.java
...ta/jdbc/cases/TwoTypeTimestampPercisionInRestfulTest.java
+4
-2
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberJniTest.java
...t/java/com/taosdata/jdbc/cases/UnsignedNumberJniTest.java
+38
-54
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberRestfulTest.java
...va/com/taosdata/jdbc/cases/UnsignedNumberRestfulTest.java
+52
-53
src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulPreparedStatementTest.java
...va/com/taosdata/jdbc/rs/RestfulPreparedStatementTest.java
+0
-2
src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulResultSetTest.java
.../test/java/com/taosdata/jdbc/rs/RestfulResultSetTest.java
+3
-3
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+150
-77
src/mnode/src/mnodeProfile.c
src/mnode/src/mnodeProfile.c
+3
-2
src/mnode/src/mnodeShow.c
src/mnode/src/mnodeShow.c
+0
-4
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+2
-0
src/rpc/src/rpcMain.c
src/rpc/src/rpcMain.c
+1
-1
src/wal/src/walWrite.c
src/wal/src/walWrite.c
+2
-2
未找到文件。
src/client/src/tscProfile.c
浏览文件 @
6a810583
...
...
@@ -54,14 +54,14 @@ void tscAddIntoSqlList(SSqlObj *pSql) {
pSql
->
next
=
pObj
->
sqlList
;
if
(
pObj
->
sqlList
)
pObj
->
sqlList
->
prev
=
pSql
;
pObj
->
sqlList
=
pSql
;
pSql
->
queryId
=
queryId
++
;
pSql
->
queryId
=
atomic_fetch_add_32
(
&
queryId
,
1
)
;
pthread_mutex_unlock
(
&
pObj
->
mutex
);
pSql
->
stime
=
taosGetTimestampMs
();
pSql
->
listed
=
1
;
tscDebug
(
"0x%"
PRIx64
" added into sqlList
"
,
pSql
->
self
);
tscDebug
(
"0x%"
PRIx64
" added into sqlList
, queryId:%u"
,
pSql
->
self
,
pSql
->
queryId
);
}
void
tscSaveSlowQueryFpCb
(
void
*
param
,
TAOS_RES
*
result
,
int
code
)
{
...
...
src/client/src/tscUtil.c
浏览文件 @
6a810583
...
...
@@ -2859,16 +2859,21 @@ void tscDoQuery(SSqlObj* pSql) {
return
;
}
if
(
pCmd
->
command
==
TSDB_SQL_SELECT
)
{
tscAddIntoSqlList
(
pSql
);
}
if
(
pCmd
->
dataSourceType
==
DATA_FROM_DATA_FILE
)
{
tscImportDataFromFile
(
pSql
);
}
else
{
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfo
(
pCmd
,
pCmd
->
clauseIndex
);
uint16_t
type
=
pQueryInfo
->
type
;
if
((
pCmd
->
command
==
TSDB_SQL_SELECT
)
&&
(
!
TSDB_QUERY_HAS_TYPE
(
type
,
TSDB_QUERY_TYPE_SUBQUERY
))
&&
(
!
TSDB_QUERY_HAS_TYPE
(
type
,
TSDB_QUERY_TYPE_STABLE_SUBQUERY
)))
{
tscAddIntoSqlList
(
pSql
);
}
if
(
TSDB_QUERY_HAS_TYPE
(
type
,
TSDB_QUERY_TYPE_INSERT
))
{
// multi-vnodes insertion
tscHandleMultivnodeInsert
(
pSql
);
return
;
}
if
(
QUERY_IS_JOIN_QUERY
(
type
))
{
if
(
!
TSDB_QUERY_HAS_TYPE
(
type
,
TSDB_QUERY_TYPE_SUBQUERY
))
{
tscHandleMasterJoinQuery
(
pSql
);
...
...
src/client/tests/timeParseTest.cpp
浏览文件 @
6a810583
...
...
@@ -98,7 +98,7 @@ TEST(testCase, parse_time) {
taosParseTime
(
t41
,
&
time
,
strlen
(
t41
),
TSDB_TIME_PRECISION_MILLI
,
0
);
EXPECT_EQ
(
time
,
852048000999
);
int64_t
k
=
timezone
;
//
int64_t k = timezone;
char
t42
[]
=
"1997-1-1T0:0:0.999999999Z"
;
taosParseTime
(
t42
,
&
time
,
strlen
(
t42
),
TSDB_TIME_PRECISION_MILLI
,
0
);
EXPECT_EQ
(
time
,
852048000999
-
timezone
*
MILLISECOND_PER_SECOND
);
...
...
@@ -163,7 +163,7 @@ TEST(testCase, parse_time) {
taosParseTime
(
t13
,
&
time
,
strlen
(
t13
),
TSDB_TIME_PRECISION_MILLI
,
0
);
EXPECT_EQ
(
time
,
-
28800
*
MILLISECOND_PER_SECOND
);
char
*
t
=
"2021-01-08T02:11:40.000+00:00"
;
char
t
[]
=
"2021-01-08T02:11:40.000+00:00"
;
taosParseTime
(
t
,
&
time
,
strlen
(
t
),
TSDB_TIME_PRECISION_MILLI
,
0
);
printf
(
"%ld
\n
"
,
time
);
}
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBConstants.java
浏览文件 @
6a810583
...
...
@@ -30,6 +30,7 @@ public abstract class TSDBConstants {
public
static
final
int
JNI_FETCH_END
=
-
6
;
public
static
final
int
JNI_OUT_OF_MEMORY
=
-
7
;
// TSDB Data Types
public
static
final
int
TSDB_DATA_TYPE_NULL
=
0
;
public
static
final
int
TSDB_DATA_TYPE_BOOL
=
1
;
public
static
final
int
TSDB_DATA_TYPE_TINYINT
=
2
;
public
static
final
int
TSDB_DATA_TYPE_SMALLINT
=
3
;
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java
浏览文件 @
6a810583
...
...
@@ -6,11 +6,13 @@ import com.google.common.primitives.Ints;
import
com.google.common.primitives.Longs
;
import
com.google.common.primitives.Shorts
;
import
com.taosdata.jdbc.*
;
import
com.taosdata.jdbc.utils.Utils
;
import
java.math.BigDecimal
;
import
java.sql.*
;
import
java.time.Instant
;
import
java.time.ZoneOffset
;
import
java.time.format.DateTimeParseException
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
...
...
@@ -18,14 +20,13 @@ public class RestfulResultSet extends AbstractResultSet implements ResultSet {
private
volatile
boolean
isClosed
;
private
int
pos
=
-
1
;
private
final
String
database
;
private
final
Statement
statement
;
// data
private
final
ArrayList
<
ArrayList
<
Object
>>
resultSet
;
private
final
ArrayList
<
ArrayList
<
Object
>>
resultSet
=
new
ArrayList
<>()
;
// meta
private
ArrayList
<
String
>
columnNames
;
private
ArrayList
<
Field
>
columns
;
private
ArrayList
<
String
>
columnNames
=
new
ArrayList
<>()
;
private
ArrayList
<
Field
>
columns
=
new
ArrayList
<>()
;
private
RestfulResultSetMetaData
metaData
;
/**
...
...
@@ -37,10 +38,46 @@ public class RestfulResultSet extends AbstractResultSet implements ResultSet {
this
.
database
=
database
;
this
.
statement
=
statement
;
// column metadata
//
get
column metadata
JSONArray
columnMeta
=
resultJson
.
getJSONArray
(
"column_meta"
);
columnNames
=
new
ArrayList
<>();
columns
=
new
ArrayList
<>();
// get row data
JSONArray
data
=
resultJson
.
getJSONArray
(
"data"
);
if
(
data
==
null
||
data
.
isEmpty
())
{
columnNames
.
clear
();
columns
.
clear
();
this
.
resultSet
.
clear
();
return
;
}
// get head
JSONArray
head
=
resultJson
.
getJSONArray
(
"head"
);
// get rows
Integer
rows
=
resultJson
.
getInteger
(
"rows"
);
// parse column_meta
if
(
columnMeta
!=
null
)
{
parseColumnMeta_new
(
columnMeta
);
}
else
{
parseColumnMeta_old
(
head
,
data
,
rows
);
}
this
.
metaData
=
new
RestfulResultSetMetaData
(
this
.
database
,
columns
,
this
);
// parse row data
resultSet
.
clear
();
for
(
int
rowIndex
=
0
;
rowIndex
<
data
.
size
();
rowIndex
++)
{
ArrayList
row
=
new
ArrayList
();
JSONArray
jsonRow
=
data
.
getJSONArray
(
rowIndex
);
for
(
int
colIndex
=
0
;
colIndex
<
this
.
metaData
.
getColumnCount
();
colIndex
++)
{
row
.
add
(
parseColumnData
(
jsonRow
,
colIndex
,
columns
.
get
(
colIndex
).
taos_type
));
}
resultSet
.
add
(
row
);
}
}
/***
* use this method after TDengine-2.0.18.0 to parse column meta, restful add column_meta in resultSet
* @Param columnMeta
*/
private
void
parseColumnMeta_new
(
JSONArray
columnMeta
)
throws
SQLException
{
columnNames
.
clear
();
columns
.
clear
();
for
(
int
colIndex
=
0
;
colIndex
<
columnMeta
.
size
();
colIndex
++)
{
JSONArray
col
=
columnMeta
.
getJSONArray
(
colIndex
);
String
col_name
=
col
.
getString
(
0
);
...
...
@@ -50,23 +87,55 @@ public class RestfulResultSet extends AbstractResultSet implements ResultSet {
columnNames
.
add
(
col_name
);
columns
.
add
(
new
Field
(
col_name
,
col_type
,
col_length
,
""
,
taos_type
));
}
this
.
metaData
=
new
RestfulResultSetMetaData
(
this
.
database
,
columns
,
this
);
}
// row data
JSONArray
data
=
resultJson
.
getJSONArray
(
"data"
);
resultSet
=
new
ArrayList
<>();
for
(
int
rowIndex
=
0
;
rowIndex
<
data
.
size
();
rowIndex
++)
{
ArrayList
row
=
new
ArrayList
();
JSONArray
jsonRow
=
data
.
getJSONArray
(
rowIndex
);
for
(
int
colIndex
=
0
;
colIndex
<
jsonRow
.
size
();
colIndex
++)
{
row
.
add
(
parseColumnData
(
jsonRow
,
colIndex
,
columns
.
get
(
colIndex
).
taos_type
));
/**
* use this method before TDengine-2.0.18.0 to parse column meta
*/
private
void
parseColumnMeta_old
(
JSONArray
head
,
JSONArray
data
,
int
rows
)
{
columnNames
.
clear
();
columns
.
clear
();
for
(
int
colIndex
=
0
;
colIndex
<
head
.
size
();
colIndex
++)
{
String
col_name
=
head
.
getString
(
colIndex
);
columnNames
.
add
(
col_name
);
int
col_type
=
Types
.
NULL
;
int
col_length
=
0
;
int
taos_type
=
TSDBConstants
.
TSDB_DATA_TYPE_NULL
;
JSONArray
row0Json
=
data
.
getJSONArray
(
0
);
if
(
colIndex
<
row0Json
.
size
())
{
Object
value
=
row0Json
.
get
(
colIndex
);
if
(
value
instanceof
Boolean
)
{
col_type
=
Types
.
BOOLEAN
;
col_length
=
1
;
taos_type
=
TSDBConstants
.
TSDB_DATA_TYPE_BOOL
;
}
if
(
value
instanceof
Byte
||
value
instanceof
Short
||
value
instanceof
Integer
||
value
instanceof
Long
)
{
col_type
=
Types
.
BIGINT
;
col_length
=
8
;
taos_type
=
TSDBConstants
.
TSDB_DATA_TYPE_BIGINT
;
}
if
(
value
instanceof
Float
||
value
instanceof
Double
||
value
instanceof
BigDecimal
)
{
col_type
=
Types
.
DOUBLE
;
col_length
=
8
;
taos_type
=
TSDBConstants
.
TSDB_DATA_TYPE_DOUBLE
;
}
if
(
value
instanceof
String
)
{
col_type
=
Types
.
NCHAR
;
col_length
=
((
String
)
value
).
length
();
taos_type
=
TSDBConstants
.
TSDB_DATA_TYPE_NCHAR
;
}
}
resultSet
.
add
(
row
);
columns
.
add
(
new
Field
(
col_name
,
col_type
,
col_length
,
""
,
taos_type
)
);
}
}
private
Object
parseColumnData
(
JSONArray
row
,
int
colIndex
,
int
taosType
)
throws
SQLException
{
switch
(
taosType
)
{
case
TSDBConstants
.
TSDB_DATA_TYPE_NULL
:
return
null
;
case
TSDBConstants
.
TSDB_DATA_TYPE_BOOL
:
return
row
.
getBoolean
(
colIndex
);
case
TSDBConstants
.
TSDB_DATA_TYPE_TINYINT
:
...
...
@@ -290,8 +359,10 @@ public class RestfulResultSet extends AbstractResultSet implements ResultSet {
return
0
;
}
wasNull
=
false
;
if
(
value
instanceof
Float
||
value
instanceof
Double
)
if
(
value
instanceof
Float
)
return
(
float
)
value
;
if
(
value
instanceof
Double
)
return
new
Float
((
Double
)
value
);
return
Float
.
parseFloat
(
value
.
toString
());
}
...
...
@@ -329,6 +400,9 @@ public class RestfulResultSet extends AbstractResultSet implements ResultSet {
return
Shorts
.
toByteArray
((
short
)
value
);
if
(
value
instanceof
Byte
)
return
new
byte
[]{(
byte
)
value
};
if
(
value
instanceof
Timestamp
)
{
return
Utils
.
formatTimestamp
((
Timestamp
)
value
).
getBytes
();
}
return
value
.
toString
().
getBytes
();
}
...
...
@@ -342,7 +416,9 @@ public class RestfulResultSet extends AbstractResultSet implements ResultSet {
return
null
;
if
(
value
instanceof
Timestamp
)
return
new
Date
(((
Timestamp
)
value
).
getTime
());
return
Date
.
valueOf
(
value
.
toString
());
Date
date
=
null
;
date
=
Utils
.
parseDate
(
value
.
toString
());
return
date
;
}
@Override
...
...
@@ -354,7 +430,13 @@ public class RestfulResultSet extends AbstractResultSet implements ResultSet {
return
null
;
if
(
value
instanceof
Timestamp
)
return
new
Time
(((
Timestamp
)
value
).
getTime
());
return
Time
.
valueOf
(
value
.
toString
());
Time
time
=
null
;
try
{
time
=
Utils
.
parseTime
(
value
.
toString
());
}
catch
(
DateTimeParseException
e
)
{
time
=
null
;
}
return
time
;
}
@Override
...
...
@@ -366,14 +448,20 @@ public class RestfulResultSet extends AbstractResultSet implements ResultSet {
return
null
;
if
(
value
instanceof
Timestamp
)
return
(
Timestamp
)
value
;
// if (value instanceof Long) {
// if (1_0000_0000_0000_0L > (long) value)
// return Timestamp.from(Instant.ofEpochMilli((long) value));
// long epochSec = (long) value / 1000_000L;
// long nanoAdjustment = (long) ((long) value % 1000_000L * 1000);
// return Timestamp.from(Instant.ofEpochSecond(epochSec, nanoAdjustment));
// }
return
Timestamp
.
valueOf
(
value
.
toString
());
if
(
value
instanceof
Long
)
{
if
(
1_0000_0000_0000_0L
>
(
long
)
value
)
return
Timestamp
.
from
(
Instant
.
ofEpochMilli
((
long
)
value
));
long
epochSec
=
(
long
)
value
/
1000_000L
;
long
nanoAdjustment
=
(
long
)
value
%
1000_000L
*
1000
;
return
Timestamp
.
from
(
Instant
.
ofEpochSecond
(
epochSec
,
nanoAdjustment
));
}
Timestamp
ret
;
try
{
ret
=
Utils
.
parseTimestamp
(
value
.
toString
());
}
catch
(
Exception
e
)
{
ret
=
null
;
}
return
ret
;
}
@Override
...
...
@@ -415,7 +503,13 @@ public class RestfulResultSet extends AbstractResultSet implements ResultSet {
return
new
BigDecimal
(
Double
.
valueOf
(
value
.
toString
()));
if
(
value
instanceof
Timestamp
)
return
new
BigDecimal
(((
Timestamp
)
value
).
getTime
());
return
new
BigDecimal
(
value
.
toString
());
BigDecimal
ret
;
try
{
ret
=
new
BigDecimal
(
value
.
toString
());
}
catch
(
Exception
e
)
{
ret
=
null
;
}
return
ret
;
}
@Override
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/UtcTimestampUtil.java
已删除
100644 → 0
浏览文件 @
2ba34f5e
package
com.taosdata.jdbc.utils
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatterBuilder
;
public
class
UtcTimestampUtil
{
public
static
final
DateTimeFormatter
formatter
=
new
DateTimeFormatterBuilder
()
.
appendPattern
(
"yyyy-MM-ddTHH:mm:ss.SSS+"
)
// .appendFraction(ChronoField.NANO_OF_SECOND, 0, 9, true)
.
toFormatter
();
}
src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/Utils.java
浏览文件 @
6a810583
...
...
@@ -5,7 +5,15 @@ import com.google.common.collect.RangeSet;
import
com.google.common.collect.TreeRangeSet
;
import
java.nio.charset.Charset
;
import
java.sql.Date
;
import
java.sql.Time
;
import
java.sql.Timestamp
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalTime
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatterBuilder
;
import
java.time.format.DateTimeParseException
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.regex.Matcher
;
...
...
@@ -17,6 +25,41 @@ public class Utils {
private
static
Pattern
ptn
=
Pattern
.
compile
(
".*?'"
);
private
static
final
DateTimeFormatter
formatter
=
new
DateTimeFormatterBuilder
()
.
appendPattern
(
"yyyy-MM-dd HH:mm:ss.SSS"
).
toFormatter
();
private
static
final
DateTimeFormatter
formatter2
=
new
DateTimeFormatterBuilder
()
.
appendPattern
(
"yyyy-MM-dd HH:mm:ss.SSSSSS"
).
toFormatter
();
public
static
Time
parseTime
(
String
timestampStr
)
throws
DateTimeParseException
{
LocalTime
time
;
try
{
time
=
LocalTime
.
parse
(
timestampStr
,
formatter
);
}
catch
(
DateTimeParseException
e
)
{
time
=
LocalTime
.
parse
(
timestampStr
,
formatter2
);
}
return
Time
.
valueOf
(
time
);
}
public
static
Date
parseDate
(
String
timestampStr
)
throws
DateTimeParseException
{
LocalDate
date
;
try
{
date
=
LocalDate
.
parse
(
timestampStr
,
formatter
);
}
catch
(
DateTimeParseException
e
)
{
date
=
LocalDate
.
parse
(
timestampStr
,
formatter2
);
}
return
Date
.
valueOf
(
date
);
}
public
static
Timestamp
parseTimestamp
(
String
timeStampStr
)
{
LocalDateTime
dateTime
;
try
{
dateTime
=
LocalDateTime
.
parse
(
timeStampStr
,
formatter
);
}
catch
(
DateTimeParseException
e
)
{
dateTime
=
LocalDateTime
.
parse
(
timeStampStr
,
formatter2
);
}
return
Timestamp
.
valueOf
(
dateTime
);
}
public
static
String
escapeSingleQuota
(
String
origin
)
{
Matcher
m
=
ptn
.
matcher
(
origin
);
StringBuffer
sb
=
new
StringBuffer
();
...
...
@@ -133,4 +176,13 @@ public class Utils {
}).
collect
(
Collectors
.
joining
());
}
public
static
String
formatTimestamp
(
Timestamp
timestamp
)
{
int
nanos
=
timestamp
.
getNanos
();
if
(
nanos
%
1000000
l
!=
0
)
return
timestamp
.
toLocalDateTime
().
format
(
formatter2
);
return
timestamp
.
toLocalDateTime
().
format
(
formatter
);
}
}
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterRestfulTest.java
浏览文件 @
6a810583
...
...
@@ -7,7 +7,6 @@ import java.sql.*;
public
class
InsertSpecialCharacterRestfulTest
{
private
static
final
String
host
=
"127.0.0.1"
;
// private static final String host = "master";
private
static
Connection
conn
;
private
static
String
dbName
=
"spec_char_test"
;
private
static
String
tbname1
=
"test"
;
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TD4174Test.java
0 → 100644
浏览文件 @
6a810583
package
com.taosdata.jdbc.cases
;
import
com.alibaba.fastjson.JSONObject
;
import
com.taosdata.jdbc.TSDBDriver
;
import
org.junit.*
;
import
java.sql.*
;
import
java.util.Properties
;
public
class
TD4174Test
{
private
Connection
conn
;
private
static
final
String
host
=
"127.0.0.1"
;
@Test
public
void
test
()
{
long
ts
=
System
.
currentTimeMillis
();
try
(
PreparedStatement
pstmt
=
conn
.
prepareStatement
(
"insert into weather values("
+
ts
+
", ?)"
))
{
JSONObject
value
=
new
JSONObject
();
value
.
put
(
"name"
,
"John Smith"
);
value
.
put
(
"age"
,
20
);
Assert
.
assertEquals
(
"{\"name\":\"John Smith\",\"age\":20}"
,
value
.
toJSONString
());
pstmt
.
setString
(
1
,
value
.
toJSONString
());
int
ret
=
pstmt
.
executeUpdate
();
Assert
.
assertEquals
(
1
,
ret
);
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
public
static
void
main
(
String
[]
args
)
{
JSONObject
value
=
new
JSONObject
();
value
.
put
(
"name"
,
"John Smith"
);
value
.
put
(
"age"
,
20
);
System
.
out
.
println
(
value
.
toJSONString
());
}
@Before
public
void
before
()
throws
SQLException
{
String
url
=
"jdbc:TAOS://"
+
host
+
":6030/?user=root&password=taosdata"
;
Properties
properties
=
new
Properties
();
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"
);
conn
=
DriverManager
.
getConnection
(
url
,
properties
);
try
(
Statement
stmt
=
conn
.
createStatement
())
{
stmt
.
execute
(
"drop database if exists td4174"
);
stmt
.
execute
(
"create database if not exists td4174"
);
stmt
.
execute
(
"use td4174"
);
stmt
.
execute
(
"create table weather(ts timestamp, text binary(64))"
);
}
}
@After
public
void
after
()
throws
SQLException
{
if
(
conn
!=
null
)
conn
.
close
();
}
}
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TwoTypeTimestampPercisionInRestfulTest.java
浏览文件 @
6a810583
...
...
@@ -13,6 +13,7 @@ import java.util.Properties;
public
class
TwoTypeTimestampPercisionInRestfulTest
{
private
static
final
String
host
=
"127.0.0.1"
;
private
static
final
String
ms_timestamp_db
=
"ms_precision_test"
;
private
static
final
String
us_timestamp_db
=
"us_precision_test"
;
private
static
final
long
timestamp1
=
System
.
currentTimeMillis
();
...
...
@@ -94,7 +95,8 @@ public class TwoTypeTimestampPercisionInRestfulTest {
try
(
Statement
stmt
=
conn3
.
createStatement
())
{
ResultSet
rs
=
stmt
.
executeQuery
(
"select last_row(ts) from "
+
ms_timestamp_db
+
".weather"
);
rs
.
next
();
long
ts
=
rs
.
getTimestamp
(
1
).
getTime
();
Timestamp
actual
=
rs
.
getTimestamp
(
1
);
long
ts
=
actual
==
null
?
0
:
actual
.
getTime
();
Assert
.
assertEquals
(
timestamp1
,
ts
);
ts
=
rs
.
getLong
(
1
);
Assert
.
assertEquals
(
timestamp1
,
ts
);
...
...
@@ -110,7 +112,7 @@ public class TwoTypeTimestampPercisionInRestfulTest {
rs
.
next
();
Timestamp
timestamp
=
rs
.
getTimestamp
(
1
);
long
ts
=
timestamp
.
getTime
();
long
ts
=
timestamp
==
null
?
0
:
timestamp
.
getTime
();
Assert
.
assertEquals
(
timestamp1
,
ts
);
int
nanos
=
timestamp
.
getNanos
();
Assert
.
assertEquals
(
timestamp2
%
1000_000
l
*
1000
,
nanos
);
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberJniTest.java
浏览文件 @
6a810583
...
...
@@ -9,19 +9,19 @@ import java.util.Properties;
@FixMethodOrder
(
MethodSorters
.
NAME_ASCENDING
)
public
class
UnsignedNumberJniTest
{
private
static
final
String
host
=
"127.0.0.1"
;
private
static
Connection
conn
;
private
static
long
ts
;
@Test
public
void
testCase001
()
{
try
(
Statement
stmt
=
conn
.
createStatement
())
{
ResultSet
rs
=
stmt
.
executeQuery
(
"select * from us_table"
);
ResultSetMetaData
meta
=
rs
.
getMetaData
();
assertResultSetMetaData
(
meta
);
while
(
rs
.
next
())
{
for
(
int
i
=
1
;
i
<=
meta
.
getColumnCount
();
i
++)
{
System
.
out
.
print
(
meta
.
getColumnLabel
(
i
)
+
": "
+
rs
.
getString
(
i
)
+
"\t"
);
}
System
.
out
.
println
();
Assert
.
assertEquals
(
ts
,
rs
.
getTimestamp
(
1
).
getTime
());
Assert
.
assertEquals
(
"127"
,
rs
.
getString
(
2
));
Assert
.
assertEquals
(
"32767"
,
rs
.
getString
(
3
));
Assert
.
assertEquals
(
"2147483647"
,
rs
.
getString
(
4
));
...
...
@@ -37,13 +37,10 @@ public class UnsignedNumberJniTest {
try
(
Statement
stmt
=
conn
.
createStatement
())
{
ResultSet
rs
=
stmt
.
executeQuery
(
"select * from us_table"
);
ResultSetMetaData
meta
=
rs
.
getMetaData
();
assertResultSetMetaData
(
meta
);
while
(
rs
.
next
())
{
System
.
out
.
print
(
meta
.
getColumnLabel
(
1
)
+
": "
+
rs
.
getTimestamp
(
1
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
2
)
+
": "
+
rs
.
getByte
(
2
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
3
)
+
": "
+
rs
.
getShort
(
3
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
4
)
+
": "
+
rs
.
getInt
(
4
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
5
)
+
": "
+
rs
.
getLong
(
5
)
+
"\t"
);
System
.
out
.
println
();
Assert
.
assertEquals
(
ts
,
rs
.
getTimestamp
(
1
).
getTime
());
Assert
.
assertEquals
(
127
,
rs
.
getByte
(
2
));
Assert
.
assertEquals
(
32767
,
rs
.
getShort
(
3
));
Assert
.
assertEquals
(
2147483647
,
rs
.
getInt
(
4
));
...
...
@@ -61,16 +58,14 @@ public class UnsignedNumberJniTest {
stmt
.
executeUpdate
(
"insert into us_table(ts,f1,f2,f3,f4) values("
+
now
+
", 127, 32767,2147483647, 18446744073709551614)"
);
ResultSet
rs
=
stmt
.
executeQuery
(
"select * from us_table where ts = "
+
now
);
ResultSetMetaData
meta
=
rs
.
getMetaData
();
assertResultSetMetaData
(
meta
);
while
(
rs
.
next
())
{
System
.
out
.
print
(
meta
.
getColumnLabel
(
1
)
+
": "
+
rs
.
getTimestamp
(
1
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
2
)
+
": "
+
rs
.
getByte
(
2
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
3
)
+
": "
+
rs
.
getShort
(
3
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
4
)
+
": "
+
rs
.
getInt
(
4
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
5
)
+
": "
+
rs
.
getLong
(
5
)
+
"\t"
);
System
.
out
.
println
();
Assert
.
assertEquals
(
now
,
rs
.
getTimestamp
(
1
).
getTime
());
Assert
.
assertEquals
(
127
,
rs
.
getByte
(
2
));
Assert
.
assertEquals
(
32767
,
rs
.
getShort
(
3
));
Assert
.
assertEquals
(
2147483647
,
rs
.
getInt
(
4
));
Assert
.
assertEquals
(
"18446744073709551614"
,
rs
.
getString
(
5
));
rs
.
getLong
(
5
);
}
}
}
...
...
@@ -82,15 +77,15 @@ public class UnsignedNumberJniTest {
stmt
.
executeUpdate
(
"insert into us_table(ts,f1,f2,f3,f4) values("
+
now
+
", 127, 32767,4294967294, 18446744073709551614)"
);
ResultSet
rs
=
stmt
.
executeQuery
(
"select * from us_table where ts = "
+
now
);
ResultSetMetaData
meta
=
rs
.
getMetaData
();
assertResultSetMetaData
(
meta
);
while
(
rs
.
next
())
{
System
.
out
.
print
(
meta
.
getColumnLabel
(
1
)
+
": "
+
rs
.
getTimestamp
(
1
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
2
)
+
": "
+
rs
.
getByte
(
2
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
3
)
+
": "
+
rs
.
getShort
(
3
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
4
)
+
": "
+
rs
.
getInt
(
4
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
5
)
+
": "
+
rs
.
getLong
(
5
)
+
"\t"
);
System
.
out
.
println
();
Assert
.
assertEquals
(
now
,
rs
.
getTimestamp
(
1
).
getTime
());
Assert
.
assertEquals
(
127
,
rs
.
getByte
(
2
));
Assert
.
assertEquals
(
32767
,
rs
.
getShort
(
3
));
Assert
.
assertEquals
(
"4294967294"
,
rs
.
getString
(
4
));
Assert
.
assertEquals
(
"18446744073709551614"
,
rs
.
getString
(
5
));
rs
.
getInt
(
4
);
}
}
}
...
...
@@ -102,15 +97,15 @@ public class UnsignedNumberJniTest {
stmt
.
executeUpdate
(
"insert into us_table(ts,f1,f2,f3,f4) values("
+
now
+
", 127, 65534,4294967294, 18446744073709551614)"
);
ResultSet
rs
=
stmt
.
executeQuery
(
"select * from us_table where ts = "
+
now
);
ResultSetMetaData
meta
=
rs
.
getMetaData
();
while
(
rs
.
next
())
{
System
.
out
.
print
(
meta
.
getColumnLabel
(
1
)
+
": "
+
rs
.
getTimestamp
(
1
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
2
)
+
": "
+
rs
.
getByte
(
2
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
3
)
+
": "
+
rs
.
getShort
(
3
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
4
)
+
": "
+
rs
.
getInt
(
4
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
5
)
+
": "
+
rs
.
getLong
(
5
)
+
"\t"
);
System
.
out
.
println
();
assertResultSetMetaData
(
meta
);
while
(
rs
.
next
())
{
Assert
.
assertEquals
(
now
,
rs
.
getTimestamp
(
1
).
getTime
());
Assert
.
assertEquals
(
127
,
rs
.
getByte
(
2
));
Assert
.
assertEquals
(
"65534"
,
rs
.
getString
(
3
));
Assert
.
assertEquals
(
"4294967294"
,
rs
.
getString
(
4
));
Assert
.
assertEquals
(
"18446744073709551614"
,
rs
.
getString
(
5
));
rs
.
getShort
(
3
);
}
}
}
...
...
@@ -122,37 +117,27 @@ public class UnsignedNumberJniTest {
stmt
.
executeUpdate
(
"insert into us_table(ts,f1,f2,f3,f4) values("
+
now
+
", 254, 65534,4294967294, 18446744073709551614)"
);
ResultSet
rs
=
stmt
.
executeQuery
(
"select * from us_table where ts = "
+
now
);
ResultSetMetaData
meta
=
rs
.
getMetaData
();
while
(
rs
.
next
())
{
System
.
out
.
print
(
meta
.
getColumnLabel
(
1
)
+
": "
+
rs
.
getTimestamp
(
1
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
2
)
+
": "
+
rs
.
getByte
(
2
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
3
)
+
": "
+
rs
.
getShort
(
3
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
4
)
+
": "
+
rs
.
getInt
(
4
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
5
)
+
": "
+
rs
.
getLong
(
5
)
+
"\t"
);
System
.
out
.
println
();
}
}
}
assertResultSetMetaData
(
meta
);
@Test
public
void
testCase007
()
throws
SQLException
{
try
(
Statement
stmt
=
conn
.
createStatement
())
{
long
now
=
System
.
currentTimeMillis
();
stmt
.
executeUpdate
(
"insert into us_table(ts,f1,f2,f3,f4) values("
+
now
+
", 254, 65534,4294967294, 18446744073709551614)"
);
ResultSet
rs
=
stmt
.
executeQuery
(
"select * from us_table where ts = "
+
now
);
ResultSetMetaData
meta
=
rs
.
getMetaData
();
while
(
rs
.
next
())
{
for
(
int
i
=
1
;
i
<=
meta
.
getColumnCount
();
i
++)
{
System
.
out
.
print
(
meta
.
getColumnLabel
(
i
)
+
": "
+
rs
.
getString
(
i
)
+
"\t"
);
}
System
.
out
.
println
();
Assert
.
assertEquals
(
now
,
rs
.
getTimestamp
(
1
).
getTime
());
Assert
.
assertEquals
(
"254"
,
rs
.
getString
(
2
));
Assert
.
assertEquals
(
"65534"
,
rs
.
getString
(
3
));
Assert
.
assertEquals
(
"4294967294"
,
rs
.
getString
(
4
));
Assert
.
assertEquals
(
"18446744073709551614"
,
rs
.
getString
(
5
));
rs
.
getByte
(
2
);
}
}
}
private
void
assertResultSetMetaData
(
ResultSetMetaData
meta
)
throws
SQLException
{
Assert
.
assertEquals
(
5
,
meta
.
getColumnCount
());
Assert
.
assertEquals
(
"ts"
,
meta
.
getColumnLabel
(
1
));
Assert
.
assertEquals
(
"f1"
,
meta
.
getColumnLabel
(
2
));
Assert
.
assertEquals
(
"f2"
,
meta
.
getColumnLabel
(
3
));
Assert
.
assertEquals
(
"f3"
,
meta
.
getColumnLabel
(
4
));
Assert
.
assertEquals
(
"f4"
,
meta
.
getColumnLabel
(
5
));
}
@BeforeClass
public
static
void
beforeClass
()
{
...
...
@@ -160,20 +145,19 @@ public class UnsignedNumberJniTest {
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"
);
ts
=
System
.
currentTimeMillis
();
try
{
Class
.
forName
(
"com.taosdata.jdbc.TSDBDriver"
);
final
String
url
=
"jdbc:TAOS://"
+
host
+
":6030/?user=root&password=taosdata"
;
conn
=
DriverManager
.
getConnection
(
url
,
properties
);
Statement
stmt
=
conn
.
createStatement
();
stmt
.
execute
(
"drop database if exists unsign_jni"
);
stmt
.
execute
(
"create database if not exists unsign_jni"
);
stmt
.
execute
(
"use unsign_jni"
);
stmt
.
execute
(
"create table us_table(ts timestamp, f1 tinyint unsigned, f2 smallint unsigned, f3 int unsigned, f4 bigint unsigned)"
);
stmt
.
executeUpdate
(
"insert into us_table(ts,f1,f2,f3,f4) values(
now
, 127, 32767,2147483647, 9223372036854775807)"
);
stmt
.
executeUpdate
(
"insert into us_table(ts,f1,f2,f3,f4) values(
"
+
ts
+
"
, 127, 32767,2147483647, 9223372036854775807)"
);
stmt
.
close
();
}
catch
(
ClassNotFoundException
|
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberRestfulTest.java
浏览文件 @
6a810583
...
...
@@ -13,17 +13,20 @@ public class UnsignedNumberRestfulTest {
private
static
final
String
host
=
"127.0.0.1"
;
private
static
Connection
conn
;
private
static
long
ts
;
@Test
public
void
testCase001
()
{
try
(
Statement
stmt
=
conn
.
createStatement
())
{
ResultSet
rs
=
stmt
.
executeQuery
(
"select * from us_table"
);
ResultSetMetaData
meta
=
rs
.
getMetaData
();
assertResultSetMetaData
(
meta
);
while
(
rs
.
next
())
{
for
(
int
i
=
1
;
i
<=
meta
.
getColumnCount
();
i
++)
{
System
.
out
.
print
(
meta
.
getColumnLabel
(
i
)
+
": "
+
rs
.
getString
(
i
)
+
"\t"
);
}
System
.
out
.
println
();
Assert
.
assertEquals
(
ts
,
rs
.
getTimestamp
(
1
).
getTime
());
Assert
.
assertEquals
(
"127"
,
rs
.
getString
(
2
));
Assert
.
assertEquals
(
"32767"
,
rs
.
getString
(
3
));
Assert
.
assertEquals
(
"2147483647"
,
rs
.
getString
(
4
));
Assert
.
assertEquals
(
"9223372036854775807"
,
rs
.
getString
(
5
));
}
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
...
...
@@ -35,13 +38,14 @@ public class UnsignedNumberRestfulTest {
try
(
Statement
stmt
=
conn
.
createStatement
())
{
ResultSet
rs
=
stmt
.
executeQuery
(
"select * from us_table"
);
ResultSetMetaData
meta
=
rs
.
getMetaData
();
assertResultSetMetaData
(
meta
);
while
(
rs
.
next
())
{
System
.
out
.
print
(
meta
.
getColumnLabel
(
1
)
+
": "
+
rs
.
getTimestamp
(
1
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
2
)
+
": "
+
rs
.
getByte
(
2
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
3
)
+
": "
+
rs
.
getShort
(
3
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
4
)
+
": "
+
rs
.
getInt
(
4
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
5
)
+
": "
+
rs
.
getLong
(
5
)
+
"\t"
);
System
.
out
.
println
();
Assert
.
assertEquals
(
ts
,
rs
.
getTimestamp
(
1
).
getTime
());
Assert
.
assertEquals
(
127
,
rs
.
getByte
(
2
));
Assert
.
assertEquals
(
32767
,
rs
.
getShort
(
3
));
Assert
.
assertEquals
(
2147483647
,
rs
.
getInt
(
4
));
Assert
.
assertEquals
(
9223372036854775807
l
,
rs
.
getLong
(
5
));
}
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
...
...
@@ -55,13 +59,14 @@ public class UnsignedNumberRestfulTest {
stmt
.
executeUpdate
(
"insert into us_table(ts,f1,f2,f3,f4) values("
+
now
+
", 127, 32767,2147483647, 18446744073709551614)"
);
ResultSet
rs
=
stmt
.
executeQuery
(
"select * from us_table where ts = "
+
now
);
ResultSetMetaData
meta
=
rs
.
getMetaData
();
assertResultSetMetaData
(
meta
);
while
(
rs
.
next
())
{
System
.
out
.
print
(
meta
.
getColumnLabel
(
1
)
+
": "
+
rs
.
getTimestamp
(
1
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
2
)
+
": "
+
rs
.
getByte
(
2
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
3
)
+
": "
+
rs
.
getShort
(
3
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
4
)
+
": "
+
rs
.
getInt
(
4
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
5
)
+
": "
+
rs
.
getLong
(
5
)
+
"\t"
);
System
.
out
.
println
(
);
Assert
.
assertEquals
(
now
,
rs
.
getTimestamp
(
1
).
getTime
()
);
Assert
.
assertEquals
(
127
,
rs
.
getByte
(
2
)
);
Assert
.
assertEquals
(
32767
,
rs
.
getShort
(
3
)
);
Assert
.
assertEquals
(
2147483647
,
rs
.
getInt
(
4
)
);
Assert
.
assertEquals
(
"18446744073709551614"
,
rs
.
getString
(
5
)
);
rs
.
getLong
(
5
);
}
}
}
...
...
@@ -73,13 +78,15 @@ public class UnsignedNumberRestfulTest {
stmt
.
executeUpdate
(
"insert into us_table(ts,f1,f2,f3,f4) values("
+
now
+
", 127, 32767,4294967294, 18446744073709551614)"
);
ResultSet
rs
=
stmt
.
executeQuery
(
"select * from us_table where ts = "
+
now
);
ResultSetMetaData
meta
=
rs
.
getMetaData
();
assertResultSetMetaData
(
meta
);
while
(
rs
.
next
())
{
System
.
out
.
print
(
meta
.
getColumnLabel
(
1
)
+
": "
+
rs
.
getTimestamp
(
1
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
2
)
+
": "
+
rs
.
getByte
(
2
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
3
)
+
": "
+
rs
.
getShort
(
3
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
4
)
+
": "
+
rs
.
getInt
(
4
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
5
)
+
": "
+
rs
.
getLong
(
5
)
+
"\t"
);
System
.
out
.
println
(
);
Assert
.
assertEquals
(
now
,
rs
.
getTimestamp
(
1
).
getTime
()
);
Assert
.
assertEquals
(
127
,
rs
.
getByte
(
2
)
);
Assert
.
assertEquals
(
32767
,
rs
.
getShort
(
3
)
);
Assert
.
assertEquals
(
"4294967294"
,
rs
.
getString
(
4
)
);
Assert
.
assertEquals
(
"18446744073709551614"
,
rs
.
getString
(
5
)
);
rs
.
getInt
(
4
);
}
}
}
...
...
@@ -91,13 +98,15 @@ public class UnsignedNumberRestfulTest {
stmt
.
executeUpdate
(
"insert into us_table(ts,f1,f2,f3,f4) values("
+
now
+
", 127, 65534,4294967294, 18446744073709551614)"
);
ResultSet
rs
=
stmt
.
executeQuery
(
"select * from us_table where ts = "
+
now
);
ResultSetMetaData
meta
=
rs
.
getMetaData
();
assertResultSetMetaData
(
meta
);
while
(
rs
.
next
())
{
System
.
out
.
print
(
meta
.
getColumnLabel
(
1
)
+
": "
+
rs
.
getTimestamp
(
1
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
2
)
+
": "
+
rs
.
getByte
(
2
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
3
)
+
": "
+
rs
.
getShort
(
3
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
4
)
+
": "
+
rs
.
getInt
(
4
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
5
)
+
": "
+
rs
.
getLong
(
5
)
+
"\t"
);
System
.
out
.
println
(
);
Assert
.
assertEquals
(
now
,
rs
.
getTimestamp
(
1
).
getTime
()
);
Assert
.
assertEquals
(
127
,
rs
.
getByte
(
2
)
);
Assert
.
assertEquals
(
"65534"
,
rs
.
getString
(
3
)
);
Assert
.
assertEquals
(
"4294967294"
,
rs
.
getString
(
4
)
);
Assert
.
assertEquals
(
"18446744073709551614"
,
rs
.
getString
(
5
)
);
rs
.
getShort
(
3
);
}
}
}
...
...
@@ -109,57 +118,47 @@ public class UnsignedNumberRestfulTest {
stmt
.
executeUpdate
(
"insert into us_table(ts,f1,f2,f3,f4) values("
+
now
+
", 254, 65534,4294967294, 18446744073709551614)"
);
ResultSet
rs
=
stmt
.
executeQuery
(
"select * from us_table where ts = "
+
now
);
ResultSetMetaData
meta
=
rs
.
getMetaData
();
while
(
rs
.
next
())
{
System
.
out
.
print
(
meta
.
getColumnLabel
(
1
)
+
": "
+
rs
.
getTimestamp
(
1
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
2
)
+
": "
+
rs
.
getByte
(
2
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
3
)
+
": "
+
rs
.
getShort
(
3
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
4
)
+
": "
+
rs
.
getInt
(
4
)
+
"\t"
);
System
.
out
.
print
(
meta
.
getColumnLabel
(
5
)
+
": "
+
rs
.
getLong
(
5
)
+
"\t"
);
System
.
out
.
println
();
}
}
}
assertResultSetMetaData
(
meta
);
@Test
public
void
testCase007
()
throws
SQLException
{
try
(
Statement
stmt
=
conn
.
createStatement
())
{
long
now
=
System
.
currentTimeMillis
();
stmt
.
executeUpdate
(
"insert into us_table(ts,f1,f2,f3,f4) values("
+
now
+
", 254, 65534,4294967294, 18446744073709551614)"
);
ResultSet
rs
=
stmt
.
executeQuery
(
"select * from us_table where ts = "
+
now
);
ResultSetMetaData
meta
=
rs
.
getMetaData
();
while
(
rs
.
next
())
{
for
(
int
i
=
1
;
i
<=
meta
.
getColumnCount
();
i
++)
{
System
.
out
.
print
(
meta
.
getColumnLabel
(
i
)
+
": "
+
rs
.
getString
(
i
)
+
"\t"
);
}
System
.
out
.
println
();
Assert
.
assertEquals
(
now
,
rs
.
getTimestamp
(
1
).
getTime
());
Assert
.
assertEquals
(
"254"
,
rs
.
getString
(
2
));
Assert
.
assertEquals
(
"65534"
,
rs
.
getString
(
3
));
Assert
.
assertEquals
(
"4294967294"
,
rs
.
getString
(
4
));
Assert
.
assertEquals
(
"18446744073709551614"
,
rs
.
getString
(
5
));
rs
.
getByte
(
2
);
}
}
}
private
void
assertResultSetMetaData
(
ResultSetMetaData
meta
)
throws
SQLException
{
Assert
.
assertEquals
(
5
,
meta
.
getColumnCount
());
Assert
.
assertEquals
(
"ts"
,
meta
.
getColumnLabel
(
1
));
Assert
.
assertEquals
(
"f1"
,
meta
.
getColumnLabel
(
2
));
Assert
.
assertEquals
(
"f2"
,
meta
.
getColumnLabel
(
3
));
Assert
.
assertEquals
(
"f3"
,
meta
.
getColumnLabel
(
4
));
Assert
.
assertEquals
(
"f4"
,
meta
.
getColumnLabel
(
5
));
}
@BeforeClass
public
static
void
beforeClass
()
{
Properties
properties
=
new
Properties
();
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"
);
ts
=
System
.
currentTimeMillis
();
try
{
Class
.
forName
(
"com.taosdata.jdbc.rs.RestfulDriver"
);
final
String
url
=
"jdbc:TAOS-RS://"
+
host
+
":6041/?user=root&password=taosdata"
;
conn
=
DriverManager
.
getConnection
(
url
,
properties
);
Statement
stmt
=
conn
.
createStatement
();
stmt
.
execute
(
"drop database if exists unsign_restful"
);
stmt
.
execute
(
"create database if not exists unsign_restful"
);
stmt
.
execute
(
"use unsign_restful"
);
stmt
.
execute
(
"create table us_table(ts timestamp, f1 tinyint unsigned, f2 smallint unsigned, f3 int unsigned, f4 bigint unsigned)"
);
stmt
.
executeUpdate
(
"insert into us_table(ts,f1,f2,f3,f4) values(
now
, 127, 32767,2147483647, 9223372036854775807)"
);
stmt
.
executeUpdate
(
"insert into us_table(ts,f1,f2,f3,f4) values(
"
+
ts
+
"
, 127, 32767,2147483647, 9223372036854775807)"
);
stmt
.
close
();
}
catch
(
ClassNotFoundException
|
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulPreparedStatementTest.java
浏览文件 @
6a810583
...
...
@@ -10,7 +10,6 @@ import java.sql.*;
public
class
RestfulPreparedStatementTest
{
private
static
final
String
host
=
"127.0.0.1"
;
// private static final String host = "master";
private
static
Connection
conn
;
private
static
final
String
sql_insert
=
"insert into t1 values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
;
private
static
PreparedStatement
pstmt_insert
;
...
...
@@ -371,7 +370,6 @@ public class RestfulPreparedStatementTest {
pstmt_insert
.
setSQLXML
(
1
,
null
);
}
@BeforeClass
public
static
void
beforeClass
()
{
try
{
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulResultSetTest.java
浏览文件 @
6a810583
...
...
@@ -18,7 +18,6 @@ import java.text.SimpleDateFormat;
public
class
RestfulResultSetTest
{
private
static
final
String
host
=
"127.0.0.1"
;
private
static
Connection
conn
;
private
static
Statement
stmt
;
private
static
ResultSet
rs
;
...
...
@@ -95,7 +94,8 @@ public class RestfulResultSetTest {
@Test
public
void
getBigDecimal
()
throws
SQLException
{
BigDecimal
f1
=
rs
.
getBigDecimal
(
"f1"
);
Assert
.
assertEquals
(
1609430400000
l
,
f1
.
longValue
());
long
actual
=
(
f1
==
null
)
?
0
:
f1
.
longValue
();
Assert
.
assertEquals
(
1609430400000
l
,
actual
);
BigDecimal
f2
=
rs
.
getBigDecimal
(
"f2"
);
Assert
.
assertEquals
(
1
,
f2
.
intValue
());
...
...
@@ -119,7 +119,7 @@ public class RestfulResultSetTest {
@Test
public
void
getBytes
()
throws
SQLException
{
byte
[]
f1
=
rs
.
getBytes
(
"f1"
);
Assert
.
assertEquals
(
"2021-01-01 00:00:00.0"
,
new
String
(
f1
));
Assert
.
assertEquals
(
"2021-01-01 00:00:00.0
00
"
,
new
String
(
f1
));
byte
[]
f2
=
rs
.
getBytes
(
"f2"
);
Assert
.
assertEquals
(
1
,
Ints
.
fromByteArray
(
f2
));
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
6a810583
...
...
@@ -120,11 +120,18 @@ enum MODE {
MODE_BUT
};
typedef
enum
enum_INSERT_MODE
{
enum
enum_TAOS_INTERFACE
{
TAOSC_IFACE
,
REST_IFACE
,
STMT_IFACE
,
INTERFACE_BUT
};
typedef
enum
enum_PROGRESSIVE_OR_INTERLACE
{
PROGRESSIVE_INSERT_MODE
,
INTERLACE_INSERT_MODE
,
INVALID_INSERT_MODE
}
INSERT
_MODE
;
}
PROG_OR_INTERLACE
_MODE
;
typedef
enum
enumQUERY_TYPE
{
NO_INSERT_TYPE
,
...
...
@@ -188,6 +195,7 @@ typedef struct SArguments_S {
uint32_t
test_mode
;
char
*
host
;
uint16_t
port
;
uint16_t
iface
;
char
*
user
;
char
*
password
;
char
*
database
;
...
...
@@ -238,7 +246,7 @@ typedef struct SSuperTable_S {
uint8_t
autoCreateTable
;
// 0: create sub table, 1: auto create sub table
char
childTblPrefix
[
MAX_TB_NAME_SIZE
];
char
dataSource
[
MAX_TB_NAME_SIZE
+
1
];
// rand_gen or sample
char
insertMode
[
MAX_TB_NAME_SIZE
];
// taosc, res
t
uint16_t
insertMode
;
// 0: taosc, 1: rest, 2: stm
t
int64_t
childTblLimit
;
uint64_t
childTblOffset
;
...
...
@@ -405,6 +413,7 @@ typedef struct SQueryMetaInfo_S {
typedef
struct
SThreadInfo_S
{
TAOS
*
taos
;
TAOS_STMT
*
stmt
;
int
threadID
;
char
db_name
[
MAX_DB_NAME_SIZE
+
1
];
uint32_t
time_precision
;
...
...
@@ -418,6 +427,7 @@ typedef struct SThreadInfo_S {
char
*
cols
;
bool
use_metric
;
SSuperTable
*
superTblInfo
;
char
*
buffer
;
// sql cmd buffer
// for async insert
tsem_t
lock_sem
;
...
...
@@ -536,6 +546,7 @@ SArguments g_args = {
0
,
// test_mode
"127.0.0.1"
,
// host
6030
,
// port
TAOSC_IFACE
,
// iface
"root"
,
// user
#ifdef _TD_POWER_
"powerdb"
,
// password
...
...
@@ -652,6 +663,8 @@ static void printHelp() {
"The host to connect to TDengine. Default is localhost."
);
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-p"
,
indent
,
"The TCP/IP port number to use for the connection. Default is 0."
);
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-I"
,
indent
,
"The interface (taosc, rest, and stmt) taosdemo uses. Default is 'taosc'."
);
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-d"
,
indent
,
"Destination database. Default is 'test'."
);
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-a"
,
indent
,
...
...
@@ -740,6 +753,23 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
exit
(
EXIT_FAILURE
);
}
arguments
->
port
=
atoi
(
argv
[
++
i
]);
}
else
if
(
strcmp
(
argv
[
i
],
"-I"
)
==
0
)
{
if
(
argc
==
i
+
1
)
{
printHelp
();
errorPrint
(
"%s"
,
"
\n\t
-I need a valid string following!
\n
"
);
exit
(
EXIT_FAILURE
);
}
++
i
;
if
(
0
==
strcasecmp
(
argv
[
i
],
"taosc"
))
{
arguments
->
iface
=
TAOSC_IFACE
;
}
else
if
(
0
==
strcasecmp
(
argv
[
i
],
"rest"
))
{
arguments
->
iface
=
REST_IFACE
;
}
else
if
(
0
==
strcasecmp
(
argv
[
i
],
"stmt"
))
{
arguments
->
iface
=
STMT_IFACE
;
}
else
{
errorPrint
(
"%s"
,
"
\n\t
-I need a valid string following!
\n
"
);
exit
(
EXIT_FAILURE
);
}
}
else
if
(
strcmp
(
argv
[
i
],
"-u"
)
==
0
)
{
if
(
argc
==
i
+
1
)
{
printHelp
();
...
...
@@ -997,7 +1027,8 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
arguments
->
port
);
printf
(
"# User: %s
\n
"
,
arguments
->
user
);
printf
(
"# Password: %s
\n
"
,
arguments
->
password
);
printf
(
"# Use metric: %s
\n
"
,
arguments
->
use_metric
?
"true"
:
"false"
);
printf
(
"# Use metric: %s
\n
"
,
arguments
->
use_metric
?
"true"
:
"false"
);
if
(
*
(
arguments
->
datatype
))
{
printf
(
"# Specified data type: "
);
for
(
int
i
=
0
;
i
<
MAX_NUM_DATATYPE
;
i
++
)
...
...
@@ -1059,7 +1090,7 @@ static int queryDbExec(TAOS *taos, char *command, QUERY_TYPE type, bool quiet) {
TAOS_RES
*
res
=
NULL
;
int32_t
code
=
-
1
;
for
(
i
=
0
;
i
<
5
;
i
++
)
{
for
(
i
=
0
;
i
<
5
/* retry */
;
i
++
)
{
if
(
NULL
!=
res
)
{
taos_free_result
(
res
);
res
=
NULL
;
...
...
@@ -1105,7 +1136,6 @@ static void appendResultBufToFile(char *resultBuf, char *resultFile)
}
}
fprintf
(
fp
,
"%s"
,
resultBuf
);
tmfclose
(
fp
);
}
...
...
@@ -1146,8 +1176,8 @@ static void appendResultToFile(TAOS_RES *res, char* resultFile) {
free
(
databuf
);
}
static
void
selectAndGetResult
(
threadInfo
*
pThreadInfo
,
char
*
command
,
char
*
resultFile
)
{
static
void
selectAndGetResult
(
threadInfo
*
pThreadInfo
,
char
*
command
,
char
*
resultFile
)
{
if
(
0
==
strncasecmp
(
g_queryInfo
.
queryMode
,
"taosc"
,
strlen
(
"taosc"
)))
{
TAOS_RES
*
res
=
taos_query
(
pThreadInfo
->
taos
,
command
);
if
(
res
==
NULL
||
taos_errno
(
res
)
!=
0
)
{
...
...
@@ -1291,6 +1321,8 @@ static void init_rand_data() {
static
int
printfInsertMeta
()
{
SHOW_PARSE_RESULT_START
();
printf
(
"interface:
\033
[33m%s
\033
[0m
\n
"
,
(
g_args
.
iface
==
TAOSC_IFACE
)
?
"taosc"
:
(
g_args
.
iface
==
REST_IFACE
)
?
"rest"
:
"stmt"
);
printf
(
"host:
\033
[33m%s:%u
\033
[0m
\n
"
,
g_Dbs
.
host
,
g_Dbs
.
port
);
printf
(
"user:
\033
[33m%s
\033
[0m
\n
"
,
g_Dbs
.
user
);
printf
(
"password:
\033
[33m%s
\033
[0m
\n
"
,
g_Dbs
.
password
);
...
...
@@ -1395,7 +1427,8 @@ static int printfInsertMeta() {
printf
(
" dataSource:
\033
[33m%s
\033
[0m
\n
"
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
dataSource
);
printf
(
" insertMode:
\033
[33m%s
\033
[0m
\n
"
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insertMode
);
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insertMode
==
TAOSC_IFACE
)
?
"taosc"
:
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insertMode
==
REST_IFACE
)
?
"rest"
:
"stmt"
);
if
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblLimit
>
0
)
{
printf
(
" childTblLimit:
\033
[33m%"
PRId64
"
\033
[0m
\n
"
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblLimit
);
...
...
@@ -1550,8 +1583,8 @@ static void printfInsertMetaToFile(FILE* fp) {
}
fprintf
(
fp
,
" super table count: %"
PRIu64
"
\n
"
,
g_Dbs
.
db
[
i
].
superTblCount
);
for
(
in
t
j
=
0
;
j
<
g_Dbs
.
db
[
i
].
superTblCount
;
j
++
)
{
fprintf
(
fp
,
" super table[%
d
]:
\n
"
,
j
);
for
(
uint64_
t
j
=
0
;
j
<
g_Dbs
.
db
[
i
].
superTblCount
;
j
++
)
{
fprintf
(
fp
,
" super table[%
"
PRIu64
"
]:
\n
"
,
j
);
fprintf
(
fp
,
" stbName: %s
\n
"
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
sTblName
);
...
...
@@ -1578,7 +1611,8 @@ static void printfInsertMetaToFile(FILE* fp) {
fprintf
(
fp
,
" dataSource: %s
\n
"
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
dataSource
);
fprintf
(
fp
,
" insertMode: %s
\n
"
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insertMode
);
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insertMode
==
TAOSC_IFACE
)
?
"taosc"
:
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insertMode
==
REST_IFACE
)
?
"rest"
:
"stmt"
);
fprintf
(
fp
,
" insertRows: %"
PRId64
"
\n
"
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insertRows
);
fprintf
(
fp
,
" interlace rows: %"
PRIu64
"
\n
"
,
...
...
@@ -2749,7 +2783,7 @@ static int createDatabasesAndStables() {
int
validStbCount
=
0
;
for
(
in
t
j
=
0
;
j
<
g_Dbs
.
db
[
i
].
superTblCount
;
j
++
)
{
for
(
uint64_
t
j
=
0
;
j
<
g_Dbs
.
db
[
i
].
superTblCount
;
j
++
)
{
sprintf
(
command
,
"describe %s.%s;"
,
g_Dbs
.
db
[
i
].
dbName
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
sTblName
);
verbosePrint
(
"%s() %d command: %s
\n
"
,
__func__
,
__LINE__
,
command
);
...
...
@@ -2761,7 +2795,7 @@ static int createDatabasesAndStables() {
&
g_Dbs
.
db
[
i
].
superTbls
[
j
]);
if
(
0
!=
ret
)
{
errorPrint
(
"create super table %
d
failed!
\n\n
"
,
j
);
errorPrint
(
"create super table %
"
PRIu64
"
failed!
\n\n
"
,
j
);
continue
;
}
}
...
...
@@ -2789,7 +2823,7 @@ static void* createTable(void *sarg)
threadInfo
*
pThreadInfo
=
(
threadInfo
*
)
sarg
;
SSuperTable
*
superTblInfo
=
pThreadInfo
->
superTblInfo
;
int64_t
lastPrintTime
=
taosGetTimestampMs
();
u
int64_t
lastPrintTime
=
taosGetTimestampMs
();
int
buff_len
;
buff_len
=
BUFFER_SIZE
/
8
;
...
...
@@ -2864,7 +2898,7 @@ static void* createTable(void *sarg)
return
NULL
;
}
int64_t
currentPrintTime
=
taosGetTimestampMs
();
u
int64_t
currentPrintTime
=
taosGetTimestampMs
();
if
(
currentPrintTime
-
lastPrintTime
>
30
*
1000
)
{
printf
(
"thread[%d] already create %"
PRIu64
" - %"
PRIu64
" tables
\n
"
,
pThreadInfo
->
threadID
,
pThreadInfo
->
start_table_from
,
i
);
...
...
@@ -2888,7 +2922,7 @@ static int startMultiThreadCreateChildTable(
char
*
db_name
,
SSuperTable
*
superTblInfo
)
{
pthread_t
*
pids
=
malloc
(
threads
*
sizeof
(
pthread_t
));
threadInfo
*
infos
=
malloc
(
threads
*
sizeof
(
threadInfo
));
threadInfo
*
infos
=
calloc
(
1
,
threads
*
sizeof
(
threadInfo
));
if
((
NULL
==
pids
)
||
(
NULL
==
infos
))
{
printf
(
"malloc failed
\n
"
);
...
...
@@ -2908,7 +2942,7 @@ static int startMultiThreadCreateChildTable(
int64_t
b
=
0
;
b
=
ntables
%
threads
;
for
(
int
64_t
i
=
0
;
i
<
threads
;
i
++
)
{
for
(
int
i
=
0
;
i
<
threads
;
i
++
)
{
threadInfo
*
t_info
=
infos
+
i
;
t_info
->
threadID
=
i
;
tstrncpy
(
t_info
->
db_name
,
db_name
,
MAX_DB_NAME_SIZE
);
...
...
@@ -2961,7 +2995,7 @@ static void createChildTables() {
if
(
g_Dbs
.
use_metric
)
{
if
(
g_Dbs
.
db
[
i
].
superTblCount
>
0
)
{
// with super table
for
(
in
t
j
=
0
;
j
<
g_Dbs
.
db
[
i
].
superTblCount
;
j
++
)
{
for
(
uint64_
t
j
=
0
;
j
<
g_Dbs
.
db
[
i
].
superTblCount
;
j
++
)
{
if
((
AUTO_CREATE_SUBTBL
==
g_Dbs
.
db
[
i
].
superTbls
[
j
].
autoCreateTable
)
||
(
TBL_ALREADY_EXISTS
==
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblExists
))
{
continue
;
...
...
@@ -3082,10 +3116,12 @@ static int readTagFromCsvFileToMem(SSuperTable * superTblInfo) {
return
0
;
}
#if 0
int readSampleFromJsonFileToMem(SSuperTable * superTblInfo) {
// TODO
return 0;
}
#endif
/*
Read 10000 lines at most. If more than 10000 lines, continue to read after using
...
...
@@ -3785,15 +3821,24 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
goto
PARSE_OVER
;
}
cJSON
*
insertMode
=
cJSON_GetObjectItem
(
stbInfo
,
"insert_mode"
);
// taosc , rest
cJSON
*
insertMode
=
cJSON_GetObjectItem
(
stbInfo
,
"insert_mode"
);
// taosc , rest
, stmt
if
(
insertMode
&&
insertMode
->
type
==
cJSON_String
&&
insertMode
->
valuestring
!=
NULL
)
{
tstrncpy
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insertMode
,
insertMode
->
valuestring
,
MAX_DB_NAME_SIZE
);
if
(
0
==
strcasecmp
(
insertMode
->
valuestring
,
"taosc"
))
{
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insertMode
=
TAOSC_IFACE
;
}
else
if
(
0
==
strcasecmp
(
insertMode
->
valuestring
,
"rest"
))
{
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insertMode
=
REST_IFACE
;
}
else
if
(
0
==
strcasecmp
(
insertMode
->
valuestring
,
"stmt"
))
{
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insertMode
=
STMT_IFACE
;
}
else
{
errorPrint
(
"%s() LN%d, failed to read json, insert_mode %s not recognized
\n
"
,
__func__
,
__LINE__
,
insertMode
->
valuestring
);
goto
PARSE_OVER
;
}
}
else
if
(
!
insertMode
)
{
tstrncpy
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insertMode
,
"taosc"
,
MAX_DB_NAME_SIZE
)
;
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insertMode
=
TAOSC_IFACE
;
}
else
{
printf
(
"ERROR:
failed to read json, insert_mode not found
\n
"
);
errorPrint
(
"%s"
,
"
failed to read json, insert_mode not found
\n
"
);
goto
PARSE_OVER
;
}
...
...
@@ -4510,7 +4555,7 @@ static void prepareSampleData() {
static
void
postFreeResource
()
{
tmfclose
(
g_fpOfInsertResult
);
for
(
int
i
=
0
;
i
<
g_Dbs
.
dbCount
;
i
++
)
{
for
(
in
t
j
=
0
;
j
<
g_Dbs
.
db
[
i
].
superTblCount
;
j
++
)
{
for
(
uint64_
t
j
=
0
;
j
<
g_Dbs
.
db
[
i
].
superTblCount
;
j
++
)
{
if
(
0
!=
g_Dbs
.
db
[
i
].
superTbls
[
j
].
colsOfCreateChildTable
)
{
free
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
colsOfCreateChildTable
);
g_Dbs
.
db
[
i
].
superTbls
[
j
].
colsOfCreateChildTable
=
NULL
;
...
...
@@ -4715,32 +4760,43 @@ static int prepareSampleDataForSTable(SSuperTable *superTblInfo) {
return
0
;
}
static
int64_t
execInsert
(
threadInfo
*
pThreadInfo
,
char
*
buffer
,
uint64_t
k
)
static
int64_t
execInsert
(
threadInfo
*
pThreadInfo
,
uint64_t
k
)
{
int
affectedRows
;
SSuperTable
*
superTblInfo
=
pThreadInfo
->
superTblInfo
;
verbosePrint
(
"[%d] %s() LN%d %s
\n
"
,
pThreadInfo
->
threadID
,
__func__
,
__LINE__
,
buffer
);
__func__
,
__LINE__
,
pThreadInfo
->
buffer
);
if
(
superTblInfo
)
{
if
(
0
==
strncasecmp
(
superTblInfo
->
insertMode
,
"taosc"
,
strlen
(
"taosc"
)))
{
affectedRows
=
queryDbExec
(
pThreadInfo
->
taos
,
buffer
,
INSERT_TYPE
,
false
);
}
else
if
(
0
==
strncasecmp
(
superTblInfo
->
insertMode
,
"rest"
,
strlen
(
"rest"
)))
{
if
(
superTblInfo
->
insertMode
==
TAOSC_IFACE
)
{
affectedRows
=
queryDbExec
(
pThreadInfo
->
taos
,
pThreadInfo
->
buffer
,
INSERT_TYPE
,
false
);
}
else
if
(
superTblInfo
->
insertMode
==
REST_IFACE
)
{
if
(
0
!=
postProceSql
(
g_Dbs
.
host
,
&
g_Dbs
.
serv_addr
,
g_Dbs
.
port
,
buffer
,
NULL
/* not set result file */
))
{
pThreadInfo
->
buffer
,
NULL
/* not set result file */
))
{
affectedRows
=
-
1
;
printf
(
"========restful return fail, threadID[%d]
\n
"
,
pThreadInfo
->
threadID
);
}
else
{
affectedRows
=
k
;
}
}
else
if
(
superTblInfo
->
insertMode
==
STMT_IFACE
)
{
debugPrint
(
"%s() LN%d, stmt=%p"
,
__func__
,
__LINE__
,
pThreadInfo
->
stmt
);
if
(
0
!=
taos_stmt_execute
(
pThreadInfo
->
stmt
))
{
errorPrint
(
"%s() LN%d, failied to execute insert statement
\n
"
,
__func__
,
__LINE__
);
exit
(
-
1
);
}
affectedRows
=
k
;
}
else
{
errorPrint
(
"%s() LN%d: unknown insert mode: %
s
\n
"
,
errorPrint
(
"%s() LN%d: unknown insert mode: %
d
\n
"
,
__func__
,
__LINE__
,
superTblInfo
->
insertMode
);
affectedRows
=
0
;
}
}
else
{
affectedRows
=
queryDbExec
(
pThreadInfo
->
taos
,
buffer
,
INSERT_TYPE
,
false
);
affectedRows
=
queryDbExec
(
pThreadInfo
->
taos
,
pThreadInfo
->
buffer
,
INSERT_TYPE
,
false
);
}
return
affectedRows
;
...
...
@@ -5086,20 +5142,17 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
if
(
interlaceRows
>
g_args
.
num_of_RPR
)
interlaceRows
=
g_args
.
num_of_RPR
;
int
insertMod
e
;
int
progOrInterlac
e
;
if
(
interlaceRows
>
0
)
{
insertMode
=
INTERLACE_INSERT_MODE
;
progOrInterlace
=
INTERLACE_INSERT_MODE
;
}
else
{
insertMod
e
=
PROGRESSIVE_INSERT_MODE
;
progOrInterlac
e
=
PROGRESSIVE_INSERT_MODE
;
}
// TODO: prompt tbl count multple interlace rows and batch
//
uint64_t
maxSqlLen
=
superTblInfo
?
superTblInfo
->
maxSqlLen
:
g_args
.
max_sql_len
;
char
*
buffer
=
calloc
(
maxSqlLen
,
1
);
if
(
NULL
==
buffer
)
{
pThreadInfo
->
buffer
=
calloc
(
maxSqlLen
,
1
);
if
(
NULL
==
pThreadInfo
->
buffer
)
{
errorPrint
(
"%s() LN%d, Failed to alloc %"
PRIu64
" Bytes, reason:%s
\n
"
,
__func__
,
__LINE__
,
maxSqlLen
,
strerror
(
errno
));
return
NULL
;
...
...
@@ -5152,10 +5205,10 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
flagSleep
=
false
;
}
// generate data
memset
(
buffer
,
0
,
maxSqlLen
);
memset
(
pThreadInfo
->
buffer
,
0
,
maxSqlLen
);
uint64_t
remainderBufLen
=
maxSqlLen
;
char
*
pstr
=
buffer
;
char
*
pstr
=
pThreadInfo
->
buffer
;
int
len
=
snprintf
(
pstr
,
nInsertBufLen
+
1
,
"%s"
,
strInsertInto
);
pstr
+=
len
;
...
...
@@ -5168,7 +5221,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
if
(
0
==
strlen
(
tableName
))
{
errorPrint
(
"[%d] %s() LN%d, getTableName return null
\n
"
,
pThreadInfo
->
threadID
,
__func__
,
__LINE__
);
free
(
buffer
);
free
(
pThreadInfo
->
buffer
);
return
NULL
;
}
...
...
@@ -5200,7 +5253,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
pThreadInfo
->
threadID
,
__func__
,
__LINE__
,
batchPerTbl
,
recOfBatch
);
if
(
insertMod
e
==
INTERLACE_INSERT_MODE
)
{
if
(
progOrInterlac
e
==
INTERLACE_INSERT_MODE
)
{
if
(
tableSeq
==
pThreadInfo
->
start_table_from
+
pThreadInfo
->
ntables
)
{
// turn to first table
tableSeq
=
pThreadInfo
->
start_table_from
;
...
...
@@ -5234,7 +5287,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
pThreadInfo
->
threadID
,
__func__
,
__LINE__
,
recOfBatch
,
pThreadInfo
->
totalInsertRows
);
verbosePrint
(
"[%d] %s() LN%d, buffer=%s
\n
"
,
pThreadInfo
->
threadID
,
__func__
,
__LINE__
,
buffer
);
pThreadInfo
->
threadID
,
__func__
,
__LINE__
,
pThreadInfo
->
buffer
);
startTs
=
taosGetTimestampMs
();
...
...
@@ -5245,7 +5298,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
errorPrint
(
"%s
\n
"
,
"
\t
Please check if the batch or the buffer length is proper value!
\n
"
);
goto
free_of_interlace
;
}
int64_t
affectedRows
=
execInsert
(
pThreadInfo
,
buffer
,
recOfBatch
);
int64_t
affectedRows
=
execInsert
(
pThreadInfo
,
recOfBatch
);
endTs
=
taosGetTimestampMs
();
uint64_t
delay
=
endTs
-
startTs
;
...
...
@@ -5263,7 +5316,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
if
(
recOfBatch
!=
affectedRows
)
{
errorPrint
(
"[%d] %s() LN%d execInsert insert %"
PRIu64
", affected rows: %"
PRId64
"
\n
%s
\n
"
,
pThreadInfo
->
threadID
,
__func__
,
__LINE__
,
recOfBatch
,
affectedRows
,
buffer
);
recOfBatch
,
affectedRows
,
pThreadInfo
->
buffer
);
goto
free_of_interlace
;
}
...
...
@@ -5282,8 +5335,8 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
et
=
taosGetTimestampMs
();
if
(
insert_interval
>
(
et
-
st
)
)
{
in
t
sleepTime
=
insert_interval
-
(
et
-
st
);
performancePrint
(
"%s() LN%d sleep: %
d
ms for insert interval
\n
"
,
uint64_
t
sleepTime
=
insert_interval
-
(
et
-
st
);
performancePrint
(
"%s() LN%d sleep: %
"
PRId64
"
ms for insert interval
\n
"
,
__func__
,
__LINE__
,
sleepTime
);
taosMsleep
(
sleepTime
);
// ms
sleepTimeTotal
+=
insert_interval
;
...
...
@@ -5292,7 +5345,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
}
free_of_interlace:
tmfree
(
buffer
);
tmfree
(
pThreadInfo
->
buffer
);
printStatPerThread
(
pThreadInfo
);
return
NULL
;
}
...
...
@@ -5311,8 +5364,8 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
SSuperTable
*
superTblInfo
=
pThreadInfo
->
superTblInfo
;
uint64_t
maxSqlLen
=
superTblInfo
?
superTblInfo
->
maxSqlLen
:
g_args
.
max_sql_len
;
char
*
buffer
=
calloc
(
maxSqlLen
,
1
);
if
(
NULL
==
buffer
)
{
pThreadInfo
->
buffer
=
calloc
(
maxSqlLen
,
1
);
if
(
NULL
==
pThreadInfo
->
buffer
)
{
errorPrint
(
"Failed to alloc %"
PRIu64
" Bytes, reason:%s
\n
"
,
maxSqlLen
,
strerror
(
errno
));
...
...
@@ -5358,7 +5411,7 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
pThreadInfo
->
threadID
,
tableSeq
,
tableName
);
int64_t
remainderBufLen
=
maxSqlLen
;
char
*
pstr
=
buffer
;
char
*
pstr
=
pThreadInfo
->
buffer
;
int
nInsertBufLen
=
strlen
(
"insert into "
);
int
len
=
snprintf
(
pstr
,
nInsertBufLen
+
1
,
"%s"
,
"insert into "
);
...
...
@@ -5381,7 +5434,7 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
startTs
=
taosGetTimestampMs
();
int64_t
affectedRows
=
execInsert
(
pThreadInfo
,
buffer
,
generated
);
int64_t
affectedRows
=
execInsert
(
pThreadInfo
,
generated
);
endTs
=
taosGetTimestampMs
();
uint64_t
delay
=
endTs
-
startTs
;
...
...
@@ -5440,7 +5493,7 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
}
// tableSeq
free_of_progressive:
tmfree
(
buffer
);
tmfree
(
pThreadInfo
->
buffer
);
printStatPerThread
(
pThreadInfo
);
return
NULL
;
}
...
...
@@ -5579,15 +5632,6 @@ static int convertHostToServAddr(char *host, uint16_t port, struct sockaddr_in *
static
void
startMultiThreadInsertData
(
int
threads
,
char
*
db_name
,
char
*
precision
,
SSuperTable
*
superTblInfo
)
{
pthread_t
*
pids
=
malloc
(
threads
*
sizeof
(
pthread_t
));
assert
(
pids
!=
NULL
);
threadInfo
*
infos
=
malloc
(
threads
*
sizeof
(
threadInfo
));
assert
(
infos
!=
NULL
);
memset
(
pids
,
0
,
threads
*
sizeof
(
pthread_t
));
memset
(
infos
,
0
,
threads
*
sizeof
(
threadInfo
));
//TAOS* taos;
//if (0 == strncasecmp(superTblInfo->insertMode, "taosc", 5)) {
// taos = taos_connect(g_Dbs.host, g_Dbs.user, g_Dbs.password, db_name, g_Dbs.port);
...
...
@@ -5648,10 +5692,10 @@ static void startMultiThreadInsertData(int threads, char* db_name,
}
}
TAOS
*
taos
=
taos_connect
(
TAOS
*
taos
0
=
taos_connect
(
g_Dbs
.
host
,
g_Dbs
.
user
,
g_Dbs
.
password
,
db_name
,
g_Dbs
.
port
);
if
(
NULL
==
taos
)
{
if
(
NULL
==
taos
0
)
{
errorPrint
(
"%s() LN%d, connect to server fail , reason: %s
\n
"
,
__func__
,
__LINE__
,
taos_errstr
(
NULL
));
exit
(
-
1
);
...
...
@@ -5710,13 +5754,13 @@ static void startMultiThreadInsertData(int threads, char* db_name,
limit
*
TSDB_TABLE_NAME_LEN
);
if
(
superTblInfo
->
childTblName
==
NULL
)
{
errorPrint
(
"%s() LN%d, alloc memory failed!
\n
"
,
__func__
,
__LINE__
);
taos_close
(
taos
);
taos_close
(
taos
0
);
exit
(
-
1
);
}
int64_t
childTblCount
;
getChildNameOfSuperTableWithLimitAndOffset
(
taos
,
taos
0
,
db_name
,
superTblInfo
->
sTblName
,
&
superTblInfo
->
childTblName
,
&
childTblCount
,
limit
,
...
...
@@ -5726,7 +5770,7 @@ static void startMultiThreadInsertData(int threads, char* db_name,
startFrom
=
0
;
}
taos_close
(
taos
);
taos_close
(
taos
0
);
int64_t
a
=
ntables
/
threads
;
if
(
a
<
1
)
{
...
...
@@ -5740,11 +5784,21 @@ static void startMultiThreadInsertData(int threads, char* db_name,
}
if
((
superTblInfo
)
&&
(
0
==
strncasecmp
(
superTblInfo
->
insertMode
,
"rest"
,
strlen
(
"rest"
))))
{
if
(
convertHostToServAddr
(
g_Dbs
.
host
,
g_Dbs
.
port
,
&
(
g_Dbs
.
serv_addr
))
!=
0
)
exit
(
-
1
);
&&
(
superTblInfo
->
insertMode
==
REST_IFACE
))
{
if
(
convertHostToServAddr
(
g_Dbs
.
host
,
g_Dbs
.
port
,
&
(
g_Dbs
.
serv_addr
))
!=
0
)
{
exit
(
-
1
);
}
}
pthread_t
*
pids
=
malloc
(
threads
*
sizeof
(
pthread_t
));
assert
(
pids
!=
NULL
);
threadInfo
*
infos
=
calloc
(
1
,
threads
*
sizeof
(
threadInfo
));
assert
(
infos
!=
NULL
);
memset
(
pids
,
0
,
threads
*
sizeof
(
pthread_t
));
memset
(
infos
,
0
,
threads
*
sizeof
(
threadInfo
));
for
(
int
i
=
0
;
i
<
threads
;
i
++
)
{
threadInfo
*
t_info
=
infos
+
i
;
t_info
->
threadID
=
i
;
...
...
@@ -5756,17 +5810,32 @@ static void startMultiThreadInsertData(int threads, char* db_name,
t_info
->
minDelay
=
UINT64_MAX
;
if
((
NULL
==
superTblInfo
)
||
(
0
==
strncasecmp
(
superTblInfo
->
insertMode
,
"taosc"
,
5
)
))
{
(
superTblInfo
->
insertMode
!=
REST_IFACE
))
{
//t_info->taos = taos;
t_info
->
taos
=
taos_connect
(
g_Dbs
.
host
,
g_Dbs
.
user
,
g_Dbs
.
password
,
db_name
,
g_Dbs
.
port
);
if
(
NULL
==
t_info
->
taos
)
{
errorPrint
(
"connect to server fail from insert sub thread, reason: %s
\n
"
,
"%s() LN%d, connect to server fail from insert sub thread, reason: %s
\n
"
,
__func__
,
__LINE__
,
taos_errstr
(
NULL
));
free
(
infos
);
exit
(
-
1
);
}
if
((
superTblInfo
)
&&
(
superTblInfo
->
insertMode
==
STMT_IFACE
))
{
t_info
->
stmt
=
taos_stmt_init
(
t_info
->
taos
);
if
(
NULL
==
t_info
->
stmt
)
{
errorPrint
(
"%s() LN%d, failed init stmt, reason: %s
\n
"
,
__func__
,
__LINE__
,
taos_errstr
(
NULL
));
free
(
pids
);
free
(
infos
);
exit
(
-
1
);
}
}
}
else
{
t_info
->
taos
=
NULL
;
}
...
...
@@ -5806,6 +5875,10 @@ static void startMultiThreadInsertData(int threads, char* db_name,
threadInfo
*
t_info
=
infos
+
i
;
tsem_destroy
(
&
(
t_info
->
lock_sem
));
if
(
t_info
->
stmt
)
{
taos_stmt_close
(
t_info
->
stmt
);
}
taos_close
(
t_info
->
taos
);
debugPrint
(
"%s() LN%d, [%d] totalInsert=%"
PRIu64
" totalAffected=%"
PRIu64
"
\n
"
,
...
...
@@ -6083,7 +6156,7 @@ static int insertTestProcess() {
for
(
int
i
=
0
;
i
<
g_Dbs
.
dbCount
;
i
++
)
{
if
(
g_Dbs
.
use_metric
)
{
if
(
g_Dbs
.
db
[
i
].
superTblCount
>
0
)
{
for
(
in
t
j
=
0
;
j
<
g_Dbs
.
db
[
i
].
superTblCount
;
j
++
)
{
for
(
uint64_
t
j
=
0
;
j
<
g_Dbs
.
db
[
i
].
superTblCount
;
j
++
)
{
SSuperTable
*
superTblInfo
=
&
g_Dbs
.
db
[
i
].
superTbls
[
j
];
...
...
@@ -6878,7 +6951,7 @@ static void setParaFromArg(){
tstrncpy
(
g_Dbs
.
db
[
0
].
superTbls
[
0
].
childTblPrefix
,
g_args
.
tb_prefix
,
MAX_TB_NAME_SIZE
);
tstrncpy
(
g_Dbs
.
db
[
0
].
superTbls
[
0
].
dataSource
,
"rand"
,
MAX_TB_NAME_SIZE
);
tstrncpy
(
g_Dbs
.
db
[
0
].
superTbls
[
0
].
insertMode
,
"taosc"
,
MAX_TB_NAME_SIZE
)
;
g_Dbs
.
db
[
0
].
superTbls
[
0
].
insertMode
=
g_args
.
iface
;
tstrncpy
(
g_Dbs
.
db
[
0
].
superTbls
[
0
].
startTimestamp
,
"2017-07-14 10:40:00.000"
,
MAX_TB_NAME_SIZE
);
g_Dbs
.
db
[
0
].
superTbls
[
0
].
timeStampStep
=
DEFAULT_TIMESTAMP_STEP
;
...
...
src/mnode/src/mnodeProfile.c
浏览文件 @
6a810583
...
...
@@ -123,8 +123,9 @@ SConnObj *mnodeAccquireConn(int32_t connId, char *user, uint32_t ip, uint16_t po
if
(
/* pConn->ip != ip || */
pConn
->
port
!=
port
/* || strcmp(pConn->user, user) != 0 */
)
{
mDebug
(
"connId:%d, incoming conn user:%s ip:%s:%u, not match exist conn user:%s ip:%s:%u"
,
connId
,
user
,
taosIpStr
(
ip
),
port
,
pConn
->
user
,
taosIpStr
(
pConn
->
ip
),
pConn
->
port
);
taosCacheRelease
(
tsMnodeConnCache
,
(
void
**
)
&
pConn
,
false
);
return
NULL
;
pConn
->
port
=
port
;
//taosCacheRelease(tsMnodeConnCache, (void **)&pConn, false);
//return NULL;
}
// mDebug("connId:%d, is incoming, user:%s ip:%s:%u", connId, pConn->user, taosIpStr(pConn->ip), pConn->port);
...
...
src/mnode/src/mnodeShow.c
浏览文件 @
6a810583
...
...
@@ -253,10 +253,6 @@ static int32_t mnodeProcessHeartBeatMsg(SMnodeMsg *pMsg) {
int32_t
connId
=
htonl
(
pHBMsg
->
connId
);
SConnObj
*
pConn
=
mnodeAccquireConn
(
connId
,
connInfo
.
user
,
connInfo
.
clientIp
,
connInfo
.
clientPort
);
if
(
pConn
==
NULL
)
{
pHBMsg
->
pid
=
htonl
(
pHBMsg
->
pid
);
pConn
=
mnodeCreateConn
(
connInfo
.
user
,
connInfo
.
clientIp
,
connInfo
.
clientPort
,
pHBMsg
->
pid
,
pHBMsg
->
appName
);
}
if
(
pConn
==
NULL
)
{
// do not close existing links, otherwise
...
...
src/query/src/qExecutor.c
浏览文件 @
6a810583
...
...
@@ -115,6 +115,8 @@ int64_t genQueryId(void) {
uid
|=
sid
;
qDebug
(
"gen qid:0x%"
PRIx64
,
uid
);
return
uid
;
}
...
...
src/rpc/src/rpcMain.c
浏览文件 @
6a810583
...
...
@@ -1471,7 +1471,7 @@ static int32_t rpcCompressRpcMsg(char* pCont, int32_t contLen) {
* only the compressed size is less than the value of contLen - overhead, the compression is applied
* The first four bytes is set to 0, the second four bytes are utilized to keep the original length of message
*/
if
(
compLen
<
contLen
-
overhead
)
{
if
(
compLen
>
0
&&
compLen
<
contLen
-
overhead
)
{
SRpcComp
*
pComp
=
(
SRpcComp
*
)
pCont
;
pComp
->
reserved
=
0
;
pComp
->
contLen
=
htonl
(
contLen
);
...
...
src/wal/src/walWrite.c
浏览文件 @
6a810583
...
...
@@ -426,8 +426,8 @@ static int32_t walRestoreWalFile(SWal *pWal, void *pVnode, FWalWrite writeFp, ch
#endif
offset
=
offset
+
sizeof
(
SWalHead
)
+
pHead
->
len
;
wTrace
(
"vgId:%d, restore wal, fileId:%"
PRId64
" hver:%"
PRIu64
" wver:%"
PRIu64
" len:%d
"
,
pWal
->
vgId
,
fileId
,
pHead
->
version
,
pWal
->
version
,
pHead
->
len
);
wTrace
(
"vgId:%d, restore wal, fileId:%"
PRId64
" hver:%"
PRIu64
" wver:%"
PRIu64
" len:%d
offset:%"
PRId64
,
pWal
->
vgId
,
fileId
,
pHead
->
version
,
pWal
->
version
,
pHead
->
len
,
offset
);
pWal
->
version
=
pHead
->
version
;
(
*
writeFp
)(
pVnode
,
pHead
,
TAOS_QTYPE_WAL
,
NULL
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录