From ff242d028a4c591bfeec8c4b1d45541133e07731 Mon Sep 17 00:00:00 2001 From: AlexYue Date: Mon, 8 Jul 2024 14:19:04 +0800 Subject: [PATCH] [regression](cloud) Add missing new operator for recycler plugin (#37393) --- regression-test/framework/pom.xml | 6 ++++++ .../regression/util/ObjectListUtil.groovy | 18 +++++++++++------- .../plugins/cloud_recycler_plugin.groovy | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/regression-test/framework/pom.xml b/regression-test/framework/pom.xml index b689757c5efca0..f50e0fa7cfc882 100644 --- a/regression-test/framework/pom.xml +++ b/regression-test/framework/pom.xml @@ -395,5 +395,11 @@ under the License. azure-storage-blob-batch 12.22.0 + + + io.netty + netty-all + 4.1.104.Final + diff --git a/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/ObjectListUtil.groovy b/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/ObjectListUtil.groovy index 814db47f378c72..7af745f12e5438 100644 --- a/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/ObjectListUtil.groovy +++ b/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/ObjectListUtil.groovy @@ -38,10 +38,11 @@ import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.blob.models.ListBlobsOptions; import com.azure.storage.common.StorageSharedKeyCredential; +import java.time.Duration; import java.util.Iterator; interface ListObjectsFileNames { - public boolean isEmpty(String tableName, String tableId); + public boolean isEmpty(String tableName, String tabletId); public Set listObjects(String userName, String userId); }; @@ -68,7 +69,7 @@ class AwsListObjectsFileNames implements ListObjectsFileNames { .withCredentials(new AWSStaticCredentialsProvider(credentials)).build() } - public boolean isEmpty(String tableName, String tableId) { + public boolean isEmpty(String tableName, String tabletId) { def objectListing = s3Client.listObjects( new ListObjectsRequest().withMaxKeys(1).withBucketName(bucket).withPrefix("${prefix}/data/${tabletId}/")) @@ -124,11 +125,14 @@ class AzureListObjectsFileNames implements ListObjectsFileNames { this.bucket = bucket; this.suite = suite; String uri = String.format(URI_TEMPLATE, this.ak, this.bucket); - StorageSharedKeyCredential cred = new StorageSharedKeyCredential(this.ak, this.sk); - this.containerClient = new BlobContainerClientBuilder().credential(cred).endpoint(uri).build(); + StorageSharedKeyCredential cred = new StorageSharedKeyCredential(this.ak, this.sk); + BlobContainerClientBuilder builder = new BlobContainerClientBuilder(); + builder.credential(cred); + builder.endpoint(uri); + this.containerClient = builder.buildClient(); } - public boolean isEmpty(String tableName, String tableId) { + public boolean isEmpty(String tableName, String tabletId) { PagedIterable blobs = containerClient.listBlobs( new ListBlobsOptions() .setPrefix("${prefix}/data/${tabletId}/") @@ -173,8 +177,8 @@ class ListObjectsFileNamesUtil { public static ListObjectsFileNames getListObjectsFileNames(String provider, String ak, String sk, String endpoint, String region, String prefix, String bucket, Suite suite) { if (provider.equalsIgnoreCase("azure")) { - return AzureListObjectsFileNames(ak, sk, endpoint, region, prefix, bucket, suite) + return new AzureListObjectsFileNames(ak, sk, endpoint, region, prefix, bucket, suite) } - return AwsListObjectsFileNames(ak, sk, endpoint, region, prefix, bucket, suite) + return new AwsListObjectsFileNames(ak, sk, endpoint, region, prefix, bucket, suite) } } \ No newline at end of file diff --git a/regression-test/plugins/cloud_recycler_plugin.groovy b/regression-test/plugins/cloud_recycler_plugin.groovy index 0282722d040bee..ed330e94935503 100644 --- a/regression-test/plugins/cloud_recycler_plugin.groovy +++ b/regression-test/plugins/cloud_recycler_plugin.groovy @@ -79,7 +79,7 @@ Suite.metaClass.checkRecycleTable = { String token, String instanceId, String cl // def objectListing = s3Client.listObjects( // new ListObjectsRequest().withMaxKeys(1).withBucketName(bucket).withPrefix("${prefix}/data/${tabletId}/")) - suite.getLogger().info("tableName: ${tableName}, tabletId:${tabletId}, objectListing:${objectListing.getObjectSummaries()}".toString()) + // suite.getLogger().info("tableName: ${tableName}, tabletId:${tabletId}, objectListing:${objectListing.getObjectSummaries()}".toString()) if (!client.isEmpty(tableName, tabletId)) { return false; }