Skip to content

Commit

Permalink
Improve retries in AbstractTestHiveViews
Browse files Browse the repository at this point in the history
Previously we were retrying on "Execution Error, return code 2 from
org.apache.hadoop.hive.ql.exec.mr.MapRedTask". As CI shown, the return
code may vary, sometimes it is e.g. 1.

In the meantime we introduced broader retry patterns for Hive query
failures, so let's use these.
  • Loading branch information
findepi committed Mar 24, 2023
1 parent fe1b9d4 commit a4ee59f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
import static io.trino.tests.product.TestGroups.HIVE_ICEBERG_REDIRECTIONS;
import static io.trino.tests.product.TestGroups.HIVE_VIEWS;
import static io.trino.tests.product.TestGroups.PROFILE_SPECIFIC_TESTS;
import static io.trino.tests.product.utils.HadoopTestUtils.ERROR_READING_FROM_HIVE_ISSUE;
import static io.trino.tests.product.utils.HadoopTestUtils.ERROR_READING_FROM_HIVE_MATCH;
import static io.trino.tests.product.utils.HadoopTestUtils.RETRYABLE_FAILURES_ISSUES;
import static io.trino.tests.product.utils.HadoopTestUtils.RETRYABLE_FAILURES_MATCH;
import static io.trino.tests.product.utils.QueryExecutors.onHive;
import static io.trino.tests.product.utils.QueryExecutors.onTrino;
import static java.lang.String.format;
Expand Down Expand Up @@ -315,7 +315,7 @@ public void testShowCreateView()
* Test view containing IF, IN, LIKE, BETWEEN, CASE, COALESCE, operators, delimited and non-delimited columns, an inline comment
*/
@Test(groups = HIVE_VIEWS)
@Flaky(issue = ERROR_READING_FROM_HIVE_ISSUE, match = ERROR_READING_FROM_HIVE_MATCH)
@Flaky(issue = RETRYABLE_FAILURES_ISSUES, match = RETRYABLE_FAILURES_MATCH)
public void testRichSqlSyntax()
{
onHive().executeQuery("DROP VIEW IF EXISTS view_with_rich_syntax");
Expand Down Expand Up @@ -528,7 +528,7 @@ public void testNestedGroupBy()
}

@Test(groups = HIVE_VIEWS)
@Flaky(issue = ERROR_READING_FROM_HIVE_ISSUE, match = ERROR_READING_FROM_HIVE_MATCH)
@Flaky(issue = RETRYABLE_FAILURES_ISSUES, match = RETRYABLE_FAILURES_MATCH)
public void testUnionAllViews()
{
onHive().executeQuery("DROP TABLE IF EXISTS union_helper");
Expand Down Expand Up @@ -564,7 +564,7 @@ public void testUnionAllViews()
}

@Test(groups = HIVE_VIEWS)
@Flaky(issue = ERROR_READING_FROM_HIVE_ISSUE, match = ERROR_READING_FROM_HIVE_MATCH)
@Flaky(issue = RETRYABLE_FAILURES_ISSUES, match = RETRYABLE_FAILURES_MATCH)
public void testUnionDistinctViews()
{
if (getHiveVersionMajor() < 1 || (getHiveVersionMajor() == 1 && getHiveVersionMinor() < 2)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,10 @@ private HadoopTestUtils() {}

private static final Logger log = Logger.get(HiveProductTest.class);

public static final String ERROR_READING_FROM_HIVE_ISSUE = "https://github.com/trinodb/trino/issues/7535";
@Language("RegExp")
public static final String ERROR_READING_FROM_HIVE_MATCH = "FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask";

/**
* Link to issues:
* <ul>
* <ol><a href="https://github.com/trinodb/trino/issues/7535">#7535</a></ol>
* <ol><a href="https://github.com/trinodb/trino/issues/4936">#4936</a></ol>
* <ol><a href="https://github.com/trinodb/trino/issues/5427">#5427</a></ol>
* </ul>
Expand All @@ -49,7 +46,7 @@ private HadoopTestUtils() {}
// "could only be written to 0 of the 1 minReplication" is the error wording used by e.g. HDP 3
"|could only be written to 0 of the 1 minReplication" +
// "Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask. Error caching map.xml: java.nio.channels.ClosedByInterruptException"
"|return code 1 from \\Qorg.apache.hadoop.hive.ql.exec.mr.MapRedTask.\\E Error caching \\S*: \\Qjava.nio.channels.ClosedByInterruptException\\E" +
"|return code [12] from \\Qorg.apache.hadoop.hive.ql.exec.mr.MapRedTask\\E" +
")";

public static final RetryPolicy<QueryResult> ERROR_COMMITTING_WRITE_TO_HIVE_RETRY_POLICY = RetryPolicy.<QueryResult>builder()
Expand Down

0 comments on commit a4ee59f

Please sign in to comment.