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 BaseFailureRecoveryTest temp table checking message pattern #16636

Conversation

findepi
Copy link
Member

@findepi findepi commented Mar 20, 2023

The expected exception message pattern needs to match the one used in StatementAnalyzer.Visitor#visitTable, e.g. the table name should be expected in apostrophes.

This should fix errors on CI like the one below (https://github.com/trinodb/trino/actions/runs/4467931974/jobs/7848093602)

Error:  io.trino.plugin.bigquery.TestBigQueryTaskFailureRecoveryTest.testParallel[testExplainAnalyze](9)  Time elapsed: 107.3 s  <<< FAILURE!
java.lang.AssertionError:
[There should be no remaining tmp_trino tables that are queryable. They are:
	For queryId [20230320_124434_00162_6w4f2] (prefix [tmp_trino_3a3f1a6f_]) remaining tables: [tmp_trino_3a3f1a6f_e3d45e3f]
		With errors: [
			Expecting throwable message:
			  "line 1:15: Table 'bigquery.tpch.tmp_trino_3a3f1a6f_e3d45e3f' does not exist"
			to contain:
			  "tmp_trino_3a3f1a6f_e3d45e3f does not exist"
			but did not.

			Throwable that failed the check:

			io.trino.testing.QueryFailedException: line 1:15: Table 'bigquery.tpch.tmp_trino_3a3f1a6f_e3d45e3f' does not exist
				at io.trino.testing.AbstractTestingTrinoClient.execute(AbstractTestingTrinoClient.java:122)
				at io.trino.testing.AbstractTestingTrinoClient.execute(AbstractTestingTrinoClient.java:85)
				at io.trino.testing.DistributedQueryRunner.execute(DistributedQueryRunner.java:477)
				at io.trino.testing.BaseFailureRecoveryTest.lambda$checkTemporaryTables$15(BaseFailureRecoveryTest.java:439)
				at org.assertj.core.api.ThrowableAssert.catchThrowable(ThrowableAssert.java:63)
				at org.assertj.core.api.AssertionsForClassTypes.catchThrowable(AssertionsForClassTypes.java:892)
				at org.assertj.core.api.Assertions.catchThrowable(Assertions.java:1366)
				at org.assertj.core.api.Assertions.assertThatThrownBy(Assertions.java:1210)
				at io.trino.testing.BaseFailureRecoveryTest.checkTemporaryTables(BaseFailureRecoveryTest.java:439)
				at io.trino.testing.BaseFailureRecoveryTest$FailureRecoveryAssert.cleansUpTemporaryTables(BaseFailureRecoveryTest.java:619)
				at io.trino.testing.BaseFailureRecoveryTest.testNonSelect(BaseFailureRecoveryTest.java:365)
				at io.trino.testing.BaseFailureRecoveryTest.testTableModification(BaseFailureRecoveryTest.java:342)
				at io.trino.testing.BaseFailureRecoveryTest.testTableModification(BaseFailureRecoveryTest.java:337)
				at io.trino.testing.BaseFailureRecoveryTest.testExplainAnalyze(BaseFailureRecoveryTest.java:315)
				at io.trino.testing.BaseFailureRecoveryTest$ParallelTestRunnable.run(BaseFailureRecoveryTest.java:899)
				at io.trino.testing.BaseFailureRecoveryTest.testParallel(BaseFailureRecoveryTest.java:222)
				at jdk.internal.reflect.GeneratedMethodAccessor1309.invoke(Unknown Source)
				at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
				at java.base/java.lang.reflect.Method.invoke(Method.java:568)
				at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:104)
				at org.testng.internal.Invoker.invokeMethod(Invoker.java:645)
				at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:851)
				at org.testng.internal.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:75)
				at org.testng.internal.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:14)
				at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
				at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
				at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
				at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
				at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
				at java.base/java.lang.Thread.run(Thread.java:833)
			Caused by: io.trino.spi.TrinoException: line 1:15: Table 'bigquery.tpch.tmp_trino_3a3f1a6f_e3d45e3f' does not exist
				at io.trino.sql.analyzer.SemanticExceptions.semanticException(SemanticExceptions.java:48)
				at io.trino.sql.analyzer.SemanticExceptions.semanticException(SemanticExceptions.java:43)
				at io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitTable(StatementAnalyzer.java:2179)
				at io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitTable(StatementAnalyzer.java:484)
				at io.trino.sql.tree.Table.accept(Table.java:60)
				at io.trino.sql.tree.AstVisitor.process(AstVisitor.java:27)
				at io.trino.sql.analyzer.StatementAnalyzer$Visitor.process(StatementAnalyzer.java:501)
				at io.trino.sql.analyzer.StatementAnalyzer$Visitor.analyzeFrom(StatementAnalyzer.java:4466)
				at io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitQuerySpecification(StatementAnalyzer.java:2933)
				at io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitQuerySpecification(StatementAnalyzer.java:484)
				at io.trino.sql.tree.QuerySpecification.accept(QuerySpecification.java:155)
				at io.trino.sql.tree.AstVisitor.process(AstVisitor.java:27)
				at io.trino.sql.analyzer.StatementAnalyzer$Visitor.process(StatementAnalyzer.java:501)
				at io.trino.sql.analyzer.StatementAnalyzer$Visitor.process(StatementAnalyzer.java:509)
				at io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitQuery(StatementAnalyzer.java:1460)
				at io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitQuery(StatementAnalyzer.java:484)
				at io.trino.sql.tree.Query.accept(Query.java:107)
				at io.trino.sql.tree.AstVisitor.process(AstVisitor.java:27)
				at io.trino.sql.analyzer.StatementAnalyzer$Visitor.process(StatementAnalyzer.java:501)
				at io.trino.sql.analyzer.StatementAnalyzer.analyze(StatementAnalyzer.java:463)
				at io.trino.sql.analyzer.Analyzer.analyze(Analyzer.java:79)
				at io.trino.sql.analyzer.Analyzer.analyze(Analyzer.java:71)
				at io.trino.execution.SqlQueryExecution.analyze(SqlQueryExecution.java:258)
				at io.trino.execution.SqlQueryExecution.<init>(SqlQueryExecution.java:196)
				at io.trino.execution.SqlQueryExecution$SqlQueryExecutionFactory.createQueryExecution(SqlQueryExecution.java:818)
				at io.trino.dispatcher.LocalDispatchQueryFactory.lambda$createDispatchQuery$0(LocalDispatchQueryFactory.java:149)
				at io.trino.$gen.Trino_testversion____20230320_122419_784.call(Unknown Source)
				at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:131)
				at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:74)
				at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:82)
				at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
				at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
				at java.base/java.lang.Thread.run(Thread.java:833)
			]]
Expecting value to be true but was false
	at io.trino.testing.BaseFailureRecoveryTest.checkTemporaryTables(BaseFailureRecoveryTest.java:458)
	at io.trino.testing.BaseFailureRecoveryTest$FailureRecoveryAssert.cleansUpTemporaryTables(BaseFailureRecoveryTest.java:619)
	at io.trino.testing.BaseFailureRecoveryTest.testNonSelect(BaseFailureRecoveryTest.java:365)
	at io.trino.testing.BaseFailureRecoveryTest.testTableModification(BaseFailureRecoveryTest.java:342)
	at io.trino.testing.BaseFailureRecoveryTest.testTableModification(BaseFailureRecoveryTest.java:337)
	at io.trino.testing.BaseFailureRecoveryTest.testExplainAnalyze(BaseFailureRecoveryTest.java:315)
	at io.trino.testing.BaseFailureRecoveryTest$ParallelTestRunnable.run(BaseFailureRecoveryTest.java:899)
	at io.trino.testing.BaseFailureRecoveryTest.testParallel(BaseFailureRecoveryTest.java:222)
	at jdk.internal.reflect.GeneratedMethodAccessor1309.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:104)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:645)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:851)
	at org.testng.internal.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:75)
	at org.testng.internal.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:14)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)

Follows #16499

The expected exception message pattern needs to match the one used in
`StatementAnalyzer.Visitor#visitTable`, e.g. the table name should be
expected in apostrophes.

This should fix errors on CI like the one below

```
Error:  io.trino.plugin.bigquery.TestBigQueryTaskFailureRecoveryTest.testParallel[testExplainAnalyze](9)  Time elapsed: 107.3 s  <<< FAILURE!
java.lang.AssertionError:
[There should be no remaining tmp_trino tables that are queryable. They are:
	For queryId [20230320_124434_00162_6w4f2] (prefix [tmp_trino_3a3f1a6f_]) remaining tables: [tmp_trino_3a3f1a6f_e3d45e3f]
		With errors: [
			Expecting throwable message:
			  "line 1:15: Table 'bigquery.tpch.tmp_trino_3a3f1a6f_e3d45e3f' does not exist"
			to contain:
			  "tmp_trino_3a3f1a6f_e3d45e3f does not exist"
			but did not.

			Throwable that failed the check:

			io.trino.testing.QueryFailedException: line 1:15: Table 'bigquery.tpch.tmp_trino_3a3f1a6f_e3d45e3f' does not exist
				at io.trino.testing.AbstractTestingTrinoClient.execute(AbstractTestingTrinoClient.java:122)
				at io.trino.testing.AbstractTestingTrinoClient.execute(AbstractTestingTrinoClient.java:85)
				at io.trino.testing.DistributedQueryRunner.execute(DistributedQueryRunner.java:477)
				at io.trino.testing.BaseFailureRecoveryTest.lambda$checkTemporaryTables$15(BaseFailureRecoveryTest.java:439)
				at org.assertj.core.api.ThrowableAssert.catchThrowable(ThrowableAssert.java:63)
				at org.assertj.core.api.AssertionsForClassTypes.catchThrowable(AssertionsForClassTypes.java:892)
				at org.assertj.core.api.Assertions.catchThrowable(Assertions.java:1366)
				at org.assertj.core.api.Assertions.assertThatThrownBy(Assertions.java:1210)
				at io.trino.testing.BaseFailureRecoveryTest.checkTemporaryTables(BaseFailureRecoveryTest.java:439)
				at io.trino.testing.BaseFailureRecoveryTest$FailureRecoveryAssert.cleansUpTemporaryTables(BaseFailureRecoveryTest.java:619)
				at io.trino.testing.BaseFailureRecoveryTest.testNonSelect(BaseFailureRecoveryTest.java:365)
				at io.trino.testing.BaseFailureRecoveryTest.testTableModification(BaseFailureRecoveryTest.java:342)
				at io.trino.testing.BaseFailureRecoveryTest.testTableModification(BaseFailureRecoveryTest.java:337)
				at io.trino.testing.BaseFailureRecoveryTest.testExplainAnalyze(BaseFailureRecoveryTest.java:315)
				at io.trino.testing.BaseFailureRecoveryTest$ParallelTestRunnable.run(BaseFailureRecoveryTest.java:899)
				at io.trino.testing.BaseFailureRecoveryTest.testParallel(BaseFailureRecoveryTest.java:222)
				at jdk.internal.reflect.GeneratedMethodAccessor1309.invoke(Unknown Source)
				at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
				at java.base/java.lang.reflect.Method.invoke(Method.java:568)
				at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:104)
				at org.testng.internal.Invoker.invokeMethod(Invoker.java:645)
				at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:851)
				at org.testng.internal.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:75)
				at org.testng.internal.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:14)
				at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
				at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
				at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
				at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
				at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
				at java.base/java.lang.Thread.run(Thread.java:833)
			Caused by: io.trino.spi.TrinoException: line 1:15: Table 'bigquery.tpch.tmp_trino_3a3f1a6f_e3d45e3f' does not exist
				at io.trino.sql.analyzer.SemanticExceptions.semanticException(SemanticExceptions.java:48)
				at io.trino.sql.analyzer.SemanticExceptions.semanticException(SemanticExceptions.java:43)
				at io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitTable(StatementAnalyzer.java:2179)
				at io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitTable(StatementAnalyzer.java:484)
				at io.trino.sql.tree.Table.accept(Table.java:60)
				at io.trino.sql.tree.AstVisitor.process(AstVisitor.java:27)
				at io.trino.sql.analyzer.StatementAnalyzer$Visitor.process(StatementAnalyzer.java:501)
				at io.trino.sql.analyzer.StatementAnalyzer$Visitor.analyzeFrom(StatementAnalyzer.java:4466)
				at io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitQuerySpecification(StatementAnalyzer.java:2933)
				at io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitQuerySpecification(StatementAnalyzer.java:484)
				at io.trino.sql.tree.QuerySpecification.accept(QuerySpecification.java:155)
				at io.trino.sql.tree.AstVisitor.process(AstVisitor.java:27)
				at io.trino.sql.analyzer.StatementAnalyzer$Visitor.process(StatementAnalyzer.java:501)
				at io.trino.sql.analyzer.StatementAnalyzer$Visitor.process(StatementAnalyzer.java:509)
				at io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitQuery(StatementAnalyzer.java:1460)
				at io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitQuery(StatementAnalyzer.java:484)
				at io.trino.sql.tree.Query.accept(Query.java:107)
				at io.trino.sql.tree.AstVisitor.process(AstVisitor.java:27)
				at io.trino.sql.analyzer.StatementAnalyzer$Visitor.process(StatementAnalyzer.java:501)
				at io.trino.sql.analyzer.StatementAnalyzer.analyze(StatementAnalyzer.java:463)
				at io.trino.sql.analyzer.Analyzer.analyze(Analyzer.java:79)
				at io.trino.sql.analyzer.Analyzer.analyze(Analyzer.java:71)
				at io.trino.execution.SqlQueryExecution.analyze(SqlQueryExecution.java:258)
				at io.trino.execution.SqlQueryExecution.<init>(SqlQueryExecution.java:196)
				at io.trino.execution.SqlQueryExecution$SqlQueryExecutionFactory.createQueryExecution(SqlQueryExecution.java:818)
				at io.trino.dispatcher.LocalDispatchQueryFactory.lambda$createDispatchQuery$0(LocalDispatchQueryFactory.java:149)
				at io.trino.$gen.Trino_testversion____20230320_122419_784.call(Unknown Source)
				at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:131)
				at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:74)
				at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:82)
				at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
				at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
				at java.base/java.lang.Thread.run(Thread.java:833)
			]]
Expecting value to be true but was false
	at io.trino.testing.BaseFailureRecoveryTest.checkTemporaryTables(BaseFailureRecoveryTest.java:458)
	at io.trino.testing.BaseFailureRecoveryTest$FailureRecoveryAssert.cleansUpTemporaryTables(BaseFailureRecoveryTest.java:619)
	at io.trino.testing.BaseFailureRecoveryTest.testNonSelect(BaseFailureRecoveryTest.java:365)
	at io.trino.testing.BaseFailureRecoveryTest.testTableModification(BaseFailureRecoveryTest.java:342)
	at io.trino.testing.BaseFailureRecoveryTest.testTableModification(BaseFailureRecoveryTest.java:337)
	at io.trino.testing.BaseFailureRecoveryTest.testExplainAnalyze(BaseFailureRecoveryTest.java:315)
	at io.trino.testing.BaseFailureRecoveryTest$ParallelTestRunnable.run(BaseFailureRecoveryTest.java:899)
	at io.trino.testing.BaseFailureRecoveryTest.testParallel(BaseFailureRecoveryTest.java:222)
	at jdk.internal.reflect.GeneratedMethodAccessor1309.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:104)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:645)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:851)
	at org.testng.internal.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:75)
	at org.testng.internal.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:14)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
```
@findepi findepi added test no-release-notes This pull request does not require release notes entry labels Mar 20, 2023
@cla-bot cla-bot bot added the cla-signed label Mar 20, 2023
@findepi findepi merged commit baac397 into trinodb:master Mar 20, 2023
@findepi findepi deleted the findepi/fix-basefailurerecoverytest-temp-table-checking-message-pattern-7731c0 branch March 20, 2023 16:03
@github-actions github-actions bot added this to the 411 milestone Mar 20, 2023
@@ -437,7 +437,7 @@ protected void checkTemporaryTables(Set<String> queryIds)
String temporaryTableName = (String) temporaryTableRow.getField(0);
try {
assertThatThrownBy(() -> getQueryRunner().execute("SELECT 1 FROM %s WHERE 1 = 0".formatted(temporaryTableName)))
.hasMessageContaining("%s does not exist", temporaryTableName);
.hasMessageContaining("Table '%s' does not exist", temporaryTableName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@findepi Does temporaryTableName actually contain fully-qualified name? The error messages say Table 'catalog.schema.table_name' does not exist while temporaryTableName comes from SHOW TABLES LIKE which doesn't return fully-qualified names.

(asking before I submit a PR, I saw this happen locally but for a different connector I was trying to add FTE to)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hashhar thanks it seems you're right.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

being fixed by @ppalucha in #16977

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed no-release-notes This pull request does not require release notes entry test
Development

Successfully merging this pull request may close these issues.

3 participants