system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start sql connect sql create dnode $hostname port 7200 sql create dnode $hostname port 7300 $x = 0 step1: $x = $x + 1 sleep 1000 if $x == 10 then print ====> dnode not ready! return -1 endi sql show dnodes print ===> $data00 $data01 $data02 $data03 $data04 $data05 print ===> $data10 $data11 $data12 $data13 $data14 $data15 print ===> $data20 $data21 $data22 $data23 $data24 $data25 if $rows != 3 then return -1 endi if $data(1)[4] != ready then goto step1 endi if $data(2)[4] != ready then goto step1 endi if $data(3)[4] != ready then goto step1 endi print ============= create database #database_option: { # | BUFFER value [3~16384, default: 96] # | PAGES value [64~16384, default: 256] # | CACHEMODEL value ['node', 'last_row', 'last_value', 'both'] # | WAL_FSYNC_PERIOD value [0 ~ 180000 ms] # | KEEP value [duration, 365000] # | REPLICA value [1 | 3] # | WAL_LEVEL value [1 | 2] sql create database db CACHEMODEL 'both' COMP 0 DURATION 240 WAL_FSYNC_PERIOD 1000 MAXROWS 8000 MINROWS 10 KEEP 1000 PRECISION 'ns' REPLICA 3 WAL_LEVEL 2 VGROUPS 6 SINGLE_STABLE 1 sql select * from information_schema.ins_databases print rows: $rows print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19 print ====> dataX_db print $data(db)[0] $data(db)[1] $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db if $rows != 3 then return -1 endi if $data0_db != db then # name return -1 endi if $data2_db != 6 then # vgroups return -1 endi if $data3_db != 0 then # ntables return -1 endi if $data4_db != 3 then # replica return -1 endi if $data5_db != off then # strict return -1 endi if $data6_db != 345600m then # duration return -1 endi if $data7_db != 1440000m,1440000m,1440000m then # keep return -1 endi if $data8_db != 96 then # buffer return -1 endi if $data9_db != 4 then # pagesize return -1 endi if $data10_db != 256 then # pages return -1 endi if $data11_db != 10 then # minrows return -1 endi if $data12_db != 8000 then # maxrows return -1 endi if $data13_db != 0 then # comp return -1 endi if $data14_db != ns then # precision return -1 endi if $data18_db != both then # cachemodel return -1 endi if $data19_db != 1 then # cash_size return -1 endi if $data20_db != 2 then # wal_level level return -1 endi if $data21_db != 1000 then # wal_level fsyncperiod return -1 endi if $data22_db != 172800 then # wal_retention_period return -1 endi if $data23_db != -1 then # wal_retention_size return -1 endi if $data24_db != 86400 then # wal_roll_period return -1 endi if $data25_db != 0 then # wal_segment_size return -1 endi #sql show db.vgroups #if $data[0][4] == leader then # if $data[0][6] != follower then # return -1 # endi # if $data[0][8] != follower then # return -1 # endi #endi #if $data[0][6] == leader then # if $data[0][4] != follower then # return -1 # endi # if $data[0][8] != follower then # return -1 # endi #endi #if $data[0][8] == leader then # if $data[0][4] != follower then # return -1 # endi # if $data[0][6] != follower then # return -1 # endi #endi # #if $data[0][4] != leader then # if $data[0][4] != follower then # return -1 # endi #endi #if $data[0][6] != leader then # if $data[0][6] != follower then # return -1 # endi #endi #if $data[0][8] != leader then # if $data[0][8] != follower then # return -1 # endi #endi print ============== not support modify options: name, create_time, vgroups, ntables sql_error alter database db name dba sql_error alter database db create_time "2022-03-03 15:08:13.329" sql_error alter database db vgroups -1 sql_error alter database db vgroups 0 sql_error alter database db vgroups 2 sql_error alter database db vgroups 20 sql_error alter database db ntables -1 sql_error alter database db ntables 0 sql_error alter database db ntables 1 sql_error alter database db ntables 10 #print ============== modify replica # TD-14409 sql_error alter database db replica 2 sql_error alter database db replica 5 sql_error alter database db replica -1 sql_error alter database db replica 0 #sql alter database db replica 1 #sql select * from information_schema.ins_databases #print replica: $data4_db #if $data4_db != 1 then # return -1 #endi #sql alter database db replica 3 #sql select * from information_schema.ins_databases #print replica: $data4_db #if $data4_db != 3 then # return -1 #endi #print ============== modify quorum #sql alter database db quorum 2 #sql select * from information_schema.ins_databases #print quorum $data5_db #if $data5_db != 2 then # return -1 #endi #sql alter database db quorum 1 #sql select * from information_schema.ins_databases #print quorum $data5_db #if $data5_db != 1 then # return -1 #endi #sql_error alter database db quorum -1 #sql_error alter database db quorum 0 #sql_error alter database db quorum 3 #sql_error alter database db quorum 4 #sql_error alter database db quorum 5 #print ============== modify duration sql_error alter database db duration 480 sql_error alter database db duration 360 sql_error alter database db duration 0 sql_error alter database db duration 14400 # set over than keep print ============== modify keep sql alter database db keep 2400 sql select * from information_schema.ins_databases print keep $data7_db if $data7_db != 3456000m,3456000m,3456000m then return -1 endi #sql alter database db keep 1000,2000 #sql select * from information_schema.ins_databases #print keep $data7_db #if $data7_db != 500,500,500 then # return -1 #endi #sql alter database db keep 40,50 #sql alter database db keep 30,31 #sql alter database db keep 20 #sql_error alter database db keep 10.0 #sql_error alter database db keep 9 #sql_error alter database db keep 1 sql_error alter database db keep 0 sql_error alter database db keep -1 #sql_error alter database db keep 365001 #print ============== modify cache #sql_error alter database db cache 12 #sql_error alter database db cache 1 #sql_error alter database db cache 60 #sql_error alter database db cache 50 #sql_error alter database db cache 20 #sql_error alter database db cache 3 #sql_error alter database db cache 129 #sql_error alter database db cache 300 #sql_error alter database db cache 0 #sql_error alter database db cache -1 #print ============== modify blocks #sql alter database db blocks 3 #sql select * from information_schema.ins_databases #print blocks $data9_db #if $data9_db != 3 then # return -1 #endi #sql alter database db blocks 11 #sql select * from information_schema.ins_databases #print blocks $data9_db #if $data9_db != 11 then # return -1 #endi #sql alter database db blocks 40 #sql alter database db blocks 30 #sql alter database db blocks 20 #sql alter database db blocks 10 #sql_error alter database db blocks 2 #sql_error alter database db blocks 1 #sql_error alter database db blocks 0 #sql_error alter database db blocks -1 #sql_error alter database db blocks 10001 print ============== modify minrows sql_error alter database db minrows 8 sql_error alter database db minrows 200 sql_error alter database db minrows 11 sql_error alter database db minrows 8000 sql_error alter database db minrows 8001 print ============== modify maxrows sql_error alter database db maxrows 1000 sql_error alter database db maxrows 2000 sql_error alter database db maxrows 11 # equal minrows sql_error alter database db maxrows 10 # little than minrows print ============== step wal_level sql alter database db wal_level 1 sql select * from information_schema.ins_databases print wal_level $data20_db if $data20_db != 1 then return -1 endi sql alter database db wal_level 2 sql select * from information_schema.ins_databases print wal_level $data20_db if $data20_db != 2 then return -1 endi sql_error alter database db wal_level 0 # TD-14436 sql_error alter database db wal_level 3 sql_error alter database db wal_level 100 sql_error alter database db wal_level -1 print ============== modify wal_fsync_period sql alter database db wal_fsync_period 2000 sql select * from information_schema.ins_databases print wal_fsync_period $data21_db if $data21_db != 2000 then return -1 endi sql alter database db wal_fsync_period 500 sql select * from information_schema.ins_databases print wal_fsync_period $data21_db if $data21_db != 500 then return -1 endi sql alter database db wal_fsync_period 0 sql select * from information_schema.ins_databases print wal_fsync_period $data21_db if $data21_db != 0 then return -1 endi sql_error alter database db wal_fsync_period 180001 sql_error alter database db wal_fsync_period -1 print ============== modify comp sql_error alter database db comp 1 sql_error alter database db comp 2 sql_error alter database db comp 1 sql_error alter database db comp 0 sql_error alter database db comp 3 sql_error alter database db comp 4 sql_error alter database db comp 5 sql_error alter database db comp -1 print ============== modify cachelast [0, 1, 2, 3] sql alter database db cachemodel 'last_value' sql select * from information_schema.ins_databases print cachelast $data18_db if $data18_db != last_value then return -1 endi sql alter database db cachemodel 'last_row' sql select * from information_schema.ins_databases print cachelast $data18_db if $data18_db != last_row then return -1 endi sql alter database db cachemodel 'none' sql select * from information_schema.ins_databases print cachelast $data18_db if $data18_db != none then return -1 endi sql alter database db cachemodel 'last_value' sql select * from information_schema.ins_databases print cachelast $data18_db if $data18_db != last_value then return -1 endi sql alter database db cachemodel 'both' sql select * from information_schema.ins_databases print cachelast $data18_db if $data18_db != both then return -1 endi sql_error alter database db cachelast 4 sql_error alter database db cachelast 10 sql_error alter database db cachelast 'other' print ============== modify precision sql_error alter database db precision 'ms' sql_error alter database db precision 'us' sql_error alter database db precision 'ns' sql_error alter database db precision 'ys' sql_error alter database db prec 'xs' system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode3 -s stop -x SIGINT