Skip to content

Commit 4957bb4

Browse files
authored
fix: flay test 03_0004_auto_vacuum.test (#18038)
- Tweak test case settings Since vacuum2 is active by default now, in the test case that expects all historical data that no longer referenced by the lasted snapshot to be vacuumed, data_retention_time_in_days should be set to zero. - Change handler constraint from 'mysql' to 'http' By now, CI only guarantees that all EE suites could be tested using http handler, the 'mysql' handler may only be applied to some of the EE tests. - Cleanup test stage before each test case to ensure clean state
1 parent 6cfa8ad commit 4957bb4

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

tests/sqllogictests/suites/ee/03_ee_vacuum/03_0004_auto_vacuum.test

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ set enable_auto_vacuum = 1;
3030
statement ok
3131
create or replace table t (c int) 'fs:///tmp/auto_vacuum/';
3232

33+
statement ok
34+
create or replace stage stage_av url = 'fs:///tmp/auto_vacuum/';
35+
36+
statement ok
37+
remove @stage_av/ pattern = '.*';
38+
3339
# prepare data
3440
statement ok
3541
insert into t values(1);
@@ -40,8 +46,6 @@ insert into t values(2);
4046
statement ok
4147
insert into t values(3);
4248

43-
statement ok
44-
create or replace stage stage_av url = 'fs:///tmp/auto_vacuum/';
4549

4650
# expect there are 3 segments/blocks/snapshots
4751
onlyif http
@@ -113,10 +117,14 @@ statement ok
113117
create or replace table t (c int) 'fs:///tmp/auto_vacuum_case2/';
114118

115119
statement ok
116-
alter table t set options(data_retention_period_in_hours = 0);
120+
create or replace stage stage_av url = 'fs:///tmp/auto_vacuum_case2/';
117121

118122
statement ok
119-
create or replace stage stage_av url = 'fs:///tmp/auto_vacuum_case2/';
123+
remove @stage_av/ pattern = '.*';
124+
125+
statement ok
126+
alter table t set options(data_retention_period_in_hours = 0);
127+
120128

121129
statement ok
122130
insert into t values(1);
@@ -150,13 +158,23 @@ select count() from list_stage(location=> '@stage_av') where name like '%_ss%';
150158
# Test autovacuum policy `ByNumSnapshotsToKeep` #
151159
#################################################
152160

161+
# Setting retention period to zero enables aggressive but safe vacuuming:
162+
# All historical data not referenced by the latest snapshot will be removed.
163+
# Note: With zero retention, concurrent transaction conflicts cannot be resolved.
164+
# Only the first committed transaction succeeds; all others will be aborted.
165+
statement ok
166+
set data_retention_time_in_days = 0;
167+
153168
# CASE 1: Create table with data_retention_num_snapshots_to_keep table option
154169
statement ok
155170
create or replace table t (c int) 'fs:///tmp/auto_vacuum_case3/' data_retention_num_snapshots_to_keep = 3;
156171

157172
statement ok
158173
create or replace stage stage_av url = 'fs:///tmp/auto_vacuum_case3/';
159174

175+
statement ok
176+
remove @stage_av/ pattern = '.*';
177+
160178
statement ok
161179
set enable_auto_vacuum = 1;
162180

@@ -174,7 +192,7 @@ insert into t values(4);
174192

175193

176194
# Insert 4 time, but only 3 snapshots will be kept
177-
onlyif mysql
195+
onlyif http
178196
query I
179197
select count() from list_stage(location=> '@stage_av') where name like '%_ss%';
180198
----
@@ -190,19 +208,19 @@ insert into t values(5);
190208
statement ok
191209
optimize table t compact;
192210

193-
onlyif mysql
211+
onlyif http
194212
query I
195213
select count() from list_stage(location=> '@stage_av') where name like '%_sg%';
196214
----
197215
1
198216

199-
onlyif mysql
217+
onlyif http
200218
query I
201219
select count() from list_stage(location=> '@stage_av') where name like '%\/_b\/%';
202220
----
203221
1
204222

205-
onlyif mysql
223+
onlyif http
206224
query I
207225
select count() from list_stage(location=> '@stage_av') where name like '%_ss%';
208226
----
@@ -229,4 +247,3 @@ remove @stage_av;
229247

230248
statement ok
231249
drop stage stage_av;
232-

0 commit comments

Comments
 (0)