Skip to content

Commit

Permalink
Merge pull request #29094 from taosdata/merge/mainto3.0
Browse files Browse the repository at this point in the history
mere: from main to 3.0 branch
  • Loading branch information
guanshengliang authored Dec 12, 2024
2 parents 2da142d + 74c86e5 commit 6149330
Show file tree
Hide file tree
Showing 86 changed files with 1,560 additions and 658 deletions.
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,12 @@ geos_c.h
source/libs/parser/src/sql.c
include/common/ttokenauto.h
!packaging/smokeTest/pytest_require.txt
tdengine-test-dir
tdengine-test-dir/
localtime.c
private.h
strftime.c
tzdir.h
tzfile.h
coverage.info
taos
taosd
6 changes: 3 additions & 3 deletions docs/en/08-operation/14-user.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ create user user_name pass'password' [sysinfo {1|0}] [createdb {1|0}]
The parameters are explained as follows.

- user_name: Up to 23 B long.
- password: Up to 128 B long, valid characters include letters and numbers as well as special characters other than single and double quotes, apostrophes, backslashes, and spaces, and it cannot be empty.
- password: The password must be between 8 and 16 characters long and include at least three types of characters from the following: uppercase letters, lowercase letters, numbers, and special characters. Special characters include `! @ # $ % ^ & * ( ) - _ + = [ ] { } : ; > < ? | ~ , .`.
- sysinfo: Whether the user can view system information. 1 means they can view it, 0 means they cannot. System information includes server configuration information, various node information such as dnode, query node (qnode), etc., as well as storage-related information, etc. The default is to view system information.
- createdb: Whether the user can create databases. 1 means they can create databases, 0 means they cannot. The default value is 0. // Supported starting from TDengine Enterprise version 3.3.2.0

The following SQL can create a user named test with the password 123456 who can view system information.
The following SQL can create a user named test with the password abc123!@# who can view system information.

```sql
create user test pass '123456' sysinfo 1
create user test pass 'abc123!@#' sysinfo 1
```

### Viewing Users
Expand Down
6 changes: 3 additions & 3 deletions docs/en/14-reference/03-taos-sql/25-user.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ CREATE USER user_name PASS 'password' [SYSINFO {1|0}] [CREATEDB {1|0}];

The username can be up to 23 bytes long.

The password can be up to 31 bytes long. The password can include letters, numbers, and special characters except for single quotes, double quotes, backticks, backslashes, and spaces, and it cannot be an empty string.
The password must be between 8 and 16 characters long and include at least three types of characters from the following: uppercase letters, lowercase letters, numbers, and special characters. Special characters include `! @ # $ % ^ & * ( ) - _ + = [ ] { } : ; > < ? | ~ , .`.

`SYSINFO` indicates whether the user can view system information. `1` means they can view, `0` means they have no permission to view. System information includes service configuration, dnode, vnode, storage, etc. The default value is `1`.

`CREATEDB` indicates whether the user can create databases. `1` means they can create databases, `0` means they have no permission to create databases. The default value is `0`. // Supported starting from TDengine Enterprise version 3.3.2.0

In the example below, we create a user with the password `123456` who can view system information.
In the example below, we create a user with the password `abc123!@#` who can view system information.

```sql
taos> create user test pass '123456' sysinfo 1;
taos> create user test pass 'abc123!@#' sysinfo 1;
Query OK, 0 of 0 rows affected (0.001254s)
```

