From 683baa289999ddff3e5e3f004de849a2aa08f735 Mon Sep 17 00:00:00 2001 From: slguan Date: Fri, 15 Nov 2019 11:59:36 +0800 Subject: [PATCH 1/7] [TBASE1020] --- src/client/src/tscSql.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index 10eac0bb63..6ec8f425ca 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -647,11 +647,8 @@ int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows) { pCmd->limit.limit = pSql->cmd.globalLimit - pRes->numOfTotal; pCmd->limit.offset = pRes->offset; -#ifdef CLUSTER - if ((++pSql->cmd.vnodeIdx) <= pMeterMetaInfo->pMetricMeta->numOfVnodes) { -#else + if ((++pSql->cmd.vnodeIdx) < pMeterMetaInfo->pMetricMeta->numOfVnodes) { -#endif pSql->cmd.command = TSDB_SQL_SELECT; assert(pSql->fp == NULL); tscProcessSql(pSql); From 5a09ffebb9bd446cf1f15eda6d8fc0b12afe0556 Mon Sep 17 00:00:00 2001 From: malong Date: Fri, 15 Nov 2019 15:06:01 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E6=8C=89=E6=97=B6=E9=97=B4=E5=91=A8?= =?UTF-8?q?=E6=9C=9F=E8=81=9A=E5=90=88=E6=9F=A5=E8=AF=A2=20=E4=B8=AD=20WHE?= =?UTF-8?q?RE=E5=90=8E=E9=9D=A2=E7=9A=84name=20=E6=94=B9=E4=B8=BA=20locati?= =?UTF-8?q?on?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- documentation/tdenginedocs-cn/super-table/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/tdenginedocs-cn/super-table/index.html b/documentation/tdenginedocs-cn/super-table/index.html index 5ee9587b2f..3d2681990a 100644 --- a/documentation/tdenginedocs-cn/super-table/index.html +++ b/documentation/tdenginedocs-cn/super-table/index.html @@ -105,6 +105,6 @@ GROUP BY location, type

查询仅位于北京以外地区的温度传感器最近24小时(24h)采样值的数量count(*)、平均温度avg(degree)、最高温度max(degree)和最低温度min(degree),将采集结果按照10分钟为周期进行聚合,并将结果按所处地域(location)和传感器类型(type)再次进行聚合。

SELECT COUNT(*), AVG(degree), MAX(degree), MIN(degree)
 FROM thermometer
-WHERE name<>'beijing' and ts>=now-1d
+WHERE location<>'beijing' and ts>=now-1d
 INTERVAL(10M)
 GROUP BY location, type
回去 From a52ea6e614c465e2b72fdb39e887f50dc5a9f3c9 Mon Sep 17 00:00:00 2001 From: malong Date: Fri, 15 Nov 2019 15:22:39 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=B1=BBSQL=E8=AF=AD?= =?UTF-8?q?=E8=A8=80=E7=94=A8=E6=8F=92=E5=85=A5=E6=88=96=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=20=E6=94=B9=E4=B8=BA=EF=BC=9A=20=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=B1=BBSQL=E8=AF=AD=E8=A8=80=E6=8F=92=E5=85=A5?= =?UTF-8?q?=E6=88=96=E6=9F=A5=E8=AF=A2=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- documentation/tdenginedocs-cn/getting-started/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/tdenginedocs-cn/getting-started/index.html b/documentation/tdenginedocs-cn/getting-started/index.html index d7e8fe311c..65ef667d00 100644 --- a/documentation/tdenginedocs-cn/getting-started/index.html +++ b/documentation/tdenginedocs-cn/getting-started/index.html @@ -63,7 +63,7 @@ Query OK, 2 row(s) in set (0.001700s)

主要功能

TDengine的核心功能是时序数据库。除此之外,为减少研发的复杂度、系统维护的难度,TDengine还提供缓存、消息队列、订阅、流式计算等功能。更详细的功能如下:

    -
  • 使用类SQL语言用插入或查询数据
  • +
  • 使用类SQL语言插入或查询数据
  • 支持C/C++, Java(JDBC), Python, Go, RESTful, and Node.JS 开发接口
  • 可通过Python/R/Matlab or TDengine shell做Ad Hoc查询分析
  • 通过定时连续查询支持基于滑动窗口的流式计算
  • From e42fff8bb770698d02c56b9af91b070b0f6e1329 Mon Sep 17 00:00:00 2001 From: malong Date: Fri, 15 Nov 2019 15:38:55 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E6=AD=A4=E6=97=B6=E5=8F=AF=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E8=87=AA=E5=8A=A8=E5=BB=BA=E8=A1=A8=E8=AF=AD=E6=B3=95?= =?UTF-8?q?=E6=9D=A5=E5=AE=9E=E7=8E=B0=E5=86=99=E5=85=A5=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=97=B6=E9=87=8C=E7=94=A8=E8=B6=85=E7=BA=A7=E8=A1=A8=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E7=9A=84=E8=A1=A8=E7=BB=93=E6=9E=84=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E4=B8=8D=E5=AD=98=E5=9C=A8=E7=9A=84=E5=AD=90?= =?UTF-8?q?=E8=A1=A8=20=E5=A4=9A=E4=BA=86=E4=B8=AA=E2=80=98=E9=87=8C?= =?UTF-8?q?=E2=80=99=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- documentation/tdenginedocs-cn/super-table/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/tdenginedocs-cn/super-table/index.html b/documentation/tdenginedocs-cn/super-table/index.html index 3d2681990a..679f4c307b 100644 --- a/documentation/tdenginedocs-cn/super-table/index.html +++ b/documentation/tdenginedocs-cn/super-table/index.html @@ -40,7 +40,7 @@ tags (location binary(20), type int)

    统计属于某个STable并满足查询条件的子表的数量

写数据时自动建子表

-

在某些特殊场景中,用户在写数据时并不确定某个设备的表是否存在,此时可使用自动建表语法来实现写入数据时里用超级表定义的表结构自动创建不存在的子表,若该表已存在则不会建立新表。注意:自动建表语句只能自动建立子表而不能建立超级表,这就要求超级表已经被事先定义好。自动建表语法跟insert/import语法非常相似,唯一区别是语句中增加了超级表和标签信息。具体语法如下:

+

在某些特殊场景中,用户在写数据时并不确定某个设备的表是否存在,此时可使用自动建表语法来实现写入数据时用超级表定义的表结构自动创建不存在的子表,若该表已存在则不会建立新表。注意:自动建表语句只能自动建立子表而不能建立超级表,这就要求超级表已经被事先定义好。自动建表语法跟insert/import语法非常相似,唯一区别是语句中增加了超级表和标签信息。具体语法如下:

INSERT INTO <tb_name> USING <stb_name> TAGS (<tag1_value>, ...) VALUES (field_value, ...) (field_value, ...) ...;

向表tb_name中插入一条或多条记录,如果tb_name这张表不存在,则会用超级表stb_name定义的表结构以及用户指定的标签值(即tag1_value…)来创建名为tb_name新表,并将用户指定的值写入表中。如果tb_name已经存在,则建表过程会被忽略,系统也不会检查tb_name的标签是否与用户指定的标签值一致,也即不会更新已存在表的标签。

INSERT INTO <tb1_name> USING <stb1_name> TAGS (<tag1_value1>, ...) VALUES (<field1_value1>, ...) (<field1_value2>, ...) ... <tb_name2> USING <stb_name2> TAGS(<tag1_value2>, ...) VALUES (<field1_value1>, ...) ...;
From 48c470e21c81c4c1c651b31d8823e15aac6573bc Mon Sep 17 00:00:00 2001 From: malong Date: Fri, 15 Nov 2019 15:47:34 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E2=80=9C=E8=B6=85=E7=BA=A7=E8=A1=A8?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E2=80=9D=E7=9A=84=E8=AF=B4=E6=98=8E=E2=80=9C?= =?UTF-8?q?2.TAGS=E5=88=97=E7=9A=84=E6=95=B0=E6=8D=AE=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E6=98=AFtimestamp=E5=92=8Cnchar=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=EF=BC=9B=E6=8F=8F=E8=BF=B0=E9=94=99=E8=AF=AF=EF=BC=8C?= =?UTF-8?q?=E5=AE=9E=E9=99=85tags=E6=98=AF=E6=94=AF=E6=8C=81nchar=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- documentation/tdenginedocs-cn/super-table/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/tdenginedocs-cn/super-table/index.html b/documentation/tdenginedocs-cn/super-table/index.html index 679f4c307b..828a69bb0c 100644 --- a/documentation/tdenginedocs-cn/super-table/index.html +++ b/documentation/tdenginedocs-cn/super-table/index.html @@ -24,7 +24,7 @@ tags (location binary(20), type int)

说明:

  1. TAGS列总长度不能超过512 bytes;
  2. -
  3. TAGS列的数据类型不能是timestamp和nchar类型;
  4. +
  5. TAGS列的数据类型不能是timestamp类型;
  6. TAGS列名不能与其他列名相同;
  7. TAGS列名不能为预留关键字.
  • 显示已创建的超级表

    From 29a98bbe6108c5ee4cb6c879dac8b113a15db592 Mon Sep 17 00:00:00 2001 From: fangpanpan Date: Fri, 15 Nov 2019 16:03:04 +0800 Subject: [PATCH 6/7] [tbase-814] --- src/client/src/tscServer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index cea17400cd..75e4c9606f 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -431,8 +431,9 @@ void *tscProcessMsgFromServer(char *msg, void *ahandle, void *thandle) { } } } else { -#ifdef CLUSTER uint16_t rspCode = pMsg->content[0]; +#ifdef CLUSTER + if (rspCode == TSDB_CODE_REDIRECT) { tscTrace("%p it shall be redirected!", pSql); From 95955cb474d57c1233546036d6b0507ed81c02b0 Mon Sep 17 00:00:00 2001 From: slguan Date: Fri, 15 Nov 2019 19:01:01 +0800 Subject: [PATCH 7/7] [TBASE-1155] --- src/os/darwin/src/tdarwin.c | 12 ++++++++---- src/os/linux/src/tsystem.c | 19 ------------------- src/os/windows/src/twindows.c | 4 ---- src/system/detail/src/vnodeImport.c | 3 ++- src/util/src/tutil.c | 19 +++++++++++++++++++ 5 files changed, 29 insertions(+), 28 deletions(-) diff --git a/src/os/darwin/src/tdarwin.c b/src/os/darwin/src/tdarwin.c index eec252d660..71e8a56466 100644 --- a/src/os/darwin/src/tdarwin.c +++ b/src/os/darwin/src/tdarwin.c @@ -243,10 +243,6 @@ int taosInitTimer(void (*callback)(int), int ms) { return setitimer(ITIMER_REAL, &tv, NULL); } -char *taosCharsetReplace(char *charsetstr) { - return charsetstr; -} - void taosGetSystemTimezone() { // get and set default timezone SGlobalConfig *cfg_timezone = tsGetConfigOption("timezone"); @@ -416,3 +412,11 @@ int tsem_post(dispatch_semaphore_t *sem) { int tsem_destroy(dispatch_semaphore_t *sem) { return 0; } + +int32_t __sync_val_load_32(int32_t *ptr) { + return __atomic_load_n(ptr, __ATOMIC_ACQUIRE); +} + +void __sync_val_restore_32(int32_t *ptr, int32_t newval) { + __atomic_store_n(ptr, newval, __ATOMIC_RELEASE); +} \ No newline at end of file diff --git a/src/os/linux/src/tsystem.c b/src/os/linux/src/tsystem.c index fc2d9860d7..ccf9266f9b 100644 --- a/src/os/linux/src/tsystem.c +++ b/src/os/linux/src/tsystem.c @@ -210,25 +210,6 @@ void taosGetSystemTimezone() { pPrint("timezone not configured, set to system default:%s", tsTimezone); } -typedef struct CharsetPair { - char *oldCharset; - char *newCharset; -} CharsetPair; - -char *taosCharsetReplace(char *charsetstr) { - CharsetPair charsetRep[] = { - {"utf8", "UTF-8"}, {"936", "CP936"}, - }; - - for (int32_t i = 0; i < tListLen(charsetRep); ++i) { - if (strcasecmp(charsetRep[i].oldCharset, charsetstr) == 0) { - return strdup(charsetRep[i].newCharset); - } - } - - return strdup(charsetstr); -} - /* * POSIX format locale string: * (Language Strings)_(Country/Region Strings).(code_page) diff --git a/src/os/windows/src/twindows.c b/src/os/windows/src/twindows.c index 6c10ced6a2..9089f90d6a 100644 --- a/src/os/windows/src/twindows.c +++ b/src/os/windows/src/twindows.c @@ -205,10 +205,6 @@ __int64 interlocked_fetch_xor_64(__int64 volatile* ptr, __int64 val) { void tsPrintOsInfo() {} -char *taosCharsetReplace(char *charsetstr) { - return charsetstr; -} - void taosGetSystemTimezone() { // get and set default timezone SGlobalConfig *cfg_timezone = tsGetConfigOption("timezone"); diff --git a/src/system/detail/src/vnodeImport.c b/src/system/detail/src/vnodeImport.c index ed9c319216..4e1c3e33c6 100644 --- a/src/system/detail/src/vnodeImport.c +++ b/src/system/detail/src/vnodeImport.c @@ -546,6 +546,7 @@ int vnodeImportToCache(SImportInfo *pImport, char *payload, int rows) { return code; } + assert(rows); dTrace("vid:%d sid:%d id:%s, %d rows data will be imported to cache, firstKey:%ld lastKey:%ld", pObj->vnode, pObj->sid, pObj->meterId, rows, firstKey, lastKey); @@ -781,7 +782,7 @@ int vnodeImportStartToCache(SImportInfo *pImport, char *payload, int rows) { pImport->importedRows = rows; code = vnodeImportToCache(pImport, payload, rows); } else { - dTrace("vid:%d sid:%d id:%s, data is already imported to cache", pObj->vnode, pObj->sid, pObj->meterId); + dTrace("vid:%d sid:%d id:%s, data is already imported to cache, firstKey:%lld", pObj->vnode, pObj->sid, pObj->meterId, pImport->firstKey); } return code; diff --git a/src/util/src/tutil.c b/src/util/src/tutil.c index 0d1ea9ed50..af75a3ce0f 100644 --- a/src/util/src/tutil.c +++ b/src/util/src/tutil.c @@ -517,3 +517,22 @@ FORCE_INLINE double taos_align_get_double(char* pBuf) { *(int64_t*)(&dv) = *(int64_t*)pBuf; return dv; } + +typedef struct CharsetPair { + char *oldCharset; + char *newCharset; +} CharsetPair; + +char *taosCharsetReplace(char *charsetstr) { + CharsetPair charsetRep[] = { + { "utf8", "UTF-8" }, { "936", "CP936" }, + }; + + for (int32_t i = 0; i < tListLen(charsetRep); ++i) { + if (strcasecmp(charsetRep[i].oldCharset, charsetstr) == 0) { + return strdup(charsetRep[i].newCharset); + } + } + + return strdup(charsetstr); +}