schedSnode.sim 4.9 KB
Newer Older
L
Liu Jicong 已提交
1 2 3 4 5 6 7 8
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2

system sh/exec.sh -n dnode1 -s start 
sleep 50
sql connect

L
Liu Jicong 已提交
9 10
sleep 50

L
Liu Jicong 已提交
11

L
Liu Jicong 已提交
12
sql create database test  vgroups 2;
L
Liu Jicong 已提交
13
sql create database target vgroups 1;
L
Liu Jicong 已提交
14 15 16

sql create snode on dnode 1

L
Liu Jicong 已提交
17 18 19 20 21 22
sql use test;
sql create stable st(ts timestamp, a int, b int , c int, d double) tags(ta int,tb int,tc int);
sql create table ts1 using st tags(1,1,1);
sql create table ts2 using st tags(2,2,2);
sql create table ts3 using st tags(3,2,2);
sql create table ts4 using st tags(4,2,2);
5
54liuyao 已提交
23
sql create stream stream_t1 trigger at_once IGNORE EXPIRED 0 into target.streamtST1 as select  _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b)  c4, min(c) c5 from st interval(10s);
L
Liu Jicong 已提交
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66

sleep 1000

sql insert into ts1 values(1648791213001,1,12,3,1.0);
sql insert into ts2 values(1648791213001,1,12,3,1.0);

sql insert into ts3 values(1648791213001,1,12,3,1.0);
sql insert into ts4 values(1648791213001,1,12,3,1.0);

sql insert into ts1 values(1648791213002,NULL,NULL,NULL,NULL);
sql insert into ts2 values(1648791213002,NULL,NULL,NULL,NULL);

sql insert into ts3 values(1648791213002,NULL,NULL,NULL,NULL);
sql insert into ts4 values(1648791213002,NULL,NULL,NULL,NULL);

sql insert into ts1 values(1648791223002,2,2,3,1.1);
sql insert into ts1 values(1648791233003,3,2,3,2.1);
sql insert into ts2 values(1648791243004,4,2,43,73.1);
sql insert into ts1 values(1648791213002,24,22,23,4.1);
sql insert into ts1 values(1648791243005,4,20,3,3.1);
sql insert into ts2 values(1648791243006,4,2,3,3.1) (1648791243007,4,2,3,3.1) ;
sql insert into ts1 values(1648791243008,4,2,30,3.1) (1648791243009,4,2,3,3.1)  (1648791243010,4,2,3,3.1)  ;
sql insert into ts2 values(1648791243011,4,2,3,3.1) (1648791243012,34,32,33,3.1)  (1648791243013,4,2,3,3.1) (1648791243014,4,2,13,3.1);
sql insert into ts1 values(1648791243005,4,42,3,3.1) (1648791243003,4,2,33,3.1) (1648791243006,4,2,3,3.1) (1648791213001,1,52,13,1.0) (1648791223001,22,22,83,1.1) ;
sql insert into ts2 values(1648791243005,4,42,3,3.1) (1648791243003,4,2,33,3.1) (1648791243006,4,2,3,3.1) (1648791213001,1,52,13,1.0) (1648791223001,22,22,83,1.1) (1648791233004,13,12,13,2.1) ;
sql insert into ts1 values(1648791243006,4,2,3,3.1) (1648791213001,1,52,13,1.0)  (1648791223001,22,22,83,1.1) ;