Expand Down
2 changes: 1 addition & 1 deletion docs/en/14-reference/09-error-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ This document details the server error codes that may be encountered when using
| 0x80000350 | User already exists | Create user, duplicate creation | Confirm if the operation is correct |
| 0x80000351 | Invalid user | User does not exist | Confirm if the operation is correct |
| 0x80000352 | Invalid user format | Incorrect format | Confirm if the operation is correct |
| 0x80000353 | Invalid password format | Incorrect format | Confirm if the operation is correct |
| 0x80000353 | Invalid password format | The password must be between 8 and 16 characters long and include at least three types of characters from the following: uppercase letters, lowercase letters, numbers, and special characters. | Confirm the format of the password string |
| 0x80000354 | Can not get user from conn | Internal error | Report issue |
| 0x80000355 | Too many users | (Enterprise only) Exceeding user limit | Adjust configuration |
| 0x80000357 | Authentication failure | Incorrect password | Confirm if the operation is correct |
Expand Down
8 changes: 4 additions & 4 deletions docs/zh/08-operation/14-user.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ create user user_name pass'password' [sysinfo {1|0}] [createdb {1|0}]
```

相关参数说明如下。
- user_name:最长为 23 B
- password:最长为 128 B,合法字符包括字母和数字以及单双引号、撇号、反斜杠和空格以外的特殊字符,且不可以为空
- user_name:用户名最长不超过 23 个字节
- password:密码长度必须为 8 到 16 位,并且至少包含大写字母、小写字母、数字、特殊字符中的三类。特殊字符包括 `! @ # $ % ^ & * ( ) - _ + = [ ] { } : ; > < ? | ~ , .`
- sysinfo :用户是否可以查看系统信息。1 表示可以查看,0 表示不可以查看。系统信息包括服务端配置信息、服务端各种节点信息,如 dnode、查询节点(qnode)等,以及与存储相关的信息等。默认为可以查看系统信息。
- createdb:用户是否可以创建数据库。1 表示可以创建,0 表示不可以创建。缺省值为 0。// 从 TDengine 企业版 3.3.2.0 开始支持

如下 SQL 可以创建密码为 123456 且可以查看系统信息的用户 test。
如下 SQL 可以创建密码为 abc123!@# 且可以查看系统信息的用户 test。

```sql
create user test pass '123456' sysinfo 1
create user test pass 'abc123!@#' sysinfo 1
```

