From 56e09db1e62719bc2e3e337ec557e877b025d154 Mon Sep 17 00:00:00 2001 From: Slach Date: Thu, 27 Jun 2024 18:43:04 +0400 Subject: [PATCH] add test to reproduce and pass https://github.com/Altinity/clickhouse-backup/issues/938, fix https://github.com/Altinity/clickhouse-backup/issues/938 --- pkg/common/utils.go | 8 ++++++-- test/integration/install_delve.sh | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pkg/common/utils.go b/pkg/common/utils.go index 18de0b48..f126e0d4 100644 --- a/pkg/common/utils.go +++ b/pkg/common/utils.go @@ -6,8 +6,12 @@ import ( ) func TablePathEncode(str string) string { - return strings.NewReplacer(".", "%2E", "-", "%2D").Replace(url.PathEscape(str)) - + return strings.NewReplacer( + "!", "%21", "@", "%40", "#", "%23", "$", "%24", "^", "%5E", "&", "%26", "*", "%2A", + "(", "%28", ")", "%29", "+", "%2B", "-", "%2D", "=", "%3D", "[", "%5B", "]", "%5D", + "{", "%7B", "}", "%7D", "|", "%7C", ";", "%3B", "'", "%27", ":", "%3A", "\"", "%22", + ",", "%2C", ".", "%2E", "/", "%2F", "<", "%3C", ">", "%3E", "?", "%3F", "~", "%7E", + ).Replace(url.PathEscape(str)) } func SumMapValuesInt(m map[string]int) int { diff --git a/test/integration/install_delve.sh b/test/integration/install_delve.sh index 533559f5..e91037a4 100755 --- a/test/integration/install_delve.sh +++ b/test/integration/install_delve.sh @@ -33,7 +33,9 @@ CGO_ENABLED=0 GO111MODULE=on go install -ldflags "-s -w -extldflags '-static'" g # run integration_test.go under debug, run from host OS not inside docker # go test -timeout 30m -failfast -tags=integration -run "TestIntegrationEmbedded" -v ./test/integration/integration_test.go -c -o ./test/integration/integration_test # sudo -H bash -c 'export CLICKHOUSE_IMAGE=clickhouse/clickhouse-server; export COMPOSE_FILE=docker-compose_advanced.yml; export CLICKHOUSE_VERSION=head; cd ./test/integration/; /root/go/bin/dlv --listen=127.0.0.1:40002 --headless=true --api-version=2 --accept-multiclient exec ./integration_test -- -test.timeout 30m -test.failfast -test.run "TestIntegrationEmbedded"' -/root/go/bin/dlv --listen=:40001 --headless=true --api-version=2 --accept-multiclient exec /bin/clickhouse-backup -- -c /etc/clickhouse-backup/config-s3.yml download --partitions="test_partitions_TestIntegrationS3.t?:(0,'2022-01-02'),(0,'2022-01-03')" full_backup_5643339940028285692 +# /root/go/bin/dlv --listen=:40001 --headless=true --api-version=2 --accept-multiclient exec /bin/clickhouse-backup -- -c /etc/clickhouse-backup/config-s3.yml download --partitions="test_partitions_TestIntegrationS3.t?:(0,'2022-01-02'),(0,'2022-01-03')" full_backup_5643339940028285692 +# EMBEDDED_S3_COMPRESSION_FORMAT=zstd CLICKHOUSE_BACKUP_CONFIG=/etc/clickhouse-backup/config-s3-embedded.yml /root/go/bin/dlv --listen=:40001 --headless=true --api-version=2 --accept-multiclient exec /bin/clickhouse-backup -- upload TestIntegrationEmbedded_full_5990789107828261693 +