sql insert into ts3 values(1648791223002,2,2,3,1.1);
sql insert into ts4 values(1648791233003,3,2,3,2.1);
sql insert into ts3 values(1648791243004,4,2,43,73.1);
sql insert into ts4 values(1648791213002,24,22,23,4.1);
sql insert into ts3 values(1648791243005,4,20,3,3.1);
sql insert into ts4 values(1648791243006,4,2,3,3.1) (1648791243007,4,2,3,3.1) ;
sql insert into ts3 values(1648791243008,4,2,30,3.1) (1648791243009,4,2,3,3.1)  (1648791243010,4,2,3,3.1)  ;
sql insert into ts4 values(1648791243011,4,2,3,3.1) (1648791243012,34,32,33,3.1)  (1648791243013,4,2,3,3.1) (1648791243014,4,2,13,3.1);
sql insert into ts3 values(1648791243005,4,42,3,3.1) (1648791243003,4,2,33,3.1) (1648791243006,4,2,3,3.1) (1648791213001,1,52,13,1.0) (1648791223001,22,22,83,1.1) ;
sql insert into ts4 values(1648791243005,4,42,3,3.1) (1648791243003,4,2,33,3.1) (1648791243006,4,2,3,3.1) (1648791213001,1,52,13,1.0) (1648791223001,22,22,83,1.1) (1648791233004,13,12,13,2.1) ;
sql insert into ts3 values(1648791243006,4,2,3,3.1) (1648791213001,1,52,13,1.0)  (1648791223001,22,22,83,1.1) ;

$loop_count = 0
loop1:
sql select * from target.streamtST1;

5
54liuyao 已提交
67
sleep 1000
L
Liu Jicong 已提交
68 69 70 71 72 73 74 75 76 77 78
$loop_count = $loop_count + 1
if $loop_count == 10 then
  return -1
endi

# row 0
if $data01 != 8 then
  print =====data01=$data01
  goto loop1
endi

L
Liu Jicong 已提交
79
if $data02 != 6 then
L
Liu Jicong 已提交
80 81 82 83
  print =====data02=$data02
  goto loop1
endi

L
Liu Jicong 已提交
84 85
if $data03 != 52 then
  print ======data03=$data03
5
54liuyao 已提交
86
  goto loop1
L
Liu Jicong 已提交
87 88 89
endi

if $data04 != 52 then
L
Liu Jicong 已提交
90
  print ======data04=$data04
5
54liuyao 已提交
91
  goto loop1
L
Liu Jicong 已提交
92 93 94
endi

if $data05 != 13 then
L
Liu Jicong 已提交
95
  print ======data05=$data05
5
54liuyao 已提交
96
  goto loop1
L
Liu Jicong 已提交
97 98 99 100 101 102 103 104 105 106 107 108 109 110
endi

# row 1
if $data11 != 6 then
  print =====data11=$data11
  goto loop1
endi

if $data12 != 6 then
  print =====data12=$data12
  goto loop1
endi

if $data13 != 92 then
L
Liu Jicong 已提交
111
  print ======data13=$data13
L
Liu Jicong 已提交
112 113 114 115
  return -1
endi

if $data14 != 22 then
L
Liu Jicong 已提交
116
  print ======data14=$data14
L
Liu Jicong 已提交
117 118 119 120
  return -1
endi

if $data15 != 3 then
L
Liu Jicong 已提交
121
  print ======data15=$data15
L
Liu Jicong 已提交
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
  return -1
endi

# row 2
if $data21 != 4 then
  print =====data21=$data21
  goto loop1
endi

if $data22 != 4 then
  print =====data22=$data22
  goto loop1
endi

if $data23 != 32 then
L
Liu Jicong 已提交
137
  print ======data23=$data23
L
Liu Jicong 已提交
138 139 140 141
  return -1
endi

if $data24 != 12 then
L
Liu Jicong 已提交
142
  print ======data24=$data24
L
Liu Jicong 已提交
143 144 145 146
  return -1
endi

if $data25 != 3 then
L
Liu Jicong 已提交
147
  print ======data25=$data25
L
Liu Jicong 已提交
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
  return -1
endi

# row 3
if $data31 != 30 then
  print =====data31=$data31
  goto loop1
endi

if $data32 != 30 then
  print =====data32=$data32
  goto loop1
endi

if $data33 != 180 then
L
Liu Jicong 已提交
163
  print ======data33=$data33
L
Liu Jicong 已提交
164 165 166 167
  return -1
endi

if $data34 != 42 then
L
Liu Jicong 已提交
168
  print ======data34=$data34
L
Liu Jicong 已提交
169 170 171 172
  return -1
endi

if $data35 != 3 then
L
Liu Jicong 已提交
173
  print ======data35=$data35
L
Liu Jicong 已提交
174 175 176
  return -1
endi

177
sql select  _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b)  c4, min(c) c5, avg(d) from st interval(10s);