Skip to content

Commit

Permalink
Test concurrent metadata access
Browse files Browse the repository at this point in the history
E.g. `SHOW TABLES` must not fail when tables, views or materialized
views are concurrently created or dropped.
  • Loading branch information
findepi committed Mar 4, 2022
1 parent e12a9b1 commit f712fe7
Show file tree
Hide file tree
Showing 9 changed files with 303 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,14 @@ protected void checkInformationSchemaViewsForMaterializedView(String schemaName,
.hasMessageFindingMatch("(?s)Expecting.*to contain:.*\\Q[(" + viewName + ")]");
}

@Test(enabled = false) // TODO fails
@Override
public void testReadMetadataWithRelationsConcurrentModifications()
throws Exception
{
super.testReadMetadataWithRelationsConcurrentModifications();
}

@Test
public void testDecimal()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,13 @@ public void testWrittenStats()
throw new SkipException("TODO");
}

@Override
public void testReadMetadataWithRelationsConcurrentModifications()
{
// TODO Support these test once kudu connector can create tables with default partitions
throw new SkipException("TODO");
}

@Test
@Override
public void testCreateTableAsSelectNegativeDate()
Expand Down
6 changes: 6 additions & 0 deletions plugin/trino-phoenix/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@
</exclusions>
</dependency>

<dependency>
<groupId>io.trino</groupId>
<artifactId>trino-testing-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.trino</groupId>
<artifactId>trino-tpch</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import io.trino.testing.TestingConnectorBehavior;
import io.trino.testing.sql.SqlExecutor;
import io.trino.testing.sql.TestTable;
import io.trino.testng.services.Flaky;
import org.testng.SkipException;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
Expand Down Expand Up @@ -220,6 +221,30 @@ public void testShowCreateTable()
")");
}

// TODO (https://github.com/trinodb/trino/issues/10904): Test is flaky because tests execute in parallel
@Flaky(issue = "https://github.com/trinodb/trino/issues/10904", match = "\\QERROR 1012 (42M03): Table undefined. tableName=")
@Test
@Override
public void testSelectInformationSchemaColumns()
{
super.testSelectInformationSchemaColumns();
}

@Override
public void testReadMetadataWithRelationsConcurrentModifications()
{
try {
super.testReadMetadataWithRelationsConcurrentModifications();
}
catch (Exception expected) {
// The test failure is not guaranteed
// TODO (https://github.com/trinodb/trino/issues/10904): shouldn't fail
assertThat(expected)
.hasMessageContaining("ERROR 1012 (42M03): Table undefined. tableName=");
throw new SkipException("to be fixed");
}
}

@Override
public void testCharVarcharComparison()
{
Expand Down
6 changes: 6 additions & 0 deletions plugin/trino-phoenix5/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@
</exclusions>
</dependency>

<dependency>
<groupId>io.trino</groupId>
<artifactId>trino-testing-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.trino</groupId>
<artifactId>trino-tpch</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.trino.testing.TestingConnectorBehavior;
import io.trino.testing.sql.SqlExecutor;
import io.trino.testing.sql.TestTable;
import io.trino.testng.services.Flaky;
import org.testng.SkipException;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
Expand Down Expand Up @@ -238,6 +239,30 @@ public void testShowCreateTable()
")");
}

// TODO (https://github.com/trinodb/trino/issues/10904): Test is flaky because tests execute in parallel
@Flaky(issue = "https://github.com/trinodb/trino/issues/10904", match = "\\QERROR 1012 (42M03): Table undefined. tableName=")
@Test
@Override
public void testSelectInformationSchemaColumns()
{
super.testSelectInformationSchemaColumns();
}

@Override
public void testReadMetadataWithRelationsConcurrentModifications()
{
try {
super.testReadMetadataWithRelationsConcurrentModifications();
}
catch (Exception expected) {
// The test failure is not guaranteed
// TODO (https://github.com/trinodb/trino/issues/10904): shouldn't fail
assertThat(expected)
.hasMessageContaining("ERROR 1012 (42M03): Table undefined. tableName=");
throw new SkipException("to be fixed");
}
}

@Override
public void testCharVarcharComparison()
{
Expand Down
6 changes: 6 additions & 0 deletions plugin/trino-sqlserver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.trino</groupId>
<artifactId>trino-testing-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.trino</groupId>
<artifactId>trino-tpch</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import io.trino.sql.planner.plan.FilterNode;
import io.trino.testing.TestingConnectorBehavior;
import io.trino.testing.sql.TestTable;
import io.trino.testng.services.Flaky;
import org.testng.SkipException;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

Expand Down Expand Up @@ -135,6 +137,35 @@ public void testReadFromView()
onRemoteDatabase().execute("DROP VIEW IF EXISTS test_view");
}

// TODO (https://github.com/trinodb/trino/issues/10846): Test is expected to be flaky because tests execute in parallel
@Flaky(issue = "https://github.com/trinodb/trino/issues/10846", match = "was deadlocked on lock resources with another process and has been chosen as the deadlock victim")
@Test
@Override
public void testSelectInformationSchemaColumns()
{
super.testSelectInformationSchemaColumns();
}

@Test
@Override
public void testReadMetadataWithRelationsConcurrentModifications()
{
try {
super.testReadMetadataWithRelationsConcurrentModifications();
}
catch (Exception expected) {
// The test failure is not guaranteed
// TODO (https://github.com/trinodb/trino/issues/10846): shouldn't fail
assertThat(expected)
.hasMessageMatching("(?s).*(" +
"No task completed before timeout|" +
"was deadlocked on lock resources with another process and has been chosen as the deadlock victim|" +
// E.g. system.metadata.table_comments can return empty results, when underlying metadata list tables call fails
"Expecting actual not to be empty).*");
throw new SkipException("to be fixed");
}
}

@Test
public void testColumnComment()
{
Expand Down
Loading

0 comments on commit f712fe7

Please sign in to comment.