提交 fb76d737 编写于 作者: P Ping Xiao

[TD-1557] <test> add test cases for update

上级 45fcefe8
# For step 1, we set all the values as 1
# for step 2, we set all the values as 2
# and so on
# check query result here means not
# clear env set up
# create database db update 1
# create table t (ts timestamp, a int)
# set an init time (such as $t0 = 1604295582000)
# Step 1
insert into t values ($t0, 1);
insert into t values ($t0 - 3, 1);
insert into t values ($t0 + 3, 1);
check query result
# Step 2
insert into t values ($t0, 2);
insert into t values ($t0 - 3, 2);
insert into t values ($t0 + 3, 2);
check query result
# Step 3
insert into t values ($t0 - 4, 3);
insert into t values ($t0 - 2, 3);
insert into t values ($t0 + 2, 3);
insert into t values ($t0 + 4, 3);
check query result
# Step 4
insert into t values ($t0 - 4, 4);
insert into t values ($t0 - 2, 4);
insert into t values ($t0 + 2, 4);
insert into t values ($t0 + 4, 4);
check query result
# Step 4
insert into t values ($t0 - 1, 5);
insert into t values ($t0 + 1, 5);
check query result
# Step 4
insert into t values ($t0 - 4, 6);
insert into t values ($t0 - 3, 6);
insert into t values ($t0 - 2, 6);
insert into t values ($t0 - 1, 6);
insert into t values ($t0, 6);
insert into t values ($t0 + 1, 6);
insert into t values ($t0 + 2, 6);
insert into t values ($t0 + 3, 6);
insert into t values ($t0 + 4, 6);
check query result
# Step 4
restart to commit
check query result
\ No newline at end of file
# clear env set up
create database db update 1
$t0 = 1604298064000
## Step 1
create table t1 (ts timestamp, a int);
for ($i = 0; $i < 200; $i++) {
insert into t1 values ($t0 + $i, 1);
}
restart to commit
check query result
for ($k = 1; $k <= 100; $k++) {
for ($i = 0; $i < 200; $i++) {
insert into t1 values ($t0 + $k * 200 $i, 1);
}
restart to commit
check query result
}
## Step 2
create table t2 (ts timestamp, a int);
for ($i = 0; $i < 20000; $i++) {
insert into t2 values ($t0 + $i, 1);
}
restart to commit
check query result
\ No newline at end of file
# clear env set up
create database db update 1;
## Step 1
$loops = 1000
#t0 = 1604298064000
create table t1 (ts timestamp, a int);
for ($i = 0; $i < $loops; $i++) {
insert into t1 values ($t0 + $i, 1);
restart to commit
check query result
}
## Step 2
create table t2 (ts timestamp, a int);
insert into t2 ($t0, 1);
restart to commit
check query result
for ($i = 1; $i <= 150; $i++) {
insert into t2 values ($t0 + $i, 1);
}
restart to commit
check query result
## Step 3
create table t3 (ts timestamp, a int);
insert into t3 ($t0, 1);
restart to commit
check query result
for ($i = 0; $i < 8; $i++) {
for ($j = 1; $j <= 10; $j++) {
insert into t3 values ($t0 + $i * 10 + $j , 1);
}
}
restart to commit
check query result
\ No newline at end of file
# clear env set up
$t0 = 1603152000000
create database db update 1 days 30;
## Step 1. UPDATE THE WHOLE DATA BLOCK REPEATEDLY
create table t1 (ts timestamp, a int);
for ($i = 0; $i < 200; $i++) {
insert into t1 values ($t0 + $i, 1);
}
restart to commit
check query result
for ($k = 0; $k < 10; $k++) {
for ($i = 0; $i < 200; $i++) {
insert into t1 values ($t0 + $i, 1);
}
check query result
restart to commit
check query result
}
## Step 2. PREPEND DATA
create table t2 (ts timestamp, a int);
for ($i = 0; $i < 200; $i++) {
insert into t2 values ($t0 + $i, 1);
}
restart to commit
check query result
for ($i = -100; $i < 0; $i++) {
insert into t2 values ($t0 + $i, 1);
}
check query result
restart to commit
check query result
## Step 3. PREPEND MASSIVE DATA
create table t3 (ts timestamp, a int);
for ($i = 0; $i < 200; $i++) {
insert into t3 values ($t0 + $i, 1);
}
restart to commit
check query result
for ($i = -6000; $i < 0; $i++) {
insert into t3 values ($t0 + $i, 1);
}
check query result
restart to commit
check query result
## Step 4. APPEND DATA
create table t4 (ts timestamp, a int);
for ($i = 0; $i < 200; $i++) {
insert into t4 values ($t0 + $i, 1);
}
restart to commit
check query result
for ($i = 0; $i < 100; $i++) {
insert into t4 values ($t0 + 200 + $i, 1);
}
check query result
restart to commit
check query result
## Step 5. APPEND MASSIVE DATA
create table t5 (ts timestamp, a int);
for ($i = 0; $i < 200; $i++) {
insert into t5 values ($t0 + $i, 1);
}
restart to commit
check query result
for ($i = 0; $i < 6000; $i++) {
insert into t5 values ($t0 + 200 + $i, 1);
}
check query result
restart to commit
check query result
## Step 6. UPDATE BLOCK IN TWO STEP
create table t6 (ts timestamp, a int);
for ($i = 0; $i < 200; $i++) {
insert into t6 values ($t0 + $i, 1);
}
restart to commit
check query result
for ($i = 0; $i < 100; $i++) {
insert into t6 values ($t0 + $i, 2);
}
check query result
restart to commit
check query result
for ($i = 100; $i < 200; $i++) {
insert into t6 values ($t0 + $i, 2);
}
check query result
restart to commit
check query result
## Step 7. UPDATE LAST HALF AND INSERT LITTLE DATA
create table t7 (ts timestamp, a int);
for ($i = 0; $i < 200; $i++) {
insert into t7 values ($t0 + $i, 1);
}
restart to commit
check query result
for ($i = 100; $i < 300; $i++) {
insert into t7 values ($t0 + $i, 2);
}
check query result
restart to commit
check query result
## Step 8. UPDATE LAST HALF AND INSERT MASSIVE DATA
create table t8 (ts timestamp, a int);
for ($i = 0; $i < 200; $i++) {
insert into t8 values ($t0 + $i, 1);
}
restart to commit
check query result
for ($i = 100; $i < 6000; $i++) {
insert into t8 values ($t0 + $i, 2);
}
check query result
restart to commit
check query result
## Step 9. UPDATE FIRST HALF AND PREPEND LITTLE DATA
create table t9 (ts timestamp, a int);
for ($i = 0; $i < 200; $i++) {
insert into t9 values ($t0 + $i, 1);
}
restart to commit
check query result
for ($i = -100; $i < 100; $i++) {
insert into t9 values ($t0 + $i, 2);
}
check query result
restart to commit
check query result
## Step 10. UPDATE FIRST HALF AND PREPEND MASSIVE DATA
create table t10 (ts timestamp, a int);
for ($i = 0; $i < 200; $i++) {
insert into t10 values ($t0 + $i, 1);
}
restart to commit
check query result
for ($i = -6000; $i < 100; $i++) {
insert into t10 values ($t0 + $i, 2);
}
check query result
restart to commit
check query result
## Step 11. UPDATE FIRST HALF AND APPEND MASSIVE DATA
create table t11 (ts timestamp, a int);
for ($i = 0; $i < 200; $i++) {
insert into t11 values ($t0 + $i, 1);
}
restart to commit
check query result
for ($i = 0; $i < 100; $i++) {
insert into t11 values ($t0 + $i, 2);
}
for ($i = 200; $i < 6000; $i++) {
insert into t11 values ($t0 + $i, 2);
}
check query result
restart to commit
check query result
\ No newline at end of file
# clear env set up
$t0 = 1603152000000
create database db update 1 days 30;
## Step 1. UPDATE TWO WHOLE DATA BLOCK REPEATEDLY
create table t1 (ts timestamp, a int);
for ($i = 0; $i < 200; $i++) {
insert into t1 values ($t0 + $i, 1);
}
restart to commit
check query result
for ($i = 0; $i < 200; $i++) {
insert into t1 values ($t0 + 5000 + $i, 1);
}
check query result
restart to commit
check query result
for ($i = 0; $i < 200; $i++) {
insert into t1 values ($t0 + $i, 2);
}
for ($i = 0; $i < 200; $i++) {
insert into t1 values ($t0 + 5000 + $i, 1);
}
check query result
restart to commit
check query result
## Step 2. INSERT IN MIDDLE LITTLE DATA REPEATEDLY
create table t2 (ts timestamp, a int);
for ($i = 0; $i < 200; $i++) {
insert into t2 values ($t0 + $i, 1);
}
restart to commit
for ($i = 0; $i < 200; $i++) {
insert into t2 values ($t0 + 5000 + $i, 1);
}
restart to commit
for ($k = 0; $k < 10; $k++) {
for ($i = 0; $i < 10; $i++) {
insert into t2 values ($t0 + 200 + $k * 10 + $i, 1);
}
check query result
restart to commit
check query result
}
## Step 3. INSERT IN MIDDLE AND UPDATE TWO BLOCKS
create table t3 (ts timestamp, a int);
for ($i = 0; $i < 200; $i++) {
insert into t3 values ($t0 + $i, 1);
}
restart to commit
for ($i = 0; $i < 200; $i++) {
insert into t3 values ($t0 + 5000 + $i, 1);
}
restart to commit
for ($i = 0; $i < 5200; $i++) {
insert into t3 values ($t0 + $i, 2);
}
check query result
restart to commit
check query result
## Step 4. INSERT IN MIDDLE AND UPDATE FIRST HALF OF TWO BLOCKS
create table t4 (ts timestamp, a int);
for ($i = 0; $i < 200; $i++) {
insert into t4 values ($t0 + $i, 1);
}
restart to commit
for ($i = 0; $i < 200; $i++) {
insert into t4 values ($t0 + 5000 + $i, 1);
}
restart to commit
for ($i = 0; $i < 100; $i++) {
insert into t4 values ($t0 + $i, 2);
}
for ($i = 200; $i < 5000; $i++) {
insert into t4 values ($t0 + $i, 2);
}
for ($i = 0; $i < 100; $i++) {
insert into t4 values ($t0 + 5000 + $i, 2);
}
check query result
restart to commit
check query result
## Step 5. INSERT IN MIDDLE AND UPDATE last HALF OF TWO BLOCKS
create table t5 (ts timestamp, a int);
for ($i = 0; $i < 200; $i++) {
insert into t5 values ($t0 + $i, 1);
}
restart to commit
for ($i = 0; $i < 200; $i++) {
insert into t5 values ($t0 + 5000 + $i, 1);
}
restart to commit
for ($i = 100; $i < 200; $i++) {
insert into t5 values ($t0 + $i, 2);
}
for ($i = 200; $i < 5000; $i++) {
insert into t5 values ($t0 + $i, 2);
}
for ($i = 100; $i < 200; $i++) {
insert into t5 values ($t0 + 5000 + $i, 2);
}
check query result
restart to commit
check query result
## Step 6. INSERT MASSIVE DATA AND UPDATE ALL BLOCKS
create table t6 (ts timestamp, a int);
for ($i = 0; $i < 200; $i++) {
insert into t6 values ($t0 + $i, 1);
}
restart to commit
for ($i = 0; $i < 200; $i++) {
insert into t6 values ($t0 + 5000 + $i, 1);
}
restart to commit
for ($i = -1000; $i < 10000; $i++) {
insert into t6 values ($t0 + $i, 2);
}
check query result
restart to commit
check query result
## Step 7. SPLIT DATA BLOCK
create table t7 (ts timestamp, a int);
for ($i = 0; $i < 200; $i++) {
insert into t7 values ($t0 + $i, 1);
}
for ($i = 0; $i < 200; $i++) {
insert into t7 values ($t0 + 5000 + $i, 1);
}
restart to commit
for ($i = -1000; $i < 10000; $i++) {
insert into t7 values ($t0 + $i, 2);
}
check query result
restart to commit
check query result
\ No newline at end of file
# clear env set up
$t0 = 1603152000000
create database db update 1 days 30;
## STEP 1: UPDATE THE LAST RECORD REPEATEDLY
create table t1 (ts timestamp, a int);
for ($i = 0; $i < 100; $i++) {
insert into t1 values ($t0, $i);
restart to commit
check query result
}
## STEP 2: UPDATE THE WHOLE LAST BLOCK
create table t2 (ts timestamp, a int);
for ($i = 0; $i < 50; $i++) {
insert into t2 values ($t0 + $i, 1);
}
restart to commit
check query result
for ($i = 0; $i < 50; $i++) {
insert into t2 values ($t0 + $i, 2);
}
check query result
restart to commit
check query result
## STEP 3: UPDATE PART OF THE LAST BLOCK
create table t3 (ts timestamp, a int);
for ($i = 0; $i < 50; $i++) {
insert into t3 values ($t0 + $i, 1);
}
restart to commit
check query result
for ($i = 0; $i < 25; $i++) {
insert into t3 values ($t0 + $i, 2);
}
check query result
restart to commit
check query result
for ($i = 25; $i < 50; $i++) {
insert into t3 values ($t0 + $i, 2);
}
check query result
restart to commit
check query result
## STEP 4: UPDATE AND INSERT APPEND AT END OF DATA
create table t4 (ts timestamp, a int);
for ($i = 0; $i < 50; $i++) {
insert into t4 values ($t0 + $i, 1);
}
restart to commit
check query result
for ($i = 0; $i < 25; $i++) {
insert into t4 values ($t0 + $i, 2);
}
for ($i = 50; $i < 60; $i++) {
insert into t4 values ($t0 + $i, 2);
}
check query result
restart to commit
check query result
## STEP 5: UPDATE AND INSERT PREPEND SOME DATA
create table t5 (ts timestamp, a int);
for ($i = 0; $i < 50; $i++) {
insert into t5 values ($t0 + $i, 1);
}
restart to commit
check query result
for ($i = -10; $i < 0; $i++) {
insert into t4 values ($t0 + $i, 2);
}
for ($i = 0; $i < 25; $i++) {
insert into t5 values ($t0 + $i, 2);
}
check query result
restart to commit
check query result
for ($i = -10; $i < 0; $i++) {
insert into t4 values ($t0 + $i, 3);
}
for ($i = 25; $i < 50; $i++) {
insert into t5 values ($t0 + $i, 3);
}
check query result
restart to commit
check query result
## STEP 6: INSERT AHEAD A LOT OF DATA
create table t6 (ts timestamp, a int);
for ($i = 0; $i < 50; $i++) {
insert into t6 values ($t0 + $i, 1);
}
restart to commit
check query result
for ($i = -1000; $i < 0; $i++) {
insert into t6 values ($t0 + $i, 2);
}
check query result
restart to commit
check query result
## STEP 7: INSERT AHEAD A LOT AND UPDATE
create table t7 (ts timestamp, a int);
for ($i = 0; $i < 50; $i++) {
insert into t7 values ($t0 + $i, 1);
}
restart to commit
check query result
for ($i = -1000; $i < 25; $i++) {
insert into t7 values ($t0 + $i, 2);
}
check query result
restart to commit
check query result
## STEP 8: INSERT AHEAD A LOT AND UPDATE
create table t8 (ts timestamp, a int);
for ($i = 0; $i < 50; $i++) {
insert into t8 values ($t0 + $i, 1);
}
restart to commit
check query result
for ($i = 25; $i < 6000; $i++) {
insert into t8 values ($t0 + $i, 2);
}
check query result
restart to commit
check query result
## STEP 9: UPDATE ONLY MIDDLE
create table t9 (ts timestamp, a int);
for ($i = 0; $i < 50; $i++) {
insert into t9 values ($t0 + $i, 1);
}
restart to commit
check query result
for ($i = 20; $i < 30; $i++) {
insert into t9 values ($t0 + $i, 2);
}
check query result
restart to commit
check query result
## STEP 10: A LOT OF DATA COVER THE WHOLE BLOCK
create table t10 (ts timestamp, a int);
for ($i = 0; $i < 50; $i++) {
insert into t10 values ($t0 + $i, 1);
}
restart to commit
check query result
for ($i = -4000; $i < 4000; $i++) {
insert into t10 values ($t0 + $i, 2);
}
check query result
restart to commit
check query result
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册