merge 3.0

This commit is contained in:
Xiaoyu Wang 2022-12-13 14:25:53 +08:00
commit 9929c4aa72
14 changed files with 2106 additions and 1933 deletions

View File

@ -2,7 +2,7 @@
# taos-tools
ExternalProject_Add(taos-tools
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
GIT_TAG 4a4027c
GIT_TAG 121c8a3
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE

View File

@ -27,7 +27,6 @@ database_option: {
| PRECISION {'ms' | 'us' | 'ns'}
| REPLICA value
| RETENTIONS ingestion_duration:keep_duration ...
| STRICT {'off' | 'on'}
| WAL_LEVEL {1 | 2}
| VGROUPS value
| SINGLE_STABLE {0 | 1}
@ -61,9 +60,6 @@ database_option: {
- PRECISION: specifies the precision at which a database records timestamps. Enter ms for milliseconds, us for microseconds, or ns for nanoseconds. The default value is ms.
- REPLICA: specifies the number of replicas that are made of the database. Enter 1 or 3. The default value is 1. The value of the REPLICA parameter cannot exceed the number of dnodes in the cluster.
- RETENTIONS: specifies the retention period for data aggregated at various intervals. For example, RETENTIONS 15s:7d,1m:21d,15m:50d indicates that data aggregated every 15 seconds is retained for 7 days, data aggregated every 1 minute is retained for 21 days, and data aggregated every 15 minutes is retained for 50 days. You must enter three aggregation intervals and corresponding retention periods.
- STRICT: specifies whether strong data consistency is enabled. The default value is off.
- on: Strong consistency is enabled and implemented through the Raft consensus algorithm. In this mode, an operation is considered successful once it is confirmed by half of the nodes in the cluster.
- off: Strong consistency is disabled. In this mode, an operation is considered successful when it is initiated by the local node.
- WAL_LEVEL: specifies whether fsync is enabled. The default value is 1.
- 1: WAL is enabled but fsync is disabled.
- 2: WAL and fsync are both enabled.

View File

@ -598,6 +598,18 @@ The charset that takes effect is UTF-8.
| Value Range | 0: not consistent; 1: consistent. |
| Default | 1 |
## Compress Parameters
### compressMsgSize
| Attribute | Description |
| -------- | ----------------------------- |
| Applicable | Both Client and Server side |
| Meaning | Whether RPC message is compressed |
| Value Range | -1: none message is compressed; 0: all messages are compressed; N (N>0): messages exceeding N bytes are compressed |
| Default | -1 |
## Other Parameters
### enableCoreFile

View File

@ -27,7 +27,6 @@ database_option: {
| PRECISION {'ms' | 'us' | 'ns'}
| REPLICA value
| RETENTIONS ingestion_duration:keep_duration ...
| STRICT {'off' | 'on'}
| WAL_LEVEL {1 | 2}
| VGROUPS value
| SINGLE_STABLE {0 | 1}
@ -61,9 +60,6 @@ database_option: {
- PRECISION数据库的时间戳精度。ms 表示毫秒us 表示微秒ns 表示纳秒,默认 ms 毫秒。
- REPLICA表示数据库副本数取值为 1 或 3默认为 1。在集群中使用副本数必须小于或等于 DNODE 的数目。
- RETENTIONS表示数据的聚合周期和保存时长如 RETENTIONS 15s:7d,1m:21d,15m:50d 表示数据原始采集周期为 15 秒,原始数据保存 7 天;按 1 分钟聚合的数据保存 21 天;按 15 分钟聚合的数据保存 50 天。目前支持且只支持三级存储周期。
- STRICT表示数据同步的一致性要求默认为 off。
- on 表示强一致,即运行标准的 raft 协议,半数提交返回成功。
- off 表示弱一致,本地提交即返回成功。
- WAL_LEVELWAL 级别,默认为 1。
- 1写 WAL但不执行 fsync。
- 2写 WAL而且执行 fsync。

View File

@ -622,6 +622,17 @@ charset 的有效值是 UTF-8。
| 取值范围 | 0: 不启动1启动 |
| 缺省值 | 1 |
## 压缩参数
### compressMsgSize
| 属性 | 说明 |
| -------- | ----------------------------- |
| 适用于 | 服务端和客户端均适用 |
| 含义 | 是否对 RPC 消息进行压缩 |
| 取值范围 | -1: 所有消息都不压缩; 0: 所有消息都压缩; N (N>0): 只有大于 N 个字节的消息才压缩 |
| 缺省值 | -1 |
## 3.0 中有效的配置参数列表
| # | **参数** | **适用于 2.X ** | **适用于 3.0 ** | 3.0 版本的当前行为 |

View File

@ -149,10 +149,13 @@ int32_t dmRunDnode(SDnode *pDnode) {
return 0;
}
if (count == 0) osUpdate();
count %= 10;
count++;
if (count == 10) {
osUpdate();
count = 0;
} else {
count++;
}
taosMsleep(100);
}
}

View File

@ -554,14 +554,6 @@ static int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) {
goto SUBSCRIBE_OVER;
}
// check topic only
#if 0
if (mndCheckDbPrivilegeByName(pMnode, pMsg->info.conn.user, MND_OPER_READ_DB, pTopic->db) != 0) {
mndReleaseTopic(pMnode, pTopic);
goto SUBSCRIBE_OVER;
}
#endif
if (mndCheckTopicPrivilege(pMnode, pMsg->info.conn.user, MND_OPER_SUBSCRIBE, pTopic) != 0) {
mndReleaseTopic(pMnode, pTopic);
goto SUBSCRIBE_OVER;

View File

@ -91,11 +91,15 @@ static void doKeepLinearInfo(STimeSliceOperatorInfo* pSliceInfo, const SSDataBlo
SColumnInfoData* pTsCol = taosArrayGet(pBlock->pDataBlock, pSliceInfo->tsCol.slotId);
SFillLinearInfo* pLinearInfo = taosArrayGet(pSliceInfo->pLinearInfo, i);
if (!IS_MATHABLE_TYPE(pColInfoData->info.type)) {
continue;
}
// null value is represented by using key = INT64_MIN for now.
// TODO: optimize to ignore null values for linear interpolation.
if (!pLinearInfo->isStartSet) {
if (!colDataIsNull_s(pColInfoData, rowIndex)) {
ASSERT(IS_MATHABLE_TYPE(pColInfoData->info.type));
pLinearInfo->start.key = *(int64_t*)colDataGetData(pTsCol, rowIndex);
char* p = colDataGetData(pColInfoData, rowIndex);

View File

@ -232,7 +232,7 @@ alter_db_option(A) ::= KEEP integer_list(B).
alter_db_option(A) ::= KEEP variable_list(B). { A.type = DB_OPTION_KEEP; A.pList = B; }
alter_db_option(A) ::= PAGES NK_INTEGER(B). { A.type = DB_OPTION_PAGES; A.val = B; }
alter_db_option(A) ::= REPLICA NK_INTEGER(B). { A.type = DB_OPTION_REPLICA; A.val = B; }
alter_db_option(A) ::= STRICT NK_STRING(B). { A.type = DB_OPTION_STRICT; A.val = B; }
//alter_db_option(A) ::= STRICT NK_STRING(B). { A.type = DB_OPTION_STRICT; A.val = B; }
alter_db_option(A) ::= WAL_LEVEL NK_INTEGER(B). { A.type = DB_OPTION_WAL; A.val = B; }
alter_db_option(A) ::= STT_TRIGGER NK_INTEGER(B). { A.type = DB_OPTION_STT_TRIGGER; A.val = B; }

File diff suppressed because it is too large Load Diff

View File

@ -354,6 +354,10 @@ int32_t taosGetCpuInfo(char *cpuModel, int32_t maxLen, float *numOfCores) {
code = 0;
done |= 1;
}
int endPos = strlen(cpuModel)-1;
if (cpuModel[endPos] == '\n') {
cpuModel[endPos] = '\0';
}
taosCloseCmd(&pCmd);
pCmd = taosOpenCmd("sysctl -n machdep.cpu.core_count");

View File

@ -10,6 +10,7 @@
,,y,script,./test.sh -f tsim/user/password.sim
,,y,script,./test.sh -f tsim/user/privilege_db.sim
,,y,script,./test.sh -f tsim/user/privilege_sysinfo.sim
,,y,script,./test.sh -f tsim/user/privilege_topic.sim
,,y,script,./test.sh -f tsim/db/alter_option.sim
,,y,script,./test.sh -f tsim/db/alter_replica_13.sim
,,y,script,./test.sh -f tsim/db/alter_replica_31.sim

View File

@ -122,6 +122,9 @@ function runSimCases() {
function runPythonCases() {
echo "=== Run python cases ==="
cd $TDENGINE_DIR/tests/parallel_test
sed -i '/compatibility.py/d' cases.task
cd $TDENGINE_DIR/tests/system-test
runCasesOneByOne ../parallel_test/cases.task system-test

View File

@ -0,0 +1,156 @@
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect
print =============== create db
sql create database root_d1 vgroups 1;
sql create database root_d2 vgroups 1;
sql create database root_d3 vgroups 1;
sql show user privileges
if $rows != 1 then
return -1
endi
if $data(root)[1] != all then
return -1
endi
if $data(root)[2] != all then
return -1
endi
print =============== create users
sql create user user1 PASS 'taosdata'
sql create user user2 PASS 'taosdata'
sql create user user3 PASS 'taosdata'
sql create user user4 PASS 'taosdata'
sql create user user5 PASS 'taosdata'
sql create user user6 PASS 'taosdata'
sql alter user user1 sysinfo 0
sql select * from information_schema.ins_users
if $rows != 7 then
return -1
endi
sql GRANT read ON root_d1.* to user1;
sql GRANT write ON root_d2.* to user2;
sql GRANT read ON root_d3.* to user3;
sql GRANT write ON root_d3.* to user3;
sql show user privileges
if $rows != 5 then
return -1
endi
if $data(user1)[1] != read then
return -1
endi
if $data(user1)[2] != root_d1 then
return -1
endi
if $data(user2)[1] != write then
return -1
endi
if $data(user2)[2] != root_d2 then
return -1
endi
print =============== create topis
sql use root_d1
sql create table root_d1_stb (ts timestamp, i int) tags (j int)
sql create topic root_d1_topic1 as select ts, i from root_d1_stb
sql create topic root_d1_topic2 as select ts, i from root_d1_stb
sql create topic root_d1_topic3 as select ts, i from root_d1_stb
sql create topic root_d1_topic4 as select ts, i from root_d1_stb
sql show user privileges
if $rows != 5 then
return -1
endi
sql GRANT subscribe ON root_d1_topic1 TO user4
sql GRANT subscribe ON root_d1_topic2 TO user5
sql GRANT subscribe ON root_d1_topic3 TO user6
sql show user privileges
if $rows != 8 then
return -1
endi
if $data(user4)[1] != subscribe then
return -1
endi
if $data(user4)[2] != root_d1_topic1 then
return -1
endi
if $data(user5)[1] != subscribe then
return -1
endi
if $data(user5)[2] != root_d1_topic2 then
return -1
endi
if $data(user6)[1] != subscribe then
return -1
endi
if $data(user6)[2] != root_d1_topic3 then
return -1
endi
sql REVOKE subscribe ON root_d1_topic3 from user6
sql show user privileges
if $rows != 7 then
return -1
endi
if $data(user4)[1] != subscribe then
return -1
endi
if $data(user4)[2] != root_d1_topic1 then
return -1
endi
if $data(user5)[1] != subscribe then
return -1
endi
if $data(user5)[2] != root_d1_topic2 then
return -1
endi
print =============== repeat revoke/grant or invalid revoke/grant
sql GRANT subscribe ON root_d1_topic1 to user4
sql GRANT subscribe ON root_d1_topic2 to user4
sql GRANT subscribe ON root_d1_topic3 to user4
sql GRANT subscribe ON root_d1_topic1 to user5
sql GRANT subscribe ON root_d1_topic2 to user5
sql GRANT subscribe ON root_d1_topic3 to user5
sql GRANT subscribe ON root_d1_topic1 to user6
sql GRANT subscribe ON root_d1_topic2 to user6
sql GRANT subscribe ON root_d1_topic3 to user6
sql REVOKE subscribe ON root_d1_topic1 from user4
sql REVOKE subscribe ON root_d1_topic2 from user4
sql REVOKE subscribe ON root_d1_topic3 from user4
sql REVOKE subscribe ON root_d1_topic1 from user5
sql REVOKE subscribe ON root_d1_topic2 from user5
sql REVOKE subscribe ON root_d1_topic3 from user5
sql REVOKE subscribe ON root_d1_topic1 from user6
sql REVOKE subscribe ON root_d1_topic2 from user6
sql REVOKE subscribe ON root_d1_topic3 from user6
print =============== invalid revoke/grant
sql_error GRANT subscribe ON root_d1_topicx from user5
sql_error REVOKE subscribe ON root_d1_topicx from user5
print =============== check
sql GRANT subscribe ON root_d1_topic1 TO user4
sql GRANT subscribe ON root_d1_topic2 TO user5
sql GRANT subscribe ON root_d1_topic3 TO user6
sql show user privileges
if $rows != 8 then
return -1
endi
print =============== re connect
print user u1 login
sql close
sql connect user1
sql_error show user privileges
system sh/exec.sh -n dnode1 -s stop -x SIGINT