diff --git a/src/mnode/src/mnodeVgroup.c b/src/mnode/src/mnodeVgroup.c index 74aa27b6c17e20f54b0ac99d01f7fab9576cbac4..b6e57a0c603ffab2da3d3e6122ff8074f720a84b 100644 --- a/src/mnode/src/mnodeVgroup.c +++ b/src/mnode/src/mnodeVgroup.c @@ -408,6 +408,8 @@ int32_t mnodeGetAvailableVgroup(SMnodeMsg *pMsg, SVgObj **ppVgroup, int32_t *pSi } SVgObj *pVgroup = pDb->vgList[0]; + if (pVgroup == NULL) return TSDB_CODE_MND_NO_ENOUGH_DNODES; + int32_t code = mnodeAllocVgroupIdPool(pVgroup); if (code != TSDB_CODE_SUCCESS) { pthread_mutex_unlock(&pDb->mutex); diff --git a/tests/script/general/db/alter_option.sim b/tests/script/general/db/alter_option.sim index f871ead11df579494aea818cf186c346932f6bea..076f7364ee2a53401af1c2f78ee72ea4862c7509 100644 --- a/tests/script/general/db/alter_option.sim +++ b/tests/script/general/db/alter_option.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 1000 +system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 1000 system sh/exec.sh -n dnode1 -s start @@ -10,7 +10,7 @@ sleep 3000 sql connect print ============================ dnode1 start -sql create database db maxTables 500 cache 2 blocks 4 days 10 keep 20 minRows 300 maxRows 400 ctime 120 precision 'ms' comp 2 wal 1 replica 1 +sql create database db cache 2 blocks 4 days 10 keep 20 minRows 300 maxRows 400 ctime 120 precision 'ms' comp 2 wal 1 replica 1 sql show databases print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 if $data00 != db then @@ -31,13 +31,10 @@ endi if $data06 != 20,20,20 then return -1 endi -if $data07 != 500 then +if $data07 != 2 then return -1 endi -if $data08 != 2 then - return -1 -endi -if $data09 != 4 then +if $data08 != 4 then return -1 endi @@ -46,7 +43,6 @@ system sh/exec.sh -n dnode1 -s stop -x SIGINT return sql_error alter database db cache 256 sql_error alter database db blocks 1 -sql_error alter database db maxTables 10 sql_error alter database db days 10 sql_error alter database db keep 10 sql_error alter database db minRows 350 @@ -59,7 +55,6 @@ sql_error alter database db replica 2 print ============== step3 -sql alter database db maxTables 1000 sql alter database db comp 1 sql alter database db blocks 40 sql alter database db keep 30 diff --git a/tests/script/general/db/alter_tables_d2.sim b/tests/script/general/db/alter_tables_d2.sim index bf950a5e49db189cb2b4dda47c5cd85030bf46d7..9ef39fb55664ad0f984a3a2b4971daa69feec074 100644 --- a/tests/script/general/db/alter_tables_d2.sim +++ b/tests/script/general/db/alter_tables_d2.sim @@ -1,11 +1,13 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 2 +system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 4 +system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 5 system sh/deploy.sh -n dnode2 -i 2 system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 2 +system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 4 +system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 5 system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode2 -s start @@ -17,7 +19,7 @@ sleep 1000 print ============================ step1 -sql create database db maxTables 5 +sql create database db sql create table db.st (ts timestamp, i int) tags(t int) sql create table db.t000 using db.st tags(0) sql create table db.t001 using db.st tags(1) @@ -74,9 +76,14 @@ if $rows != 20 then endi print ============================ step3 - -sql alter database db maxTables 10 -sleep 1000 +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 10 +system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 10 +sleep 5000 +system sh/exec.sh -n dnode1 -s start +system sh/exec.sh -n dnode2 -s start +sleep 5000 sql create table db.t100 using db.st tags(0) sql create table db.t101 using db.st tags(1) @@ -133,9 +140,14 @@ if $rows != 40 then endi print ============================ step5 - -sql alter database db maxTables 15 -sleep 1000 +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 15 +system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 15 +sleep 5000 +system sh/exec.sh -n dnode1 -s start +system sh/exec.sh -n dnode2 -s start +sleep 5000 sql create table db.t200 using db.st tags(0) sql create table db.t201 using db.st tags(1) @@ -252,9 +264,14 @@ if $rows != 60 then endi print ============================ step9 - -sql alter database db maxTables 20 -sleep 1000 +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 20 +system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 20 +sleep 5000 +system sh/exec.sh -n dnode1 -s start +system sh/exec.sh -n dnode2 -s start +sleep 5000 sql create table db.t300 using db.st tags(0) sql create table db.t301 using db.st tags(1) @@ -380,9 +397,14 @@ if $rows != 80 then endi print ============================ step9 - -sql alter database db maxTables 25 -sleep 1000 +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 25 +system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 25 +sleep 5000 +system sh/exec.sh -n dnode1 -s start +system sh/exec.sh -n dnode2 -s start +sleep 5000 sql create table db.t400 using db.st tags(0) sql create table db.t401 using db.st tags(1) diff --git a/tests/script/general/db/alter_tables_v1.sim b/tests/script/general/db/alter_tables_v1.sim index ccddb8f95926197b25dcf27b9ab0eb24a8b5410f..dde5eb6d9ecfbce4467a54abf883cc6b9ffbb696 100644 --- a/tests/script/general/db/alter_tables_v1.sim +++ b/tests/script/general/db/alter_tables_v1.sim @@ -1,8 +1,8 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 -system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 1 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 1000 +system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 +system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 10 system sh/exec.sh -n dnode1 -s start @@ -11,7 +11,7 @@ sql connect print ============================ step1 -sql create database db maxTables 10 +sql create database db sql create table db.st (ts timestamp, i int) tags(t int) sql create table db.t0 using db.st tags(0) sql create table db.t1 using db.st tags(1) @@ -49,8 +49,11 @@ endi print ============================ step3 -sql alter database db maxTables 20 -sleep 1000 +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 20 +sleep 5000 +system sh/exec.sh -n dnode1 -s start +sleep 5000 sql create table db.t10 using db.st tags(0) sql create table db.t11 using db.st tags(1) @@ -86,9 +89,11 @@ if $rows != 20 then endi print ============================ step5 - -sql alter database db maxTables 30 -sleep 1000 +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 30 +sleep 5000 +system sh/exec.sh -n dnode1 -s start +sleep 5000 sql create table db.t20 using db.st tags(0) sql create table db.t21 using db.st tags(1) @@ -183,9 +188,11 @@ if $rows != 30 then endi print ============================ step9 - -sql alter database db maxTables 40 -sleep 1000 +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 40 +sleep 5000 +system sh/exec.sh -n dnode1 -s start +sleep 5000 sql create table db.t30 using db.st tags(0) sql create table db.t31 using db.st tags(1) @@ -285,9 +292,11 @@ if $rows != 40 then endi print ============================ step12 - -sql alter database db maxTables 50 -sleep 1000 +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 50 +sleep 5000 +system sh/exec.sh -n dnode1 -s start +sleep 5000 sql create table db.t40 using db.st tags(0) sql create table db.t41 using db.st tags(1) diff --git a/tests/script/general/db/alter_tables_v4.sim b/tests/script/general/db/alter_tables_v4.sim index 75687b417e9dd41fb229e12c6478f7bb4fed723d..7c9262874d8f07cef92df2585fe60261ea763080 100644 --- a/tests/script/general/db/alter_tables_v4.sim +++ b/tests/script/general/db/alter_tables_v4.sim @@ -1,8 +1,8 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 -system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 1000 +system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 4 +system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 5 system sh/exec.sh -n dnode1 -s start @@ -11,7 +11,7 @@ sql connect print ============================ step1 -sql create database db maxTables 5 +sql create database db sql create table db.st (ts timestamp, i int) tags(t int) sql create table db.t000 using db.st tags(0) sql create table db.t001 using db.st tags(1) @@ -68,9 +68,11 @@ if $rows != 20 then endi print ============================ step3 - -sql alter database db maxTables 10 -sleep 1000 +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 10 +sleep 5000 +system sh/exec.sh -n dnode1 -s start +sleep 5000 sql create table db.t100 using db.st tags(0) sql create table db.t101 using db.st tags(1) @@ -127,9 +129,11 @@ if $rows != 40 then endi print ============================ step5 - -sql alter database db maxTables 15 -sleep 1000 +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 15 +sleep 5000 +system sh/exec.sh -n dnode1 -s start +sleep 5000 sql create table db.t200 using db.st tags(0) sql create table db.t201 using db.st tags(1) @@ -244,9 +248,11 @@ if $rows != 60 then endi print ============================ step9 - -sql alter database db maxTables 20 -sleep 1000 +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 20 +sleep 5000 +system sh/exec.sh -n dnode1 -s start +sleep 5000 sql create table db.t300 using db.st tags(0) sql create table db.t301 using db.st tags(1) @@ -370,10 +376,11 @@ if $rows != 80 then endi print ============================ step12 - -sql alter database db maxTables 25 -sleep 1000 - +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 25 +sleep 5000 +system sh/exec.sh -n dnode1 -s start +sleep 5000 sql create table db.t400 using db.st tags(0) sql create table db.t401 using db.st tags(1) sql create table db.t402 using db.st tags(2) diff --git a/tests/script/general/db/alter_vgroups.sim b/tests/script/general/db/alter_vgroups.sim index 93f3b1c0e5f25bfc17e2761ff695c3f7d8d27513..13928cf03301f1528db3a1fd9e5951b3115a6125 100644 --- a/tests/script/general/db/alter_vgroups.sim +++ b/tests/script/general/db/alter_vgroups.sim @@ -1,8 +1,8 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 -system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 1 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 1000 +system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 +system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 20 system sh/exec.sh -n dnode1 -s start @@ -11,7 +11,7 @@ sql connect print ============================ step1 -sql create database db maxTables 20 +sql create database db sql create table db.st (ts timestamp, i int) tags(t int) sql create table db.t000 using db.st tags(0) sql create table db.t001 using db.st tags(1) @@ -69,7 +69,7 @@ endi print ============================ step3 system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 2 +system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 2 sleep 5000 system sh/exec.sh -n dnode1 -s start sleep 5000 @@ -131,7 +131,7 @@ endi print ============================ step5 system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 3 +system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 3 sleep 5000 system sh/exec.sh -n dnode1 -s start sleep 5000 diff --git a/tests/script/general/db/basic.sim b/tests/script/general/db/basic.sim index 43b18abd3231c135ab798f61d4aa70ed5abd2abe..9983df378eb9520777dbf2b1db26cc8023980e46 100644 --- a/tests/script/general/db/basic.sim +++ b/tests/script/general/db/basic.sim @@ -1,8 +1,8 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 -system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 1000 +system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 4 +system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 1000 system sh/exec.sh -n dnode1 -s start @@ -17,7 +17,7 @@ $db = $dbPrefix . $i $tb = $tbPrefix . $i print =============== step1 -sql create database $db replica 1 days 20 keep 2000 +sql create database $db replica 1 days 20 keep 2000 cache 16 sql show databases print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 if $data00 != $db then @@ -35,7 +35,7 @@ endi if $data05 != 20 then return -1 endi -if $data07 != 1000 then +if $data07 != 16 then return -1 endi @@ -76,13 +76,6 @@ if $data05 != 15 then return -1 endi -#if $data06 != 1500,15000,1500 then -# return -1 -#endi -if $data07 != 1000 then - return -1 -endi - print =============== step6 sql use $db sql create table $tb (ts timestamp, speed int) diff --git a/tests/script/sh/deploy.sh b/tests/script/sh/deploy.sh index ebbad475f7238031ce92142c0ac918e2f344762b..66ac1c42badc4dc911260ac8c844ffd8a9b26743 100755 --- a/tests/script/sh/deploy.sh +++ b/tests/script/sh/deploy.sh @@ -137,6 +137,8 @@ echo "mnodeEqualVnodeNum 0" >> $TAOS_CFG echo "clog 2" >> $TAOS_CFG echo "statusInterval 1" >> $TAOS_CFG echo "numOfTotalVnodes 4" >> $TAOS_CFG +echo "maxVgroupsPerDb 4" >> $TAOS_CFG +echo "maxTablesPerVnode 1000" >> $TAOS_CFG echo "asyncLog 0" >> $TAOS_CFG echo "numOfMnodes 1" >> $TAOS_CFG echo "locale en_US.UTF-8" >> $TAOS_CFG