Skip to content
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

Merged

Conversation

skrzypo987
Copy link
Member

@skrzypo987 skrzypo987 commented Oct 13, 2022

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:

# Section
* Fix some things. ({issue}`issuenumber`)

@cla-bot cla-bot bot added the cla-signed label Oct 13, 2022
@skrzypo987 skrzypo987 force-pushed the skrzypo/126-fix-flaky-s3-test branch from 1130b13 to 6d09324 Compare October 13, 2022 08:52
@skrzypo987 skrzypo987 force-pushed the skrzypo/126-fix-flaky-s3-test branch from 6d09324 to 35715d8 Compare October 13, 2022 09:46
@skrzypo987 skrzypo987 marked this pull request as ready for review October 13, 2022 09:46
@Praveen2112 Praveen2112 changed the title Ffix flaky s3 test Fix flaky TestS3WrongRegionPicked.testS3WrongRegionSelection Oct 13, 2022
@@ -27,12 +27,14 @@
public void testS3WrongRegionSelection()
throws Exception
{
try (HiveMinioDataLake dataLake = new HiveMinioDataLake("test-bucket").start();
String bucketName = "test-bucket" + randomTableSuffix();
Copy link
Member

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 ?

Copy link
Member

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.

Copy link
Member

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 ?

Copy link
Member

@Dith3r Dith3r Oct 13, 2022

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.

Copy link
Member Author

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.

Copy link
Member

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 + "')");
Copy link
Member

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

Copy link
Member Author

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.

@skrzypo987 skrzypo987 force-pushed the skrzypo/126-fix-flaky-s3-test branch from 35715d8 to 3cd6340 Compare October 13, 2022 13:19
@Praveen2112 Praveen2112 merged commit db558a3 into trinodb:master Oct 14, 2022
@github-actions github-actions bot added this to the 401 milestone Oct 14, 2022
@ebyhr ebyhr mentioned this pull request Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Fix TestS3WrongRegionPicked.testS3WrongRegionSelection failure
3 participants