### 查看用户
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/14-reference/02-tools/08-taos-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ taos> SET MAX_BINARY_DISPLAY_WIDTH <nn>;
- -h HOST: 要连接的 TDengine 服务端所在服务器的 FQDN, 默认为连接本地服务
- -P PORT: 指定服务端所用端口号
- -u USER: 连接时使用的用户名
- -p PASSWORD: 连接服务端时使用的密码
- -p PASSWORD: 连接服务端时使用的密码,特殊字符如 `! & ( ) < > ; |` 需使用字符 `\` 进行转义处理
- -?, --help: 打印出所有命令行参数

还有更多其他参数:
Expand Down
3 changes: 2 additions & 1 deletion docs/zh/14-reference/03-taos-sql/02-database.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ database_option: {
- DURATION:数据文件存储数据的时间跨度。可以使用加单位的表示形式,如 DURATION 100h、DURATION 10d 等,支持 m(分钟)、h(小时)和 d(天)三个单位。不加时间单位时默认单位为天,如 DURATION 50 表示 50 天。
- MAXROWS:文件块中记录的最大条数,默认为 4096 条。
- MINROWS:文件块中记录的最小条数,默认为 100 条。
- KEEP:表示数据文件保存的天数,缺省值为 3650,取值范围 [1, 365000],且必须大于或等于 3 倍的 DURATION 参数值。数据库会自动删除保存时间超过 KEEP 值的数据从而释放存储空间。KEEP 可以使用加单位的表示形式,如 KEEP 100h、KEEP 10d 等,支持 m(分钟)、h(小时)和 d(天)三个单位。也可以不写单位,如 KEEP 50,此时默认单位为天。企业版支持[多级存储](https://docs.taosdata.com/tdinternal/arch/#%E5%A4%9A%E7%BA%A7%E5%AD%98%E5%82%A8)功能, 因此, 可以设置多个保存时间(多个以英文逗号分隔,最多 3 个,满足 keep 0 \<= keep 1 \<= keep 2,如 KEEP 100h,100d,3650d); 社区版不支持多级存储功能(即使配置了多个保存时间, 也不会生效, KEEP 会取最大的保存时间)。了解更多,请点击 [关于主键时间戳](https://docs.taosdata.com/reference/taos-sql/insert/)
- KEEP:表示数据文件保存的天数,缺省值为 3650,取值范围 [1, 365000],且必须大于或等于 3 倍的 DURATION 参数值。数据库会自动删除保存时间超过 KEEP 值的数据从而释放存储空间。KEEP 可以使用加单位的表示形式,如 KEEP 100h、KEEP 10d 等,支持 m(分钟)、h(小时)和 d(天)三个单位。也可以不写单位,如 KEEP 50,此时默认单位为天。企业版支持[多级存储](../../operation/planning/#%E5%A4%9A%E7%BA%A7%E5%AD%98%E5%82%A8)功能, 因此, 可以设置多个保存时间(多个以英文逗号分隔,最多 3 个,满足 keep 0 \<= keep 1 \<= keep 2,如 KEEP 100h,100d,3650d); 社区版不支持多级存储功能(即使配置了多个保存时间, 也不会生效, KEEP 会取最大的保存时间)。了解更多,请点击 [关于主键时间戳](https://docs.taosdata.com/reference/taos-sql/insert/)

- KEEP_TIME_OFFSET:自 3.2.0.0 版本生效。删除或迁移保存时间超过 KEEP 值的数据的延迟执行时间,默认值为 0 (小时)。在数据文件保存时间超过 KEEP 后,删除或迁移操作不会立即执行,而会额外等待本参数指定的时间间隔,以实现与业务高峰期错开的目的。
- STT_TRIGGER:表示落盘文件触发文件合并的个数。开源版本固定为 1,企业版本可设置范围为 1 到 16。对于少表高频写入场景,此参数建议使用默认配置;而对于多表低频写入场景,此参数建议配置较大的值。
- SINGLE_STABLE:表示此数据库中是否只可以创建一个超级表,用于超级表列非常多的情况。
Expand Down
6 changes: 3 additions & 3 deletions docs/zh/14-reference/03-taos-sql/25-user.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ CREATE USER user_name PASS 'password' [SYSINFO {1|0}] [CREATEDB {1|0}];

用户名最长不超过 23 个字节。

密码最长不超过 31 个字节。密码可以包含字母、数字以及除单引号、双引号、反引号、反斜杠和空格以外的特殊字符,密码不能为空字符串
密码长度必须为 8 到 16 位,并且至少包含大写字母、小写字母、数字、特殊字符中的三类。特殊字符包括 `! @ # $ % ^ & * ( ) - _ + = [ ] { } : ; > < ? | ~ , .`

`SYSINFO` 表示该用户是否能够查看系统信息。`1` 表示可以查看,`0` 表示无权查看。系统信息包括服务配置、dnode、vnode、存储等信息。缺省值为 `1`

`CREATEDB` 表示该用户是否能够创建数据库。`1` 表示可以创建,`0` 表示无权创建。缺省值为 `0`。// 从 TDengine 企业版 3.3.2.0 开始支持

在下面的示例中,我们创建一个密码为 `123456` 且可以查看系统信息的用户。
在下面的示例中,我们创建一个密码为 `abc123!@#` 且可以查看系统信息的用户。

