From cf698fb615300489a5077277fdebc334a7bcb75c Mon Sep 17 00:00:00 2001 From: Mingyu Chen Date: Sat, 24 Aug 2024 03:29:18 +0800 Subject: [PATCH] [fix](regression) fix some jdbc datasource docker health check (#39141) (#39872) --- .../clickhouse/clickhouse.yaml.tpl | 2 +- .../clickhouse/init/05-check.sql | 23 +++++++++++++++++++ .../docker-compose/mariadb/init/05-check.sql | 21 +++++++++++++++++ .../mariadb/mariadb-10.yaml.tpl | 2 +- .../docker-compose/mysql/init/05-check.sql | 21 +++++++++++++++++ .../docker-compose/mysql/mysql-5.7.yaml.tpl | 2 +- .../docker-compose/oracle/init/05-check.sql | 21 +++++++++++++++++ .../docker-compose/oracle/oracle-11.yaml.tpl | 2 +- .../postgresql/init/05-check.sql | 21 +++++++++++++++++ .../postgresql/postgresql-14.yaml.tpl | 2 +- 10 files changed, 112 insertions(+), 5 deletions(-) create mode 100644 docker/thirdparties/docker-compose/clickhouse/init/05-check.sql create mode 100644 docker/thirdparties/docker-compose/mariadb/init/05-check.sql create mode 100644 docker/thirdparties/docker-compose/mysql/init/05-check.sql create mode 100644 docker/thirdparties/docker-compose/oracle/init/05-check.sql create mode 100644 docker/thirdparties/docker-compose/postgresql/init/05-check.sql diff --git a/docker/thirdparties/docker-compose/clickhouse/clickhouse.yaml.tpl b/docker/thirdparties/docker-compose/clickhouse/clickhouse.yaml.tpl index c4dd3d651c..82e33d4d71 100644 --- a/docker/thirdparties/docker-compose/clickhouse/clickhouse.yaml.tpl +++ b/docker/thirdparties/docker-compose/clickhouse/clickhouse.yaml.tpl @@ -31,7 +31,7 @@ services: ports: - ${DOCKER_CLICKHOUSE_EXTERNAL_HTTP_PORT}:8123 healthcheck: - test: ["CMD-SHELL", "clickhouse-client --password=123456 --query 'SELECT 1'"] + test: ["CMD-SHELL", "clickhouse-client --password=123456 --query 'SELECT 1 FROM doris_test.deadline'"] interval: 30s timeout: 10s retries: 5 diff --git a/docker/thirdparties/docker-compose/clickhouse/init/05-check.sql b/docker/thirdparties/docker-compose/clickhouse/init/05-check.sql new file mode 100644 index 0000000000..a06851aa7d --- /dev/null +++ b/docker/thirdparties/docker-compose/clickhouse/init/05-check.sql @@ -0,0 +1,23 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you 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. + +CREATE TABLE doris_test.deadline +( + id Int64 +) +ENGINE = MergeTree +ORDER BY id; diff --git a/docker/thirdparties/docker-compose/mariadb/init/05-check.sql b/docker/thirdparties/docker-compose/mariadb/init/05-check.sql new file mode 100644 index 0000000000..56541c08f4 --- /dev/null +++ b/docker/thirdparties/docker-compose/mariadb/init/05-check.sql @@ -0,0 +1,21 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you 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. + +CREATE TABLE doris_test.deadline +( + id int +); diff --git a/docker/thirdparties/docker-compose/mariadb/mariadb-10.yaml.tpl b/docker/thirdparties/docker-compose/mariadb/mariadb-10.yaml.tpl index f6af7ffed8..f22b1a0b0a 100644 --- a/docker/thirdparties/docker-compose/mariadb/mariadb-10.yaml.tpl +++ b/docker/thirdparties/docker-compose/mariadb/mariadb-10.yaml.tpl @@ -30,7 +30,7 @@ services: ports: - ${DOCKER_MARIADB_EXTERNAL_PORT}:3306 healthcheck: - test: mysqladmin ping -h 127.0.0.1 -u root --password=$$MARIADB_ROOT_PASSWORD + test: mysqladmin ping -h 127.0.0.1 -u root --password=$$MARIADB_ROOT_PASSWORD && mysql -h 127.0.0.1 -u root --password=$$MARIADB_ROOT_PASSWORD -e "SELECT 1 FROM doris_test.deadline;" interval: 5s timeout: 60s retries: 120 diff --git a/docker/thirdparties/docker-compose/mysql/init/05-check.sql b/docker/thirdparties/docker-compose/mysql/init/05-check.sql new file mode 100644 index 0000000000..56541c08f4 --- /dev/null +++ b/docker/thirdparties/docker-compose/mysql/init/05-check.sql @@ -0,0 +1,21 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you 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. + +CREATE TABLE doris_test.deadline +( + id int +); diff --git a/docker/thirdparties/docker-compose/mysql/mysql-5.7.yaml.tpl b/docker/thirdparties/docker-compose/mysql/mysql-5.7.yaml.tpl index 6c6ad81e41..c335fecace 100644 --- a/docker/thirdparties/docker-compose/mysql/mysql-5.7.yaml.tpl +++ b/docker/thirdparties/docker-compose/mysql/mysql-5.7.yaml.tpl @@ -30,7 +30,7 @@ services: ports: - ${DOCKER_MYSQL_57_EXTERNAL_PORT}:3306 healthcheck: - test: mysqladmin ping -h 127.0.0.1 -u root --password=$$MYSQL_ROOT_PASSWORD + test: mysqladmin ping -h 127.0.0.1 -u root --password=$$MYSQL_ROOT_PASSWORD && mysql -h 127.0.0.1 -u root --password=$$MYSQL_ROOT_PASSWORD -e "SELECT 1 FROM doris_test.deadline;" interval: 5s timeout: 60s retries: 120 diff --git a/docker/thirdparties/docker-compose/oracle/init/05-check.sql b/docker/thirdparties/docker-compose/oracle/init/05-check.sql new file mode 100644 index 0000000000..640c51fe18 --- /dev/null +++ b/docker/thirdparties/docker-compose/oracle/init/05-check.sql @@ -0,0 +1,21 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you 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. + +CREATE TABLE doris_test.deadline +( + id number(5) +); diff --git a/docker/thirdparties/docker-compose/oracle/oracle-11.yaml.tpl b/docker/thirdparties/docker-compose/oracle/oracle-11.yaml.tpl index 9a1dc15da6..c9fb89016f 100644 --- a/docker/thirdparties/docker-compose/oracle/oracle-11.yaml.tpl +++ b/docker/thirdparties/docker-compose/oracle/oracle-11.yaml.tpl @@ -25,7 +25,7 @@ services: - ${DOCKER_ORACLE_EXTERNAL_PORT}:1521 privileged: true healthcheck: - test: [ "CMD", "bash", "-c", "echo 'select 1 from dual;' | ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe /u01/app/oracle/product/11.2.0/xe/bin/sqlplus -s DORIS_TEST/123456@localhost"] + test: [ "CMD", "bash", "-c", "echo 'SELECT 1 FROM doris_test.deadline;' | ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe /u01/app/oracle/product/11.2.0/xe/bin/sqlplus -s DORIS_TEST/123456@localhost" ] interval: 20s timeout: 60s retries: 120 diff --git a/docker/thirdparties/docker-compose/postgresql/init/05-check.sql b/docker/thirdparties/docker-compose/postgresql/init/05-check.sql new file mode 100644 index 0000000000..56541c08f4 --- /dev/null +++ b/docker/thirdparties/docker-compose/postgresql/init/05-check.sql @@ -0,0 +1,21 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you 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. + +CREATE TABLE doris_test.deadline +( + id int +); diff --git a/docker/thirdparties/docker-compose/postgresql/postgresql-14.yaml.tpl b/docker/thirdparties/docker-compose/postgresql/postgresql-14.yaml.tpl index ebc8ed185f..9cea58777e 100644 --- a/docker/thirdparties/docker-compose/postgresql/postgresql-14.yaml.tpl +++ b/docker/thirdparties/docker-compose/postgresql/postgresql-14.yaml.tpl @@ -26,7 +26,7 @@ services: ports: - ${DOCKER_PG_14_EXTERNAL_PORT}:5432 healthcheck: - test: ["CMD-SHELL", "pg_isready -U postgres"] + test: [ "CMD-SHELL", "pg_isready -U postgres && psql -U postgres -c 'SELECT 1 FROM doris_test.deadline;'" ] interval: 5s timeout: 60s retries: 120