提交 383ca2f2 编写于 作者: S Shengliang Guan

Merge from master

......@@ -36,25 +36,34 @@
检查客户端侧TCP端口链接是否工作:`nc {hostIP} {port}`
## 6. 虽然语法正确,为什么我还是得到 "Invalid SQL" 错误
## 6. 遇到错误“Unexpected generic error in RPC”, 我怎么办?
产生这个错误,是由于客户端或数据节点无法解析FQDN(Fully Qualified Domain Name)导致。对于TAOS Shell或客户端应用,请做如下检查:
1. 请检查连接的服务器的FQDN是否正确
2. 如果网络配置有DNS server, 请检查是否正常工作
3. 如果网络没有配置DNS server, 请检查客户端所在机器的hosts文件,查看该FQDN是否配置,并是否有正确的IP地址。
4. 如果网络配置OK,从客户端所在机器,你需要能Ping该连接的FQDN,否则客户端是无法链接服务器的
## 7. 虽然语法正确,为什么我还是得到 "Invalid SQL" 错误
如果你确认语法正确,2.0之前版本,请检查SQL语句长度是否超过64K。如果超过,也会返回这个错误。
## 7. 是否支持validation queries?
## 8. 是否支持validation queries?
TDengine还没有一组专用的validation queries。然而建议你使用系统监测的数据库”log"来做。
## 8. 我可以删除或更新一条记录吗?
## 9. 我可以删除或更新一条记录吗?
不能。因为TDengine是为联网设备采集的数据设计的,不容许修改。但TDengine提供数据保留策略,只要数据记录超过保留时长,就会被自动删除。
## 10. 我怎么创建超过250列的表?
## 10. 我怎么创建超过1024列的表?
使用2.0及其以上版本,默认支持1024列;2.0之前的版本,TDengine最大允许创建250列的表。但是如果确实超过限值,建议按照数据特性,逻辑地将这个宽表分解成几个小表。
## 10. 最有效的写入数据的方法是什么?
批量插入。每条写入语句可以一张表同时插入多条记录,也可以同时插入多张表的记录。
批量插入。每条写入语句可以一张表同时插入多条记录,也可以同时插入多张表的多条记录。
## 11. 最有效的写入数据的方法是什么?windows系统下插入的nchar类数据中的汉字被解析成了乱码如何解决?
......@@ -77,4 +86,11 @@ Connection = DriverManager.getConnection(url, properties);
<version>2.0.4</version>
</dependency>
```
## 14. 怎么报告问题?
如果 FAQ 中的信息不能够帮到您,需要 TDengine 技术团队的技术支持与协助,请将以下两个目录中内容打包:
1. /var/log/taos
2. /etc/taos
附上必要的问题描述,以及发生该问题的执行操作,出现问题的表征及大概的时间,在<a href='https://github.com/taosdata/TDengine'> GitHub</a>提交Issue。
为了保证有足够的debug信息,如果问题能够重复,请修改/etc/taos/taos.cfg文件,最后面添加一行“debugFlag 135"(不带引号本身),然后重启taosd, 重复问题,然后再递交。但系统正常运行时,请一定将debugFlag设置为131,否则会产生大量的日志信息,降低系统效率。
......@@ -12,6 +12,6 @@ ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib"
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8
EXPOSE 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041
EXPOSE 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042
CMD ["taosd"]
VOLUME [ "/var/lib/taos", "/var/log/taos","/etc/taos/" ]
......@@ -10,6 +10,7 @@ set -e
# -o [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | Ningsi60 | Ningsi80 |...]
# -V [stable | beta]
# -l [full | lite]
# -s [static | dynamic]
# -n [2.0.0.3]
# set parameters by default value
......@@ -18,9 +19,10 @@ verType=stable # [stable, beta]
cpuType=x64 # [aarch32 | aarch64 | x64 | x86 | mips64 ...]
osType=Linux # [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | Ningsi60 | Ningsi80 |...]
pagMode=full # [full | lite]
soMode=dynamic # [static | dynamic]
verNumber=""
while getopts "hv:V:c:o:l:n:" arg
while getopts "hv:V:c:o:l:s:n:" arg
do
case $arg in
v)
......@@ -39,6 +41,10 @@ do
#echo "pagMode=$OPTARG"
pagMode=$(echo $OPTARG)
;;
s)
#echo "soMode=$OPTARG"
soMode=$(echo $OPTARG)
;;
n)
#echo "verNumber=$OPTARG"
verNumber=$(echo $OPTARG)
......@@ -53,6 +59,7 @@ do
echo " -o [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | Ningsi60 | Ningsi80 |...] "
echo " -V [stable | beta] "
echo " -l [full | lite] "
echo " -s [static | dynamic] "
echo " -n [version number] "
exit 0
;;
......@@ -63,7 +70,7 @@ do
esac
done
echo "verMode=${verMode} verType=${verType} cpuType=${cpuType} osType=${osType} pagMode=${pagMode} verNumber=${verNumber}"
echo "verMode=${verMode} verType=${verType} cpuType=${cpuType} osType=${osType} pagMode=${pagMode} soMode=${soMode} verNumber=${verNumber}"
curr_dir=$(pwd)
......@@ -223,9 +230,9 @@ cd ${compile_dir}
# check support cpu type
if [[ "$cpuType" == "x64" ]] || [[ "$cpuType" == "aarch64" ]] || [[ "$cpuType" == "aarch32" ]] || [[ "$cpuType" == "mips64" ]] ; then
if [ "$verMode" != "cluster" ]; then
cmake ../ -DCPUTYPE=${cpuType} -DPAGMODE=${pagMode} -DOSTYPE=${osType}
cmake ../ -DCPUTYPE=${cpuType} -DPAGMODE=${pagMode} -DOSTYPE=${osType} -DSOMODE=${soMode}
else
cmake ../../ -DCPUTYPE=${cpuType} -DOSTYPE=${osType}
cmake ../../ -DCPUTYPE=${cpuType} -DOSTYPE=${osType} -DSOMODE=${soMode}
fi
else
echo "input cpuType=${cpuType} error!!!"
......
......@@ -66,6 +66,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_RPC_INVALID_MSG_TYPE, 0, 0x0011, "Invalid me
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_INVALID_RESPONSE_TYPE, 0, 0x0012, "Invalid response type")
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_INVALID_TIME_STAMP, 0, 0x0013, "Invalid timestamp")
TAOS_DEFINE_ERROR(TSDB_CODE_APP_NOT_READY, 0, 0x0014, "Database not ready")
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_FQDN_ERROR, 0, 0x0015, "Unable to resolve FQDN")
//common & util
TAOS_DEFINE_ERROR(TSDB_CODE_COM_OPS_NOT_SUPPORT, 0, 0x0100, "Operation not supported")
......
......@@ -27,35 +27,46 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <wordexp.h>
#define MAX_PKG_LEN (64*1000)
#define BUFFER_SIZE (MAX_PKG_LEN + 1024)
#define MAX_PKG_LEN (64*1000)
#define BUFFER_SIZE (MAX_PKG_LEN + 1024)
#define TEST_FQDN_LEN 128
#define TEST_IPv4ADDR_LEN 16
typedef struct {
int port;
char *host;
uint16_t port;
uint32_t hostIp;
char fqdn[TEST_FQDN_LEN];
uint16_t pktLen;
} info_s;
typedef struct Arguments {
char * host;
char host[TEST_IPv4ADDR_LEN];
char fqdn[TEST_FQDN_LEN];
uint16_t port;
uint16_t max_port;
uint16_t pktLen;
} SArguments;
static struct argp_option options[] = {
{0, 'h', "host", 0, "The host to connect to TDEngine. Default is localhost.", 0},
{0, 'h', "host ip", 0, "The host ip to connect to TDEngine. Default is localhost.", 0},
{0, 'p', "port", 0, "The TCP or UDP port number to use for the connection. Default is 6030.", 1},
{0, 'm', "max port", 0, "The max TCP or UDP port number to use for the connection. Default is 6060.", 2},
{0, 'm', "max port", 0, "The max TCP or UDP port number to use for the connection. Default is 6042.", 2},
{0, 'f', "host fqdn", 0, "The host fqdn to connect to TDEngine.", 3},
{0, 'l', "test pkg len", 0, "The len of pkg for test. Default is 1000 Bytes, max not greater than 64k Bytes.\nNotes: This parameter must be consistent between the client and the server.", 3}};
static error_t parse_opt(int key, char *arg, struct argp_state *state) {
wordexp_t full_path;
SArguments *arguments = state->input;
switch (key) {
case 'h':
arguments->host = arg;
if (wordexp(arg, &full_path, 0) != 0) {
fprintf(stderr, "Invalid host ip %s\n", arg);
return -1;
}
strcpy(arguments->host, full_path.we_wordv[0]);
wordfree(&full_path);
break;
case 'p':
arguments->port = atoi(arg);
......@@ -66,6 +77,14 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
case 'l':
arguments->pktLen = atoi(arg);
break;
case 'f':
if (wordexp(arg, &full_path, 0) != 0) {
fprintf(stderr, "Invalid host fqdn %s\n", arg);
return -1;
}
strcpy(arguments->fqdn, full_path.we_wordv[0]);
wordfree(&full_path);
break;
default:
return ARGP_ERR_UNKNOWN;
......@@ -76,8 +95,6 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
static struct argp argp = {options, parse_opt, 0, 0};
int checkTcpPort(info_s *info) {
int port = info->port;
char *host = info->host;
int clientSocket;
struct sockaddr_in serverAddr;
......@@ -88,21 +105,35 @@ int checkTcpPort(info_s *info) {
printf("socket() fail: %s\n", strerror(errno));
return -1;
}
// set send and recv overtime
struct timeval timeout;
timeout.tv_sec = 2; //s
timeout.tv_usec = 0; //us
if (setsockopt(clientSocket, SOL_SOCKET,SO_SNDTIMEO, (char *)&timeout, sizeof(struct timeval)) == -1) {
perror("setsockopt send timer failed:");
}
if (setsockopt(clientSocket, SOL_SOCKET,SO_RCVTIMEO, (char *)&timeout, sizeof(struct timeval)) == -1) {
perror("setsockopt recv timer failed:");
}
serverAddr.sin_family = AF_INET;
serverAddr.sin_port = htons(port);
serverAddr.sin_port = htons(info->port);
serverAddr.sin_addr.s_addr = inet_addr(host);
serverAddr.sin_addr.s_addr = info->hostIp;
//printf("=================================\n");
if (connect(clientSocket, (struct sockaddr *)&serverAddr, sizeof(serverAddr)) < 0) {
printf("connect() fail: %s\n", strerror(errno));
printf("connect() fail: %s\t", strerror(errno));
return -1;
}
//printf("Connect to: %s:%d...success\n", host, port);
memset(sendbuf, 0, BUFFER_SIZE);
memset(recvbuf, 0, BUFFER_SIZE);
sprintf(sendbuf, "client send tcp pkg to %s:%d, content: 1122334455", host, port);
struct in_addr ipStr;
memcpy(&ipStr, &info->hostIp, 4);
sprintf(sendbuf, "client send tcp pkg to %s:%d, content: 1122334455", inet_ntoa(ipStr), info->port);
sprintf(sendbuf + info->pktLen - 16, "1122334455667788");
send(clientSocket, sendbuf, info->pktLen, 0);
......@@ -120,7 +151,7 @@ int checkTcpPort(info_s *info) {
if (errno == EINTR) {
continue;
} else {
printf("recv ack pkg from TCP port: %d fail:%s.\n", port, strerror(errno));
printf("recv ack pkg from TCP port: %d fail:%s.\n", info->port, strerror(errno));
close(clientSocket);
return -1;
}
......@@ -132,7 +163,7 @@ int checkTcpPort(info_s *info) {
}
if (iDataNum < info->pktLen) {
printf("recv ack pkg len: %d, less than req pkg len: %d from tcp port: %d\n", iDataNum, info->pktLen, port);
printf("recv ack pkg len: %d, less than req pkg len: %d from tcp port: %d\n", iDataNum, info->pktLen, info->port);
return -1;
}
//printf("Read ack pkg len:%d from tcp port: %d, buffer: %s %s\n", info->pktLen, port, recvbuf, recvbuf+iDataNum-8);
......@@ -142,8 +173,6 @@ int checkTcpPort(info_s *info) {
}
int checkUdpPort(info_s *info) {
int port = info->port;
char *host = info->host;
int clientSocket;
struct sockaddr_in serverAddr;
......@@ -154,15 +183,28 @@ int checkUdpPort(info_s *info) {
perror("socket");
return -1;
}
// set overtime
struct timeval timeout;
timeout.tv_sec = 2; //s
timeout.tv_usec = 0; //us
if (setsockopt(clientSocket, SOL_SOCKET,SO_SNDTIMEO, (char *)&timeout, sizeof(struct timeval)) == -1) {
perror("setsockopt send timer failed:");
}
if (setsockopt(clientSocket, SOL_SOCKET,SO_RCVTIMEO, (char *)&timeout, sizeof(struct timeval)) == -1) {
perror("setsockopt recv timer failed:");
}
serverAddr.sin_family = AF_INET;
serverAddr.sin_port = htons(port);
serverAddr.sin_addr.s_addr = inet_addr(host);
serverAddr.sin_port = htons(info->port);
serverAddr.sin_addr.s_addr = info->hostIp;
memset(sendbuf, 0, BUFFER_SIZE);
memset(recvbuf, 0, BUFFER_SIZE);
sprintf(sendbuf, "client send udp pkg to %s:%d, content: 1122334455", host, port);
struct in_addr ipStr;
memcpy(&ipStr, &info->hostIp, 4);
sprintf(sendbuf, "client send udp pkg to %s:%d, content: 1122334455", inet_ntoa(ipStr), info->port);
sprintf(sendbuf + info->pktLen - 16, "1122334455667788");
socklen_t sin_size = sizeof(*(struct sockaddr *)&serverAddr);
......@@ -176,7 +218,7 @@ int checkUdpPort(info_s *info) {
iDataNum = recvfrom(clientSocket, recvbuf, BUFFER_SIZE, 0, (struct sockaddr *)&serverAddr, &sin_size);
if (iDataNum < info->pktLen) {
printf("Read ack pkg len: %d, less than req pkg len: %d from udp port: %d\n", iDataNum, info->pktLen, port);
printf("Read ack pkg len: %d, less than req pkg len: %d from udp port: %d\t\t", iDataNum, info->pktLen, info->port);
return -1;
}
......@@ -185,43 +227,87 @@ int checkUdpPort(info_s *info) {
return 0;
}
int main(int argc, char *argv[]) {
SArguments arguments = {"127.0.0.1", 6030, 6060, 1000};
info_s info;
int ret;
argp_parse(&argp, argc, argv, 0, 0, &arguments);
if (arguments.pktLen > MAX_PKG_LEN) {
printf("test pkg len overflow: %d, max len not greater than %d bytes\n", arguments.pktLen, MAX_PKG_LEN);
exit(0);
}
int32_t getIpFromFqdn(const char *fqdn, uint32_t* ip) {
struct addrinfo hints = {0};
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
printf("host: %s\tport: %d\tmax_port: %d\tpkgLen: %d\n", arguments.host, arguments.port, arguments.max_port, arguments.pktLen);
struct addrinfo *result = NULL;
int port = arguments.port;
int32_t ret = getaddrinfo(fqdn, NULL, &hints, &result);
if (result) {
struct sockaddr *sa = result->ai_addr;
struct sockaddr_in *si = (struct sockaddr_in*)sa;
struct in_addr ia = si->sin_addr;
*ip = ia.s_addr;
freeaddrinfo(result);
return 0;
} else {
printf("Failed get the ip address from fqdn:%s, code:%d, reason:%s", fqdn, ret, gai_strerror(ret));
return -1;
}
}
info.host = arguments.host;
info.pktLen = arguments.pktLen;
void checkPort(uint32_t hostIp, uint16_t startPort, uint16_t maxPort, uint16_t pktLen) {
int ret;
info_s info;
memset(&info, 0, sizeof(info_s));
info.hostIp = hostIp;
info.pktLen = pktLen;
for (; port <= arguments.max_port; port++) {
for (uint16_t port = startPort; port <= maxPort; port++) {
//printf("test: %s:%d\n", info.host, port);
printf("\n");
info.port = port;
ret = checkTcpPort(&info);
if (ret != 0) {
printf("tcp port:%d test fail.\t\t", port);
printf("tcp port:%d test fail.\t\n", port);
} else {
printf("tcp port:%d test ok.\t\t", port);
}
ret = checkUdpPort(&info);
if (ret != 0) {
printf("udp port:%d test fail.\t\t", port);
printf("udp port:%d test fail.\t\n", port);
} else {
printf("udp port:%d test ok.\t\t", port);
}
}
printf("\n");
return ;
}
int main(int argc, char *argv[]) {
SArguments arguments = {"127.0.0.1", "", 6030, 6042, 1000};
int ret;
argp_parse(&argp, argc, argv, 0, 0, &arguments);
if (arguments.pktLen > MAX_PKG_LEN) {
printf("test pkg len overflow: %d, max len not greater than %d bytes\n", arguments.pktLen, MAX_PKG_LEN);
exit(0);
}
printf("host ip: %s\thost fqdn: %s\tport: %d\tmax_port: %d\tpkgLen: %d\n", arguments.host, arguments.fqdn, arguments.port, arguments.max_port, arguments.pktLen);
if (arguments.host[0] != 0) {
printf("\nstart connect to %s test:\n", arguments.host);
checkPort(inet_addr(arguments.host), arguments.port, arguments.max_port, arguments.pktLen);
printf("\n");
}
if (arguments.fqdn[0] != 0) {
uint32_t hostIp = 0;
ret = getIpFromFqdn(arguments.fqdn, &hostIp);
if (ret) {
printf("\n");
return 0;
}
printf("\nstart connetc to %s test:\n", arguments.fqdn);
checkPort(hostIp, arguments.port, arguments.max_port, arguments.pktLen);
printf("\n");
}
return 0;
}
......@@ -142,9 +142,9 @@ static void *bindTcpPort(void *sarg) {
printf("recv Client: %s pkg from TCP port: %d, pkg len: %d\n", inet_ntoa(clientAddr.sin_addr), port, iDataNum);
if (iDataNum > 0) {
send(client, buffer, iDataNum, 0);
break;
}
}
close(serverSocket);
return NULL;
}
......@@ -201,7 +201,7 @@ static void *bindUdpPort(void *sarg) {
int main(int argc, char *argv[]) {
SArguments arguments = {"127.0.0.1", 6030, 6060, 1000};
SArguments arguments = {"127.0.0.1", 6030, 6042, 1000};
argp_parse(&argp, argc, argv, 0, 0, &arguments);
if (arguments.pktLen > MAX_PKG_LEN) {
printf("test pkg len overflow: %d, max len not greater than %d bytes\n", arguments.pktLen, MAX_PKG_LEN);
......
......@@ -563,7 +563,7 @@ static SRpcConn *rpcOpenConn(SRpcInfo *pRpc, char *peerFqdn, uint16_t peerPort,
uint32_t peerIp = taosGetIpFromFqdn(peerFqdn);
if (peerIp == 0xFFFFFFFF) {
tError("%s, failed to resolve FQDN:%s", pRpc->label, peerFqdn);
terrno = TSDB_CODE_RPC_APP_ERROR;
terrno = TSDB_CODE_RPC_FQDN_ERROR;
return NULL;
}
......
......@@ -24,22 +24,46 @@ function runTest {
for r in ${!rowsPerRequest[@]}; do
for c in `seq 1 $clients`; do
totalRPR=0
OUTPUT_FILE=tdengineTestWrite-RPR${rowsPerRequest[$r]}-clients$c.out
if $v16 ; then
OUTPUT_FILE=tdengineTestWrite-v16-RPR${rowsPerRequest[$r]}-clients$c.out
else
OUTPUT_FILE=tdengineTestWrite-v20-RPR${rowsPerRequest[$r]}-clients$c.out
fi
for i in `seq 1 $NUM_LOOP`; do
restartTaosd
$TAOSD_DIR/taos -s "drop database db" > /dev/null 2>&1
printTo "loop i:$i, $TDTEST_DIR/tdengineTest \
if ! $printresultonly ; then
restartTaosd
$TAOSD_DIR/taos -s "drop database db" > /dev/null 2>&1
if $v16 ; then
printTo "loop i:$i, $TDTEST_DIR/tdengineTest \
-dataDir $DATA_DIR \
-numOfFiles $NUM_OF_FILES \
-w -clients $c \
-rowsPerRequest ${rowsPerRequest[$r]}"
$TDTEST_DIR/tdengineTest \
-dataDir $DATA_DIR \
-numOfFiles $NUM_OF_FILES \
-w -clients $c \
-rowsPerRequest ${rowsPerRequest[$r]} \
| tee $OUTPUT_FILE
-writeClients $c \
-rowsPerRequest ${rowsPerRequest[$r]} \
| tee $OUTPUT_FILE"
$TDTEST_DIR/tdengineTest \
-dataDir $DATA_DIR \
-numOfFiles $NUM_OF_FILES \
-writeClients $c \
-rowsPerRequest ${rowsPerRequest[$r]} \
| tee $OUTPUT_FILE
else
printTo "loop i:$i, $TDTEST_DIR/tdengineTest \
-dataDir $DATA_DIR \
-numOfFiles $NUM_OF_FILES \
-w -clients $c \
-rowsPerRequest ${rowsPerRequest[$r]} \
| tee $OUTPUT_FILE"
$TDTEST_DIR/tdengineTest \
-dataDir $DATA_DIR \
-numOfFiles $NUM_OF_FILES \
-w -clients $c \
-rowsPerRequest ${rowsPerRequest[$r]} \
| tee $OUTPUT_FILE
fi
fi
RPR=`cat $OUTPUT_FILE | grep speed | awk '{print $(NF-1)}'`
totalRPR=`echo "scale=4; $totalRPR + $RPR" | bc`
printTo "rows:${rowsPerRequest[$r]}, clients:$c, i:$i RPR:$RPR"
......@@ -86,25 +110,30 @@ function restartTaosd {
################ Main ################
master=false
develop=true
v16=false
v20=true
verbose=false
clients=1
printresultonly=false
while : ; do
case $1 in
printresultonly)
printresultonly=true
shift ;;
-v)
verbose=true
shift ;;
master)
master=true
develop=false
v16)
v16=true
v20=false
shift ;;
develop)
master=false
develop=true
v20)
v16=false
v20=true
shift ;;
-c)
......@@ -120,19 +149,24 @@ while : ; do
esac
done
if $master ; then
echo "Test master branch.."
cp /mnt/root/cfg/master/taos.cfg /etc/taos/taos.cfg
WORK_DIR=/mnt/root/TDengine.master
if $v16 ; then
echo "Test v16 branch.."
WORK_DIR=/mnt/root/TDengine.v16
cp /mnt/root/cfg/v16/taos.cfg /etc/taos/taos.cfg
else
echo "Test develop branch.."
cp /mnt/root/cfg/develop/taos.cfg /etc/taos/taos.cfg
echo "Test v20 branch.."
cp /mnt/root/cfg/v20/taos.cfg /etc/taos/taos.cfg
WORK_DIR=/mnt/root/TDengine
fi
TAOSD_DIR=$WORK_DIR/debug/build/bin
TDTEST_DIR=$WORK_DIR/tests/comparisonTest/tdengine
if [ ! -f $TDTEST_DIR/tdengineTest ]; then
echo "Please build tdengineTest first!"
exit 1
fi
runTest
echo "Test done!"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册