```sql
taos> create user test pass '123456' sysinfo 1;
taos> create user test pass 'abc123!@#' sysinfo 1;
Query OK, 0 of 0 rows affected (0.001254s)
```

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/14-reference/05-connector/14-java.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ WKB规范请参考[Well-Known Binary (WKB)](https://libgeos.org/specifications/w

**原因**:程序没有找到依赖的本地函数库 taos。

**解决方法**:Windows 下可以将 C:\TDengine\driver\taos.dll 拷贝到 C:\Windows\System32\ 目录下,Linux 下将建立如下软链 `ln -s /usr/local/taos/driver/libtaos.so.x.x.x.x /usr/lib/libtaos.so` 即可,macOS 下需要建立软链 `ln -s /usr/local/lib/libtaos.dylib`。
**解决方法**:Windows 下可以将 C:\TDengine\driver\taos.dll 拷贝到 C:\Windows\System32\ 目录下,Linux 下将建立如下软链 `ln -s /usr/local/taos/driver/libtaos.so.x.x.x.x /usr/lib/libtaos.so` 即可,macOS 下需要建立软链 `ln -s /usr/local/lib/libtaos.dylib /usr/lib/libtaos.dylib`。

3. java.lang.UnsatisfiedLinkError: taos.dll Can't load AMD 64 bit on a IA 32-bit platform

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/14-reference/09-error-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ description: TDengine 服务端的错误码列表和详细说明
| 0x80000350 | User already exists | Create user, 重复创建 | 确认操作是否正确 |
| 0x80000351 | Invalid user | 用户不存在 | 确认操作是否正确 |
| 0x80000352 | Invalid user format | 格式不正确 | 确认操作是否正确 |
| 0x80000353 | Invalid password format | 格式不正确 | 确认操作是否正确 |
| 0x80000353 | Invalid password format | 密码长度必须为 8 到 16 位,并且至少包含大写字母、小写字母、数字、特殊字符中的三类 | 确认密码字符串的格式 |
| 0x80000354 | Can not get user from conn | 内部错误 | 上报issue |
| 0x80000355 | Too many users | (仅企业版)用户数量超限 | 调整配置 |
| 0x80000357 | Authentication failure | 密码不正确 | 确认操作是否正确 |
Expand Down
10 changes: 9 additions & 1 deletion docs/zh/27-train-faq/01-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,4 +280,12 @@ TDinsight插件中展示的数据是通过taosKeeper和taosAdapter服务收集
https://docs.taosdata.com/reference/components/taosd/#%E7%9B%91%E6%8E%A7%E7%9B%B8%E5%85%B3
您可以随时关闭该参数,只需要在taos.cfg 中修改telemetryReporting为 0,然后重启数据库服务即可。
代码位于:https://github.com/taosdata/TDengine/blob/62e609c558deb764a37d1a01ba84bc35115a85a4/source/dnode/mnode/impl/src/mndTelem.c
此外,对于安全性要求极高的企业版 TDengine Enterprise 来说,此参数不会工作。
此外,对于安全性要求极高的企业版 TDengine Enterprise 来说,此参数不会工作。
### 31 第一次连接集群时遇到“Sync leader is unreachable”怎么办?
报这个错,说明第一次向集群的连接是成功的,但第一次访问的IP不是mnode的leader节点,客户端试图与leader建立连接时发生错误。客户端通过EP,也就是指定的fqdn与端口号寻找leader节点,常见的报错原因有两个:

- 集群中其他节点的端口没有打开
- 客户端的hosts未正确配置

因此用户首先要检查服务端,集群的所有端口(原生连接默认6030,http连接默认6041)有无打开;其次是客户端的hosts文件中是否配置了集群所有节点的fqdn与IP信息。
如仍无法解决,则需要联系涛思技术人员支持。
25 changes: 15 additions & 10 deletions include/os/osString.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ typedef int32_t TdUcs4;
#if !defined(DISALLOW_NCHAR_WITHOUT_ICONV)// && defined(DARWIN)
#include "iconv.h"
#else
typedef void *iconv_t;
typedef void *iconv_t;
#endif
typedef enum { M2C = 0, C2M, CM_NUM } ConvType;

Expand Down Expand Up @@ -67,29 +67,34 @@ typedef struct {
#ifdef strndup
#undef strndup
#endif
#define strndup STR_TO_F_FUNC_TAOS_FORBID
#define strndup STR_TO_F_FUNC_TAOS_FORBID

#endif

#define tstrncpy(dst, src, size) \
do { \
(void)strncpy((dst), (src), (size)); \
(dst)[(size) - 1] = 0; \
(dst)[(size)-1] = 0; \
} while (0)

int64_t tsnprintf(char *dst, int64_t size, const char *format, ...);
#define TAOS_STRCPY(_dst, _src) ((void)strcpy(_dst, _src))
#define TAOS_STRCPY(_dst, _src) ((void)strcpy(_dst, _src))
#define TAOS_STRNCPY(_dst, _src, _size) ((void)strncpy(_dst, _src, _size))
#define TAOS_STRCAT(_dst, _src) ((void)strcat(_dst, _src))
#define TAOS_STRNCAT(_dst, _src, len) ((void)strncat(_dst, _src, len))
#define TAOS_STRCAT(_dst, _src) ((void)strcat(_dst, _src))
#define TAOS_STRNCAT(_dst, _src, len) ((void)strncat(_dst, _src, len))

char *tstrdup(const char *src);
int32_t taosUcs4len(TdUcs4 *ucs4);
int32_t taosStr2int64(const char *str, int64_t *val);
int32_t taosStr2int16(const char *str, int16_t *val);
int32_t taosStr2int32(const char *str, int32_t *val);
int32_t taosStr2int16(const char *str, int16_t *val);
int32_t taosStr2int8(const char *str, int8_t *val);

int32_t taosStr2Uint64(const char *str, uint64_t *val);
int32_t taosStr2Uint32(const char *str, uint32_t *val);
int32_t taosStr2Uint16(const char *str, uint16_t *val);
int32_t taosStr2Uint8(const char *str, uint8_t *val);

iconv_t taosAcquireConv(int32_t *idx, ConvType type, void* charsetCxt);
void taosReleaseConv(int32_t idx, iconv_t conv, ConvType type, void* charsetCxt);
int32_t taosUcs4ToMbs(TdUcs4 *ucs4, int32_t ucs4_max_len, char *mbs, void* charsetCxt);
Expand Down Expand Up @@ -122,9 +127,9 @@ float taosStr2Float(const char *str, char **pEnd);
int32_t taosHex2Ascii(const char *z, uint32_t n, void **data, uint32_t *size);
int32_t taosAscii2Hex(const char *z, uint32_t n, void **data, uint32_t *size);
char *taosStrndup(const char *s, int n);
//int32_t taosBin2Ascii(const char *z, uint32_t n, void** data, uint32_t* size);
bool isHex(const char* z, uint32_t n);
bool isValidateHex(const char* z, uint32_t n);
// int32_t taosBin2Ascii(const char *z, uint32_t n, void** data, uint32_t* size);
bool isHex(const char *z, uint32_t n);
bool isValidateHex(const char *z, uint32_t n);

#ifdef __cplusplus
}
Expand Down
2 changes: 2 additions & 0 deletions include/util/tdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ typedef enum ELogicConditionType {
#define TSDB_MAX_JSON_KEY_LEN 256

#define TSDB_AUTH_LEN 16
#define TSDB_PASSWORD_MIN_LEN 8
#define TSDB_PASSWORD_MAX_LEN 16
#define TSDB_PASSWORD_LEN 32
#define TSDB_USET_PASSWORD_LEN 129
#define TSDB_VERSION_LEN 32
Expand Down
5 changes: 5 additions & 0 deletions include/util/tutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ static FORCE_INLINE int32_t taosGetTbHashVal(const char *tbname, int32_t tblen,

#define TAOS_UNUSED(expr) (void)(expr)

bool taosIsBigChar(char c);
bool taosIsSmallChar(char c);
bool taosIsNumberChar(char c);
bool taosIsSpecialChar(char c);

#ifdef __cplusplus
}
#endif
Expand Down
8 changes: 7 additions & 1 deletion source/client/test/clientTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,13 @@ void* doConsumeData(void* param) {
int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
if (argc > 1) {
numOfThreads = atoi(argv[1]);
//numOfThreads = atoi(argv[1]);
int32_t code = taosStr2int32(argv[1], &numOfThreads);
if (code != 0) {
return code;
}


}

numOfThreads = TMAX(numOfThreads, 1);
Expand Down
Loading

0 comments on commit 6149330

Please sign in to comment.