Skip to content

Commit

Permalink
add be alive check
Browse files Browse the repository at this point in the history
  • Loading branch information
gnehil committed Oct 30, 2023
1 parent c2e0738 commit 0a4065f
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import java.net.URLClassLoader;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Arrays;
Expand Down Expand Up @@ -81,6 +82,7 @@ public class DorisCatalogIT extends TestSuiteBase implements TestResource {
"https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.16/mysql-connector-java-8.0.16.jar";
private static final String SET_SQL =
"ADMIN SET FRONTEND CONFIG (\"enable_batch_delete_by_default\" = \"true\")";
private static final String SHOW_BE = "SHOW BACKENDS";

private GenericContainer<?> container;
private Connection jdbcConnection;
Expand All @@ -99,6 +101,7 @@ public void startUp() throws Exception {
.withEnv("FE_ID", "1")
.withEnv("CURRENT_BE_IP", "127.0.0.1")
.withEnv("CURRENT_BE_PORT", "9050")
.withCommand("ulimit -n 65536")
.withPrivilegedMode(true)
.withLogConsumer(
new Slf4jLogConsumer(DockerLoggerFactory.getLogger(DOCKER_IMAGE)));
Expand Down Expand Up @@ -227,6 +230,13 @@ private void initializeJdbcConnection()
jdbcConnection = driver.connect(String.format(URL, container.getHost()), props);
try (Statement statement = jdbcConnection.createStatement()) {
statement.execute(SET_SQL);
ResultSet resultSet;

do {
resultSet = statement.executeQuery(SHOW_BE);
} while (!resultSet.next()
|| (!"Yes".equalsIgnoreCase(resultSet.getString(9))
&& !"Yes".equalsIgnoreCase(resultSet.getString(10))));
}
}
}

0 comments on commit 0a4065f

Please sign in to comment.