Skip to content

Commit

Permalink
[fix](regression-test) fix failed in regression-test: doc/table-desig…
Browse files Browse the repository at this point in the history
…n/tiered-storage/remote-storage.md (apache#46733)
  • Loading branch information
yagagagaga authored Jan 13, 2025
1 parent a64be25 commit 84d77a6
Showing 1 changed file with 20 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,27 @@ import org.junit.jupiter.api.Assertions;

suite("docs/table-design/tiered-storage/remote-storage.md") {

String suffix = UUID.randomUUID().toString().substring(0, 5)

def clean = {
multi_sql """
DROP TABLE IF EXISTS create_table_use_created_policy;
DROP TABLE IF EXISTS create_table_not_have_policy;
DROP TABLE IF EXISTS create_table_partition;
DROP STORAGE POLICY IF EXISTS test_policy;
DROP RESOURCE IF EXISTS 'remote_hdfs';
DROP RESOURCE IF EXISTS 'remote_s3';
DROP STORAGE POLICY IF EXISTS test_policy_${suffix};
DROP RESOURCE IF EXISTS 'remote_hdfs_${suffix}';
DROP RESOURCE IF EXISTS 'remote_s3_${suffix}';
"""
}

try {
clean()
multi_sql """
DROP TABLE IF EXISTS create_table_use_created_policy;
DROP STORAGE POLICY IF EXISTS test_policy;
DROP RESOURCE IF EXISTS 'remote_s3';
DROP STORAGE POLICY IF EXISTS test_policy_${suffix};
DROP RESOURCE IF EXISTS 'remote_s3_${suffix}';
CREATE RESOURCE "remote_s3"
CREATE RESOURCE "remote_s3_${suffix}"
PROPERTIES
(
"type" = "s3",
Expand All @@ -51,11 +53,10 @@ suite("docs/table-design/tiered-storage/remote-storage.md") {
"s3.connection.request.timeout" = "3000",
"s3.connection.timeout" = "1000"
);
CREATE STORAGE POLICY test_policy
CREATE STORAGE POLICY test_policy_${suffix}
PROPERTIES(
"storage_resource" = "remote_s3",
"storage_resource" = "remote_s3_${suffix}",
"cooldown_ttl" = "1d"
);
Expand All @@ -68,18 +69,18 @@ suite("docs/table-design/tiered-storage/remote-storage.md") {
UNIQUE KEY(k1)
DISTRIBUTED BY HASH (k1) BUCKETS 3
PROPERTIES(
"storage_policy" = "test_policy",
"storage_policy" = "test_policy_${suffix}",
"enable_unique_key_merge_on_write" = "false",
"replication_num" = "1"
);
"""

multi_sql """
DROP TABLE IF EXISTS create_table_use_created_policy;
DROP STORAGE POLICY IF EXISTS test_policy;
DROP RESOURCE IF EXISTS 'remote_hdfs';
DROP STORAGE POLICY IF EXISTS test_policy_${suffix};
DROP RESOURCE IF EXISTS 'remote_hdfs_${suffix}';
CREATE RESOURCE "remote_hdfs" PROPERTIES (
CREATE RESOURCE "remote_hdfs_${suffix}" PROPERTIES (
"type"="hdfs",
"fs.defaultFS"="127.0.0.1:8120",
"hadoop.username"="hive",
Expand All @@ -91,8 +92,8 @@ suite("docs/table-design/tiered-storage/remote-storage.md") {
"dfs.client.failover.proxy.provider.my_ha" = "org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider"
);
CREATE STORAGE POLICY test_policy PROPERTIES (
"storage_resource" = "remote_hdfs",
CREATE STORAGE POLICY test_policy_${suffix} PROPERTIES (
"storage_resource" = "remote_hdfs_${suffix}",
"cooldown_ttl" = "300"
);
Expand All @@ -104,7 +105,7 @@ suite("docs/table-design/tiered-storage/remote-storage.md") {
UNIQUE KEY(k1)
DISTRIBUTED BY HASH (k1) BUCKETS 3
PROPERTIES(
"storage_policy" = "test_policy",
"storage_policy" = "test_policy_${suffix}",
"enable_unique_key_merge_on_write" = "false",
"replication_num" = "1"
);
Expand All @@ -131,7 +132,7 @@ suite("docs/table-design/tiered-storage/remote-storage.md") {
);
"""
if (!isCloudMode()) {
sql """ALTER TABLE create_table_not_have_policy set ("storage_policy" = "test_policy");"""
sql """ALTER TABLE create_table_not_have_policy set ("storage_policy" = "test_policy_${suffix}");"""
}
multi_sql """
DROP TABLE IF EXISTS create_table_partition;
Expand All @@ -154,7 +155,7 @@ suite("docs/table-design/tiered-storage/remote-storage.md") {
);
"""
if (!isCloudMode()) {
sql """ALTER TABLE create_table_partition MODIFY PARTITION (*) SET("storage_policy"="test_policy");"""
sql """ALTER TABLE create_table_partition MODIFY PARTITION (*) SET("storage_policy"="test_policy_${suffix}");"""
}
} catch (Throwable t) {
Assertions.fail("examples in docs/table-design/tiered-storage/remote-storage.md failed to exec, please fix it", t)
Expand Down

0 comments on commit 84d77a6

Please sign in to comment.