-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable query and task retries in MariaDbClient
Copy test overrides from 7b80852, as MariaDB also needs them.
- Loading branch information
Showing
7 changed files
with
143 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
...n/trino-mariadb/src/test/java/io/trino/plugin/mariadb/BaseMariaDbFailureRecoveryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.trino.plugin.mariadb; | ||
|
||
import com.google.common.collect.ImmutableMap; | ||
import io.trino.operator.RetryPolicy; | ||
import io.trino.plugin.exchange.filesystem.FileSystemExchangePlugin; | ||
import io.trino.plugin.jdbc.BaseJdbcFailureRecoveryTest; | ||
import io.trino.testing.QueryRunner; | ||
import io.trino.tpch.TpchTable; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
|
||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | ||
import static org.junit.jupiter.api.Assumptions.abort; | ||
|
||
public abstract class BaseMariaDbFailureRecoveryTest | ||
extends BaseJdbcFailureRecoveryTest | ||
{ | ||
public BaseMariaDbFailureRecoveryTest(RetryPolicy retryPolicy) | ||
{ | ||
super(retryPolicy); | ||
} | ||
|
||
@Override | ||
protected QueryRunner createQueryRunner(List<TpchTable<?>> requiredTpchTables, Map<String, String> configProperties, Map<String, String> coordinatorProperties) | ||
throws Exception | ||
{ | ||
TestingMariaDbServer server = closeAfterClass(new TestingMariaDbServer()); | ||
return MariaDbQueryRunner.builder(server) | ||
.setInitialTables(requiredTpchTables) | ||
.setExtraProperties(configProperties) | ||
.setCoordinatorProperties(coordinatorProperties) | ||
.setAdditionalSetup(runner -> { | ||
runner.installPlugin(new FileSystemExchangePlugin()); | ||
runner.loadExchangeManager("filesystem", ImmutableMap.of( | ||
"exchange.base-directories", System.getProperty("java.io.tmpdir") + "/trino-local-file-system-exchange-manager")); | ||
}) | ||
.build(); | ||
} | ||
|
||
@Test | ||
@Override | ||
protected void testUpdateWithSubquery() | ||
{ | ||
assertThatThrownBy(super::testUpdateWithSubquery).hasMessageContaining("Unexpected Join over for-update table scan"); | ||
abort("skipped"); | ||
} | ||
|
||
@Test | ||
@Override | ||
protected void testUpdate() | ||
{ | ||
// This simple update on JDBC ends up as a very simple, single-fragment, coordinator-only plan, | ||
// which has no ability to recover from errors. This test simply verifies that's still the case. | ||
Optional<String> setupQuery = Optional.of("CREATE TABLE <table> AS SELECT * FROM orders"); | ||
String testQuery = "UPDATE <table> SET shippriority = 101 WHERE custkey = 1"; | ||
Optional<String> cleanupQuery = Optional.of("DROP TABLE <table>"); | ||
|
||
assertThatQuery(testQuery) | ||
.withSetupQuery(setupQuery) | ||
.withCleanupQuery(cleanupQuery) | ||
.isCoordinatorOnly(); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
.../trino-mariadb/src/test/java/io/trino/plugin/mariadb/TestMariaDbQueryFailureRecovery.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.trino.plugin.mariadb; | ||
|
||
import io.trino.operator.RetryPolicy; | ||
|
||
public class TestMariaDbQueryFailureRecovery | ||
extends BaseMariaDbFailureRecoveryTest | ||
{ | ||
public TestMariaDbQueryFailureRecovery() | ||
{ | ||
super(RetryPolicy.QUERY); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...n/trino-mariadb/src/test/java/io/trino/plugin/mariadb/TestMariaDbTaskFailureRecovery.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.trino.plugin.mariadb; | ||
|
||
import io.trino.operator.RetryPolicy; | ||
|
||
public class TestMariaDbTaskFailureRecovery | ||
extends BaseMariaDbFailureRecoveryTest | ||
{ | ||
public TestMariaDbTaskFailureRecovery() | ||
{ | ||
super(RetryPolicy.TASK); | ||
} | ||
} |