-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix flaky TestS3WrongRegionPicked.testS3WrongRegionSelection #14615
Fix flaky TestS3WrongRegionPicked.testS3WrongRegionSelection #14615
Conversation
1130b13
to
6d09324
Compare
6d09324
to
35715d8
Compare
@@ -27,12 +27,14 @@ | |||
public void testS3WrongRegionSelection() | |||
throws Exception | |||
{ | |||
try (HiveMinioDataLake dataLake = new HiveMinioDataLake("test-bucket").start(); | |||
String bucketName = "test-bucket" + randomTableSuffix(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a comment on why we need this random bucket name ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MinioClient
has something which is called createdBuckets
which is static. Event if we start new Minio container, this will fail to create bucket with same name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But in the new minio container, the bucket doesn't exist right ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In MinioClient
class from package io.trino.testing.minio
we have a set of created buckets (which is persistent and independent of minio container and its buckets). Maybe we should clean this set on close?
Edit: If we do this test in loop, same name error will be a thing that will come up as first. I don't know if this is a reason for being flaky.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This MinioClient
class is strictly for testing purposes, so forcing a unique bucket naming seems like a good idea. If I had thought about it in the first place, there would be no bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would look up on BackgroundHiveSplitLoader
if it behaves correctly when stopped and loadSplits
is ongoing.
QueryRunner queryRunner = S3HiveQueryRunner.builder(dataLake) | ||
.setHiveProperties(ImmutableMap.of("hive.s3.region", "eu-central-1")) // Different than the default one | ||
.build()) { | ||
String tableName = "s3_region_test_" + randomTableSuffix(); | ||
queryRunner.execute("CREATE TABLE default." + tableName + " (a int) WITH (external_location = 's3://test-bucket/" + tableName + "')"); | ||
queryRunner.execute("CREATE TABLE default." + tableName + " (a int) WITH (external_location = 's3://" + bucketName + "/" + tableName + "')"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Can we useString.format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually prefer concatenation for trivial cases.
35715d8
to
3cd6340
Compare
Description
The trino-hive testsing suite has been run 5x on github actions and it passes, so it will hopefully work.
Non-technical explanation
Fixes #14568
Release notes
(x) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text: