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

Querying Iceberg materialized view on table after rollback_to_snapshot fails with "Snapshot ... is not valid in table ..." #18203

Closed
findepi opened this issue Jul 10, 2023 · 0 comments · Fixed by #18205
Assignees
Labels
bug Something isn't working

Comments

@findepi
Copy link
Member

findepi commented Jul 10, 2023

repro steps

create materialized view on an iceberg table with no expired snapshots
refresh the mv
roll the table back

io.trino.testing.QueryFailedException: Snapshot id 3979600791890477422 is not valid in table tpch."mv_on_rolled_back_base_table", snapshot BaseSnapshot{id=3030953262116595361, timestamp_ms=1688970311761, operation=append, summary={trino_query_id=20230710_062511_00009_tahhd, changed-partition-count=0, total-records=0, total-files-size=0, total-data-files=0, total-delete-files=0, total-position-deletes=0, total-equality-deletes=0}, manifest-list=/var/folders/dr/jhnfvsrd2zl925dyfsctj0pr0000gn/T/TrinoTest995900923851391070/iceberg_data/tpch/mv_on_rolled_back_base_table-b64f6f2dfaa54ab59a0d42861cda770b/metadata/snap-3030953262116595361-1-51b042c1-cac2-4ee8-ab44-d449bdbb4c5b.avro, schema-id=0} has no parent
	at io.trino.testing.AbstractTestingTrinoClient.execute(AbstractTestingTrinoClient.java:122)
	at io.trino.testing.DistributedQueryRunner.executeWithQueryId(DistributedQueryRunner.java:493)
	at io.trino.testing.DistributedQueryRunner.execute(DistributedQueryRunner.java:486)
	at io.trino.sql.query.QueryAssertions$QueryAssert.newQueryAssert(QueryAssertions.java:303)
	at io.trino.sql.query.QueryAssertions.query(QueryAssertions.java:125)
	at io.trino.testing.AbstractTestQueryFramework.query(AbstractTestQueryFramework.java:324)
	at io.trino.testing.AbstractTestQueryFramework.query(AbstractTestQueryFramework.java:319)
	at io.trino.plugin.iceberg.BaseIcebergMaterializedViewTest.testMaterializedViewOnTableRolledBack(BaseIcebergMaterializedViewTest.java:470)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	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.Invoker.invokeTestMethods(Invoker.java:1177)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
	at org.testng.TestRunner.privateRun(TestRunner.java:756)
	at org.testng.TestRunner.run(TestRunner.java:610)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:387)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:382)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
	at org.testng.SuiteRunner.run(SuiteRunner.java:289)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1293)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1218)
	at org.testng.TestNG.runSuites(TestNG.java:1133)
	at org.testng.TestNG.run(TestNG.java:1104)
	at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
	at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)
	Suppressed: java.lang.Exception: SQL: TABLE mv_on_rolled_back_the_mv
		at io.trino.testing.DistributedQueryRunner.executeWithQueryId(DistributedQueryRunner.java:497)
		... 30 more
Caused by: java.lang.IllegalArgumentException: Snapshot id 3979600791890477422 is not valid in table tpch."mv_on_rolled_back_base_table", snapshot BaseSnapshot{id=3030953262116595361, timestamp_ms=1688970311761, operation=append, summary={trino_query_id=20230710_062511_00009_tahhd, changed-partition-count=0, total-records=0, total-files-size=0, total-data-files=0, total-delete-files=0, total-position-deletes=0, total-equality-deletes=0}, manifest-list=/var/folders/dr/jhnfvsrd2zl925dyfsctj0pr0000gn/T/TrinoTest995900923851391070/iceberg_data/tpch/mv_on_rolled_back_base_table-b64f6f2dfaa54ab59a0d42861cda770b/metadata/snap-3030953262116595361-1-51b042c1-cac2-4ee8-ab44-d449bdbb4c5b.avro, schema-id=0} has no parent
	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:463)
	at io.trino.plugin.iceberg.IcebergUtil.firstSnapshotAfter(IcebergUtil.java:661)
	at io.trino.plugin.iceberg.IcebergMetadata.getTableChangeInfo(IcebergMetadata.java:2814)
	at io.trino.plugin.iceberg.IcebergMetadata.getMaterializedViewFreshness(IcebergMetadata.java:2766)
	at io.trino.plugin.base.classloader.ClassLoaderSafeConnectorMetadata.getMaterializedViewFreshness(ClassLoaderSafeConnectorMetadata.java:1015)
	at io.trino.tracing.TracingConnectorMetadata.getMaterializedViewFreshness(TracingConnectorMetadata.java:1163)
	at io.trino.metadata.MetadataManager.getMaterializedViewFreshness(MetadataManager.java:1462)
	at io.trino.tracing.TracingMetadata.getMaterializedViewFreshness(TracingMetadata.java:1246)
	at io.trino.sql.analyzer.StatementAnalyzer$Visitor.isMaterializedViewSufficientlyFresh(StatementAnalyzer.java:2255)
	at io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitTable(StatementAnalyzer.java:2183)
	at io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitTable(StatementAnalyzer.java:487)
	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:504)
	at io.trino.sql.analyzer.StatementAnalyzer$Visitor.process(StatementAnalyzer.java:512)
	at io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitQuery(StatementAnalyzer.java:1488)
	at io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitQuery(StatementAnalyzer.java:487)
	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:504)
	at io.trino.sql.analyzer.StatementAnalyzer.analyze(StatementAnalyzer.java:466)
	at io.trino.sql.analyzer.Analyzer.analyze(Analyzer.java:97)
	at io.trino.sql.analyzer.Analyzer.analyze(Analyzer.java:86)
	at io.trino.execution.SqlQueryExecution.analyze(SqlQueryExecution.java:270)
	at io.trino.execution.SqlQueryExecution.<init>(SqlQueryExecution.java:205)
	at io.trino.execution.SqlQueryExecution$SqlQueryExecutionFactory.createQueryExecution(SqlQueryExecution.java:844)
	at io.trino.dispatcher.LocalDispatchQueryFactory.lambda$createDispatchQuery$0(LocalDispatchQueryFactory.java:153)
	at io.trino.$gen.Trino_testversion____20230710_062505_75.call(Unknown Source)
@findepi findepi added the bug Something isn't working label Jul 10, 2023
@findepi findepi self-assigned this Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

1 participant