Skip to content

Commit c8d0d88

Browse files
committed
fix CI/CD failures for TestHardlinksExistsFiles
1 parent 638548c commit c8d0d88

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

test/integration/configs/dynamic_settings.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ cat <<EOT > /etc/clickhouse-server/config.d/storage_configuration.xml
4545
<disk>hdd2</disk>
4646
</cold_volume>
4747
</volumes>
48+
<!-- disable free-space-based background moves: on CI the runner disk is >90% full,
49+
so the default move_factor=0.1 moves parts off the hot volume right after INSERT
50+
and makes explicit MOVE PART targets in tests non-deterministic -->
51+
<move_factor>0</move_factor>
4852
</hot_and_cold>
4953
</policies>
5054
</storage_configuration>

test/integration/hardlinksExistsFiles_test.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,20 @@ func TestHardlinksExistsFiles(t *testing.T) {
102102
Name string `ch:"name"`
103103
Disk string `ch:"disk_name"`
104104
}
105-
r.NoError(env.ch.Select(&partDisks, "SELECT name, disk_name FROM system.parts WHERE database=? AND `table`=? AND active", dbNameFull, tableName))
105+
r.NoError(env.ch.Select(&partDisks, "SELECT name, disk_name FROM system.parts WHERE database=? AND `table`=? AND active ORDER BY name", dbNameFull, tableName))
106106
t.Logf("TestHardlinksExistsFiles [%s] part disks before explicit MOVE: %+v", compression, partDisks)
107107

108-
env.queryWithNoError(t, r, "ALTER TABLE "+dbNameFull+"."+tableName+" MOVE PART 'all_1_1_0' TO DISK 'hdd2'")
109-
env.queryWithNoError(t, r, "ALTER TABLE "+dbNameFull+"."+tableName+" MOVE PART 'all_2_2_0' TO DISK 'hdd1'")
108+
// alternate targets between hdd2/hdd1, skipping the disk the part is
109+
// already on: the background MergeTreePartsMover may have moved parts
110+
// off the hot volume, and MOVE PART to the current disk fails with code 479
111+
targets := []string{"hdd2", "hdd1"}
112+
for i, p := range partDisks {
113+
target := targets[i%2]
114+
if p.Disk == target {
115+
target = targets[(i+1)%2]
116+
}
117+
env.queryWithNoError(t, r, "ALTER TABLE "+dbNameFull+"."+tableName+" MOVE PART '"+p.Name+"' TO DISK '"+target+"'")
118+
}
110119
}
111120

112121
// Delete local backups

0 commit comments

Comments
 (0)