You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by st...@apache.org on 2024/04/12 09:43:49 UTC
(impala) branch branch-3.4.2 updated (8e9c5a5d1 -> 3df9c0f13)
This is an automated email from the ASF dual-hosted git repository.
stigahuang pushed a change to branch branch-3.4.2
in repository https://gitbox.apache.org/repos/asf/impala.git
from 8e9c5a5d1 IMPALA-10262: RPM/DEB Packaging Support
new 483dc9830 IMPALA-10262: (Addendum) fix incorrect paths of shared libs in building the package
new 69ded221e IMPALA-9845: Point Maven and Ant downloads to stable locations
new 3cf30008c IMPALA-10052: Expose daemon health endpoint for statestore and catalog
new 3fe856f8c IMPALA-12288: Add BUILD_WITH_NO_TESTS option to remove test targets
new 63bc975e0 IMPALA-12362: (part-1/4) Refactor service management scripts.
new ff56cf960 IMPALA-12362: (part-2/4) Optimize default configurations for packaging module.
new 3df9c0f13 IMPALA-12979: Avoid using wildcard in CLASSPATH
The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
CMakeLists.txt | 19 +-
be/CMakeLists.txt | 53 ++--
be/src/benchmarks/CMakeLists.txt | 3 +
be/src/catalog/CMakeLists.txt | 4 +
be/src/catalog/catalog-server.cc | 19 ++
be/src/catalog/catalog-server.h | 14 ++
be/src/catalog/catalogd-main.cc | 1 +
be/src/codegen/CMakeLists.txt | 14 +-
be/src/common/CMakeLists.txt | 22 +-
be/src/exec/CMakeLists.txt | 4 +
be/src/exec/parquet/CMakeLists.txt | 4 +
be/src/experiments/CMakeLists.txt | 4 +
be/src/exprs/CMakeLists.txt | 4 +
be/src/gutil/CMakeLists.txt | 4 +
be/src/rpc/CMakeLists.txt | 7 +
be/src/runtime/CMakeLists.txt | 4 +
be/src/runtime/bufferpool/CMakeLists.txt | 4 +
be/src/runtime/io/CMakeLists.txt | 4 +
be/src/scheduling/CMakeLists.txt | 4 +
be/src/service/CMakeLists.txt | 32 +--
be/src/statestore/CMakeLists.txt | 4 +
be/src/statestore/statestore.cc | 20 +-
be/src/statestore/statestore.h | 10 +-
be/src/testutil/CMakeLists.txt | 4 +
be/src/udf/CMakeLists.txt | 4 +
be/src/udf_samples/CMakeLists.txt | 4 +
be/src/util/CMakeLists.txt | 34 +--
be/src/util/cache/CMakeLists.txt | 4 +
bin/bootstrap_system.sh | 4 +-
bin/rat_exclude_files.txt | 3 -
buildall.sh | 3 +
package/bin/impala-env.sh | 85 -------
package/bin/impala.sh | 275 +++++++++++++++++++++
package/bin/start-catalogd.sh | 38 ---
package/bin/start-impalad.sh | 49 ----
package/bin/stop-impalad.sh | 23 --
package/bin/stop-statestored.sh | 23 --
package/conf/catalogd_flags | 37 ++-
package/conf/core-site.xml | 20 --
.../conf/core-site.xml.template | 29 ++-
package/conf/fair-scheduler.xml | 6 -
.../conf/fair-scheduler.xml.template | 11 +-
.../conf/{hdfs-site.xml => hdfs-site.xml.template} | 19 ++
package/conf/hive-site.xml | 20 --
.../conf/hive-site.xml.template | 29 ++-
.../start-statestored.sh => conf/impala-env.sh} | 36 +--
package/conf/impalad_flags | 44 +++-
package/conf/llama-site.xml | 3 -
.../conf/llama-site.xml.template | 10 +-
package/conf/statestore_flags | 7 -
.../stop-catalogd.sh => conf/statestored_flags} | 15 +-
tests/webserver/test_web_pages.py | 6 +-
52 files changed, 672 insertions(+), 431 deletions(-)
delete mode 100644 package/bin/impala-env.sh
create mode 100755 package/bin/impala.sh
delete mode 100755 package/bin/start-catalogd.sh
delete mode 100755 package/bin/start-impalad.sh
delete mode 100755 package/bin/stop-impalad.sh
delete mode 100755 package/bin/stop-statestored.sh
delete mode 100644 package/conf/core-site.xml
copy docs/impala_release_notes.ditamap => package/conf/core-site.xml.template (64%)
delete mode 100644 package/conf/fair-scheduler.xml
copy www/table_metrics.tmpl => package/conf/fair-scheduler.xml.template (84%)
rename package/conf/{hdfs-site.xml => hdfs-site.xml.template} (57%)
delete mode 100644 package/conf/hive-site.xml
copy docs/impala_release_notes.ditamap => package/conf/hive-site.xml.template (64%)
rename package/{bin/start-statestored.sh => conf/impala-env.sh} (50%)
mode change 100755 => 100644
delete mode 100644 package/conf/llama-site.xml
copy www/json-test.tmpl => package/conf/llama-site.xml.template (90%)
delete mode 100644 package/conf/statestore_flags
rename package/{bin/stop-catalogd.sh => conf/statestored_flags} (80%)
mode change 100755 => 100644
(impala) 02/07: IMPALA-9845: Point Maven and Ant downloads to stable locations
Posted by st...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
stigahuang pushed a commit to branch branch-3.4.2
in repository https://gitbox.apache.org/repos/asf/impala.git
commit 69ded221edb56c69023c1f31365544f0f807a506
Author: Laszlo Gaal <la...@cloudera.com>
AuthorDate: Wed Jun 10 21:23:49 2020 +0200
IMPALA-9845: Point Maven and Ant downloads to stable locations
Ant released a new version in May 2020, which made the URL in
bootstrap_system.sh obsolete. At the same time Apache created new rules
for the download locations, moving older releases to archive.apache.org.
This patch changes the download URLs for Maven and Ant to point to the
stable locations at archive.apache.org. These locations don't change
when a new version of a project is released, so downloads pulling a
specific version will not be affected by a new release. At the same time
new releases are stored at the archive site as well, so this location
works for all versions.
Backport note:
Just need to change the URL of ant.
Change-Id: I1875f260b931ef096fc91a4723f91310225c55c9
Reviewed-on: http://gerrit.cloudera.org:8080/16062
Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
Reviewed-on: http://gerrit.cloudera.org:8080/21260
Reviewed-by: Zihao Ye <ey...@163.com>
Tested-by: Quanlong Huang <hu...@gmail.com>
---
bin/bootstrap_system.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/bin/bootstrap_system.sh b/bin/bootstrap_system.sh
index 22d9bd44b..264fda3af 100755
--- a/bin/bootstrap_system.sh
+++ b/bin/bootstrap_system.sh
@@ -242,8 +242,8 @@ redhat sudo yum clean all
# Download ant for centos
redhat sudo wget -nv \
- https://downloads.apache.org/ant/binaries/apache-ant-1.9.14-bin.tar.gz
-redhat sha512sum -c - <<< '487dbd1d7f678a92924ba884a57e910ccb4fe565c554278795a8fdfc80c4e88d81ebc2ccecb5a8f353f0b2076572bb921499a2cadb064e0f44fc406a3c31da20 apache-ant-1.9.14-bin.tar.gz'
+ https://archive.apache.org/dist/ant/binaries/apache-ant-1.9.14-bin.tar.gz
+redhat sudo sha512sum -c - <<< '487dbd1d7f678a92924ba884a57e910ccb4fe565c554278795a8fdfc80c4e88d81ebc2ccecb5a8f353f0b2076572bb921499a2cadb064e0f44fc406a3c31da20 apache-ant-1.9.14-bin.tar.gz'
redhat sudo tar -C /usr/local -xzf apache-ant-1.9.14-bin.tar.gz
redhat sudo ln -s /usr/local/apache-ant-1.9.14/bin/ant /usr/local/bin
(impala) 03/07: IMPALA-10052: Expose daemon health endpoint for statestore and catalog
Posted by st...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
stigahuang pushed a commit to branch branch-3.4.2
in repository https://gitbox.apache.org/repos/asf/impala.git
commit 3cf30008cfe3321917ba9146b96aee8250ce3dd2
Author: Bikramjeet Vig <bi...@gmail.com>
AuthorDate: Wed Aug 5 16:31:08 2020 -0700
IMPALA-10052: Expose daemon health endpoint for statestore and catalog
This change exposes the daemon health of statestored and catalogd via
an HTTP endpoint '/healthz'. If the server is healthy, this endpoint
will return HTTP code 200 (OK). If it is unhealthy, it will return
503 (Service Unavailable). This is consistent with the endpoint added
for impalads in IMPALA-8895.
Testing:
- Extended test in test_web_pages.py
Change-Id: I7714734df8e50dabbbebcb77a86a5a00bd13bf7c
Reviewed-on: http://gerrit.cloudera.org:8080/16295
Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
Reviewed-on: http://gerrit.cloudera.org:8080/21261
Reviewed-by: Zihao Ye <ey...@163.com>
Tested-by: Quanlong Huang <hu...@gmail.com>
---
be/src/catalog/catalog-server.cc | 19 +++++++++++++++++++
be/src/catalog/catalog-server.h | 14 ++++++++++++++
be/src/catalog/catalogd-main.cc | 1 +
be/src/statestore/statestore.cc | 20 ++++++++++++++++++--
be/src/statestore/statestore.h | 10 ++++++++--
tests/webserver/test_web_pages.py | 6 ++++--
6 files changed, 64 insertions(+), 6 deletions(-)
diff --git a/be/src/catalog/catalog-server.cc b/be/src/catalog/catalog-server.cc
index ad140b86f..01173ca47 100644
--- a/be/src/catalog/catalog-server.cc
+++ b/be/src/catalog/catalog-server.cc
@@ -97,6 +97,7 @@ const string TABLE_METRICS_WEB_PAGE = "/table_metrics";
const string TABLE_METRICS_TEMPLATE = "table_metrics.tmpl";
const string EVENT_WEB_PAGE = "/events";
const string EVENT_METRICS_TEMPLATE = "events.tmpl";
+const string CATALOG_SERVICE_HEALTH_WEB_PAGE = "/healthz";
const int REFRESH_METRICS_INTERVAL_MS = 1000;
@@ -287,6 +288,11 @@ Status CatalogServer::Start() {
}
void CatalogServer::RegisterWebpages(Webserver* webserver) {
+ Webserver::RawUrlCallback healthz_callback =
+ [this](const auto& req, auto* data, auto* response) {
+ return this->HealthzHandler(req, data, response);
+ };
+ webserver->RegisterUrlCallback(CATALOG_SERVICE_HEALTH_WEB_PAGE, healthz_callback);
webserver->RegisterUrlCallback(CATALOG_WEB_PAGE, CATALOG_TEMPLATE,
[this](const auto& args, auto* doc) { this->CatalogUrlCallback(args, doc); }, true);
webserver->RegisterUrlCallback(CATALOG_OBJECT_WEB_PAGE, CATALOG_OBJECT_TEMPLATE,
@@ -740,3 +746,16 @@ bool CatalogServer::AddPendingTopicItem(std::string key, int64_t version,
Substitute(", compressed size=$0", item.value.size()) : string());
return true;
}
+
+void CatalogServer::MarkServiceAsStarted() { service_started_ = true; }
+
+void CatalogServer::HealthzHandler(
+ const Webserver::WebRequest& req, std::stringstream* data, HttpStatusCode* response) {
+ if (service_started_) {
+ (*data) << "OK";
+ *response = HttpStatusCode::Ok;
+ return;
+ }
+ *(data) << "Not Available";
+ *response = HttpStatusCode::ServiceUnavailable;
+}
diff --git a/be/src/catalog/catalog-server.h b/be/src/catalog/catalog-server.h
index dec22eaf3..5cb3a2f29 100644
--- a/be/src/catalog/catalog-server.h
+++ b/be/src/catalog/catalog-server.h
@@ -27,11 +27,14 @@
#include "gen-cpp/Frontend_types.h"
#include "gen-cpp/Types_types.h"
#include "catalog/catalog.h"
+#include "kudu/util/web_callback_registry.h"
#include "statestore/statestore-subscriber.h"
#include "util/condition-variable.h"
#include "util/metrics-fwd.h"
#include "rapidjson/rapidjson.h"
+using kudu::HttpStatusCode;
+
namespace impala {
class StatestoreSubscriber;
@@ -78,7 +81,14 @@ class CatalogServer {
bool AddPendingTopicItem(std::string key, int64_t version, const uint8_t* item_data,
uint32_t size, bool deleted);
+ /// Mark service as started. Should be called only after the thrift server hosting this
+ /// service has started.
+ void MarkServiceAsStarted();
+
private:
+ /// Indicates whether the catalog service is ready.
+ std::atomic_bool service_started_{false};
+
/// Thrift API implementation which proxies requests onto this CatalogService.
boost::shared_ptr<CatalogServiceIf> thrift_iface_;
ThriftSerializer thrift_serializer_;
@@ -236,6 +246,10 @@ class CatalogServer {
// metastore event processor metrics and adds it to the document
void EventMetricsUrlCallback(
const Webserver::WebRequest& req, rapidjson::Document* document);
+
+ /// Raw callback to indicate whether the service is ready.
+ void HealthzHandler(const Webserver::WebRequest& req, std::stringstream* data,
+ HttpStatusCode* response);
};
}
diff --git a/be/src/catalog/catalogd-main.cc b/be/src/catalog/catalogd-main.cc
index 847932642..5c2e8eb8c 100644
--- a/be/src/catalog/catalogd-main.cc
+++ b/be/src/catalog/catalogd-main.cc
@@ -107,6 +107,7 @@ int CatalogdMain(int argc, char** argv) {
}
ABORT_IF_ERROR(builder.metrics(metrics.get()).Build(&server));
ABORT_IF_ERROR(server->Start());
+ catalog_server.MarkServiceAsStarted();
LOG(INFO) << "CatalogService started on port: " << FLAGS_catalog_service_port;
server->Join();
diff --git a/be/src/statestore/statestore.cc b/be/src/statestore/statestore.cc
index 7df60b212..2c9e209f6 100644
--- a/be/src/statestore/statestore.cc
+++ b/be/src/statestore/statestore.cc
@@ -453,7 +453,7 @@ Statestore::Statestore(MetricGroup* metrics)
}
Statestore::~Statestore() {
- CHECK(initialized_) << "Cannot shutdown Statestore once initialized.";
+ CHECK(service_started_) << "Cannot shutdown Statestore once initialized and started.";
}
Status Statestore::Init(int32_t state_store_port) {
@@ -482,12 +482,17 @@ Status Statestore::Init(int32_t state_store_port) {
RETURN_IF_ERROR(subscriber_heartbeat_threadpool_.Init());
RETURN_IF_ERROR(Thread::Create("statestore-heartbeat", "heartbeat-monitoring-thread",
&Statestore::MonitorSubscriberHeartbeat, this, &heartbeat_monitoring_thread_));
- initialized_ = true;
+ service_started_ = true;
return Status::OK();
}
void Statestore::RegisterWebpages(Webserver* webserver) {
+ Webserver::RawUrlCallback healthz_callback =
+ [this](const auto& req, auto* data, auto* response) {
+ return this->HealthzHandler(req, data, response);
+ };
+ webserver->RegisterUrlCallback("/healthz", healthz_callback);
Webserver::UrlCallback topics_callback =
bind<void>(mem_fn(&Statestore::TopicsHandler), this, _1, _2);
webserver->RegisterUrlCallback("/topics", "statestore_topics.tmpl",
@@ -1075,3 +1080,14 @@ void Statestore::ShutdownForTesting() {
int64_t Statestore::FailedExecutorDetectionTimeMs() {
return FLAGS_statestore_max_missed_heartbeats * FLAGS_statestore_heartbeat_frequency_ms;
}
+
+void Statestore::HealthzHandler(
+ const Webserver::WebRequest& req, std::stringstream* data, HttpStatusCode* response) {
+ if (service_started_) {
+ (*data) << "OK";
+ *response = HttpStatusCode::Ok;
+ return;
+ }
+ *(data) << "Not Available";
+ *response = HttpStatusCode::ServiceUnavailable;
+}
diff --git a/be/src/statestore/statestore.h b/be/src/statestore/statestore.h
index a08d3388e..f6644eff4 100644
--- a/be/src/statestore/statestore.h
+++ b/be/src/statestore/statestore.h
@@ -44,6 +44,8 @@
#include "util/thread-pool.h"
#include "util/webserver.h"
+using kudu::HttpStatusCode;
+
namespace impala {
class Status;
@@ -565,8 +567,8 @@ class Statestore : public CacheLineAligned {
/// Thread that monitors the heartbeats of all subscribers.
std::unique_ptr<Thread> heartbeat_monitoring_thread_;
- /// Flag to indicate that the statestore has been initialized.
- bool initialized_ = false;
+ /// Indicates whether the statestore has been initialized and the service is ready.
+ std::atomic_bool service_started_{false};
/// Cache of subscriber clients used for UpdateState() RPCs. Only one client per
/// subscriber should be used, but the cache helps with the client lifecycle on failure.
@@ -722,6 +724,10 @@ class Statestore : public CacheLineAligned {
/// last_heartbeat_ts_ has not been updated in that interval, it logs the subscriber's
/// id.
[[noreturn]] void MonitorSubscriberHeartbeat();
+
+ /// Raw callback to indicate whether the service is ready.
+ void HealthzHandler(const Webserver::WebRequest& req, std::stringstream* data,
+ HttpStatusCode* response);
};
} // namespace impala
diff --git a/tests/webserver/test_web_pages.py b/tests/webserver/test_web_pages.py
index 07eaf9bf2..07388e468 100644
--- a/tests/webserver/test_web_pages.py
+++ b/tests/webserver/test_web_pages.py
@@ -50,6 +50,7 @@ class TestWebPage(ImpalaTestSuite):
RESET_RESOURCE_POOL_STATS_URL = "http://localhost:{0}/resource_pool_reset"
BACKENDS_URL = "http://localhost:{0}/backends"
PROMETHEUS_METRICS_URL = "http://localhost:{0}/metrics_prometheus"
+ HEALTHZ_URL = "http://localhost:{0}/healthz"
# log4j changes do not apply to the statestore since it doesn't
# have an embedded JVM. So we make two sets of ports to test the
@@ -729,8 +730,9 @@ class TestWebPage(ImpalaTestSuite):
def test_healthz_endpoint(self):
"""Test to check that the /healthz endpoint returns 200 OK."""
- page = requests.get("http://localhost:25000/healthz")
- assert page.status_code == requests.codes.ok
+ for port in self.TEST_PORTS_WITH_SS:
+ page = requests.get(self.HEALTHZ_URL.format(port))
+ assert page.status_code == requests.codes.ok
def test_knox_compatibility(self):
"""Checks that the template files conform to the requirements for compatibility with
(impala) 06/07: IMPALA-12362: (part-2/4) Optimize default configurations for packaging module.
Posted by st...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
stigahuang pushed a commit to branch branch-3.4.2
in repository https://gitbox.apache.org/repos/asf/impala.git
commit ff56cf9609a5c6c7bb4cc4187b208881a6299379
Author: Xiang Yang <yx...@126.com>
AuthorDate: Fri Jan 19 15:09:05 2024 +0000
IMPALA-12362: (part-2/4) Optimize default configurations for packaging module.
To avoid absolutely paths and keep it simple, optimize the default
configurations for packaging module by remove or change some entries.
At the same time, add license header to 'package/conf/*-site.xml' and
rename them to '*-site.xml.template' to force administrator making
configurations appropriate for their cluster.
Testing:
- Manually deploy packages on Ubuntu22.04 and verify it.
Change-Id: Ifda229b779a3d6fca647bb81fe23dd61ad7e5d66
Reviewed-on: http://gerrit.cloudera.org:8080/20928
Reviewed-by: Quanlong Huang <hu...@gmail.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
Reviewed-on: http://gerrit.cloudera.org:8080/21264
Reviewed-by: Xiang Yang <yx...@126.com>
Reviewed-by: Zihao Ye <ey...@163.com>
Tested-by: Quanlong Huang <hu...@gmail.com>
---
bin/rat_exclude_files.txt | 3 --
package/conf/catalogd_flags | 36 +++++++++++++-----
package/conf/core-site.xml | 20 ----------
package/conf/core-site.xml.template | 39 ++++++++++++++++++++
package/conf/fair-scheduler.xml | 6 ---
package/conf/fair-scheduler.xml.template | 26 +++++++++++++
.../conf/{hdfs-site.xml => hdfs-site.xml.template} | 19 ++++++++++
package/conf/hive-site.xml | 20 ----------
package/conf/hive-site.xml.template | 39 ++++++++++++++++++++
package/conf/impalad_flags | 43 ++++++++++++++++------
package/conf/llama-site.xml | 3 --
package/conf/llama-site.xml.template | 22 +++++++++++
package/conf/statestored_flags | 28 ++++++++++++--
13 files changed, 227 insertions(+), 77 deletions(-)
diff --git a/bin/rat_exclude_files.txt b/bin/rat_exclude_files.txt
index 07998a1a9..29851b628 100644
--- a/bin/rat_exclude_files.txt
+++ b/bin/rat_exclude_files.txt
@@ -212,6 +212,3 @@ docs/images/howto_show_histogram.png
docs/images/howto_static_server_pools_config.png
docs/images/impala_arch.jpeg
docs/images/support_send_diagnostic_data.png
-
-# Files of deployment configuration
-package/conf/*
diff --git a/package/conf/catalogd_flags b/package/conf/catalogd_flags
index bbbf580ae..4c435d99a 100644
--- a/package/conf/catalogd_flags
+++ b/package/conf/catalogd_flags
@@ -1,12 +1,30 @@
--hostname=localhost
--state_store_host=localhost
-#-kudu_master_hosts=localhost
+# 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.
+#
+# Specify flags for catalogd service.
--log_dir=/var/log/catalogd
--log_filename=catalogd
--state_store_port=24000
--minidump_path=/var/log/impala-minidumps
--catalog_topic_mode=minimal
--hms_event_polling_interval_s=0
+# -hostname=localhost
+# -state_store_host=localhost
+# -kudu_master_hosts=localhost
+# -log_dir=/var/log/impala
+# -minidump_path=/var/log/impala/minidumps
+# -catalog_topic_mode=minimal
+# -hms_event_polling_interval_s=0
-v=1
+-log_filename=catalogd
+-max_log_files=10
-max_log_size=200
diff --git a/package/conf/core-site.xml b/package/conf/core-site.xml
deleted file mode 100644
index 2303cdf5f..000000000
--- a/package/conf/core-site.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<configuration>
- <property>
- <name>fs.defaultFS</name>
- <value>hdfs://localhost:8020</value>
- </property>
- <property>
- <name>ipc.client.connection.maxidletime</name>
- <value>30000</value>
- </property>
- <property>
- <name>ipc.client.connect.max.retries</name>
- <value>50</value>
- </property>
- <property>
- <name>fs.trash.interval</name>
- <value>1</value>
- </property>
-</configuration>
diff --git a/package/conf/core-site.xml.template b/package/conf/core-site.xml.template
new file mode 100644
index 000000000..c1999d7ff
--- /dev/null
+++ b/package/conf/core-site.xml.template
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<configuration>
+ <property>
+ <name>fs.defaultFS</name>
+ <value>hdfs://localhost:8020</value>
+ </property>
+ <property>
+ <name>ipc.client.connection.maxidletime</name>
+ <value>30000</value>
+ </property>
+ <property>
+ <name>ipc.client.connect.max.retries</name>
+ <value>50</value>
+ </property>
+ <property>
+ <name>fs.trash.interval</name>
+ <value>1</value>
+ </property>
+</configuration>
diff --git a/package/conf/fair-scheduler.xml b/package/conf/fair-scheduler.xml
deleted file mode 100644
index 0edf7f080..000000000
--- a/package/conf/fair-scheduler.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<allocations>
- <queue name="root">
- <queue name="default"/>
- </queue>
-</allocations>
diff --git a/package/conf/fair-scheduler.xml.template b/package/conf/fair-scheduler.xml.template
new file mode 100644
index 000000000..44bf7e51f
--- /dev/null
+++ b/package/conf/fair-scheduler.xml.template
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<allocations>
+ <queue name="root">
+ <queue name="default"/>
+ </queue>
+</allocations>
diff --git a/package/conf/hdfs-site.xml b/package/conf/hdfs-site.xml.template
similarity index 57%
rename from package/conf/hdfs-site.xml
rename to package/conf/hdfs-site.xml.template
index 02468a478..efc814ba8 100644
--- a/package/conf/hdfs-site.xml
+++ b/package/conf/hdfs-site.xml.template
@@ -1,5 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+
<configuration>
<property>
<name>dfs.namenode.servicerpc-address</name>
diff --git a/package/conf/hive-site.xml b/package/conf/hive-site.xml
deleted file mode 100644
index ec614f2b5..000000000
--- a/package/conf/hive-site.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<configuration>
- <property>
- <name>hive.metastore.uris</name>
- <value>thrift://localhost:9083</value>
- </property>
- <property>
- <name>hive.support.concurrency</name>
- <value>true</value>
- </property>
- <property>
- <name>hive.metastore.client.socket.timeout</name>
- <value>3600</value>
- </property>
- <property>
- <name>hive.metastore.connect.retries</name>
- <value>5</value>
- </property>
-</configuration>
diff --git a/package/conf/hive-site.xml.template b/package/conf/hive-site.xml.template
new file mode 100644
index 000000000..6e3f7c9a7
--- /dev/null
+++ b/package/conf/hive-site.xml.template
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<configuration>
+ <property>
+ <name>hive.metastore.uris</name>
+ <value>thrift://localhost:9083</value>
+ </property>
+ <property>
+ <name>hive.support.concurrency</name>
+ <value>true</value>
+ </property>
+ <property>
+ <name>hive.metastore.client.socket.timeout</name>
+ <value>3600</value>
+ </property>
+ <property>
+ <name>hive.metastore.connect.retries</name>
+ <value>5</value>
+ </property>
+</configuration>
diff --git a/package/conf/impalad_flags b/package/conf/impalad_flags
index 6cd2a9d68..ff2b55e83 100644
--- a/package/conf/impalad_flags
+++ b/package/conf/impalad_flags
@@ -1,15 +1,34 @@
--hostname=localhost
--state_store_host=localhost
--catalog_service_host=localhost
-#-kudu_master_hosts=localhost
+# 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.
+#
+# Specify flags for impalad service.
--mem_limit=80%
--use_local_catalog=true
--log_dir=/var/log/impalad
--log_filename=impalad
--minidump_path=/var/log/impala-minidumps
--local_library_dir=/var/lib/impala/udfs
--fair_scheduler_allocation_path=/opt/impala/conf/fair-scheduler.xml
--llama_site_path=/opt/impala/conf/llama-site.xml
+# -hostname=localhost
+# -catalog_service_host=localhost
+# -state_store_host=localhost
+# -kudu_master_hosts=localhost
+# -log_dir=/var/log/impala
+# -minidump_path=/var/log/impala/minidumps
+# -local_library_dir=/var/lib/impala/udfs
+# -llama_site_path=/opt/impala/conf/llama-site.xml
+# -fair_scheduler_allocation_path=/opt/impala/conf/fair-scheduler.xml
+# -mem_limit=80%
+# -use_local_catalog=true
-v=1
+-log_filename=impalad
+-max_log_files=10
-max_log_size=200
diff --git a/package/conf/llama-site.xml b/package/conf/llama-site.xml
deleted file mode 100644
index fefdb93ca..000000000
--- a/package/conf/llama-site.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<configuration/>
diff --git a/package/conf/llama-site.xml.template b/package/conf/llama-site.xml.template
new file mode 100644
index 000000000..41e736eb1
--- /dev/null
+++ b/package/conf/llama-site.xml.template
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<configuration/>
diff --git a/package/conf/statestored_flags b/package/conf/statestored_flags
index 10b0e9870..7778e1fdf 100644
--- a/package/conf/statestored_flags
+++ b/package/conf/statestored_flags
@@ -1,6 +1,26 @@
--hostname=localhost
--log_dir=/var/log/statestore
--log_filename=statestored
--minidump_path=/var/log/impala-minidumps
+# 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.
+#
+# Specify flags for statestored.
+
+# -hostname=localhost
+# -log_dir=/var/log/impala
+# -minidump_path=/var/log/impala/minidumps
-v=1
+-log_filename=statestored
+-max_log_files=10
-max_log_size=200
(impala) 05/07: IMPALA-12362: (part-1/4) Refactor service management scripts.
Posted by st...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
stigahuang pushed a commit to branch branch-3.4.2
in repository https://gitbox.apache.org/repos/asf/impala.git
commit 63bc975e03aa61649760a1cb47eae80982ffb767
Author: Xiang Yang <yx...@126.com>
AuthorDate: Thu Jan 18 16:08:07 2024 +0000
IMPALA-12362: (part-1/4) Refactor service management scripts.
Uniform all service management scripts to 'bin/impala.sh', administrator
can customize environment variables based on their cluster at
'conf/impala-env.sh', as well as set flags at 'conf/impalad_flags...'.
Usually administrator can override the environment variables in
'conf/impala-env.sh' with commandline arguments. The same is true for
flags in 'conf/impalad_flags...'. This flexibility can be used in
scenarios such as supporting multi-instance deployments.
The directory structure has been adjusted as follows:
- put java libs to 'lib/jars' directory.
- put native libs to 'lib/native' directory.
- put impalad binary to 'sbin' directory.
Testing:
- Manually deploy packages on Ubuntu22.04 and verify it.
Backport Notes:
- Resolved trivial conflicts in CMakeLists.txt
Change-Id: I8f4dcad9cfa12d351d562e7ef8c0a8957d3ca147
Reviewed-on: http://gerrit.cloudera.org:8080/20921
Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
Reviewed-on: http://gerrit.cloudera.org:8080/21263
Reviewed-by: Xiang Yang <yx...@126.com>
Reviewed-by: Zihao Ye <ey...@163.com>
Tested-by: Quanlong Huang <hu...@gmail.com>
---
CMakeLists.txt | 12 +-
be/src/service/CMakeLists.txt | 6 +-
package/bin/impala-env.sh | 85 -------
package/bin/impala.sh | 271 +++++++++++++++++++++
package/bin/start-catalogd.sh | 38 ---
package/bin/start-impalad.sh | 49 ----
package/bin/stop-catalogd.sh | 23 --
package/bin/stop-impalad.sh | 23 --
package/bin/stop-statestored.sh | 23 --
package/conf/catalogd_flags | 1 -
.../start-statestored.sh => conf/impala-env.sh} | 36 +--
package/conf/impalad_flags | 1 -
.../conf/{statestore_flags => statestored_flags} | 1 -
13 files changed, 301 insertions(+), 268 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 69b5a64f2..5ad23838e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -421,23 +421,23 @@ add_subdirectory(query-event-hook-api)
install(DIRECTORY "www/" DESTINATION ${IMPALA_INSTALLDIR}/www)
install(FILES fe/target/impala-frontend-$ENV{IMPALA_VERSION}.jar
- DESTINATION ${IMPALA_INSTALLDIR}/jar)
+ DESTINATION ${IMPALA_INSTALLDIR}/lib/jars)
FILE(GLOB gcc_lib ${GCC_ROOT}/lib64/libgcc_s.so.1*)
-install(FILES ${gcc_lib} DESTINATION ${IMPALA_INSTALLDIR}/lib)
+install(FILES ${gcc_lib} DESTINATION ${IMPALA_INSTALLDIR}/lib/native)
FILE(GLOB cpp_lib ${GCC_ROOT}/lib64/libstdc++.so.6*)
-install(FILES ${cpp_lib} DESTINATION ${IMPALA_INSTALLDIR}/lib)
+install(FILES ${cpp_lib} DESTINATION ${IMPALA_INSTALLDIR}/lib/native)
set(KUDU_HOME $ENV{IMPALA_TOOLCHAIN}/kudu-$ENV{IMPALA_KUDU_VERSION}/release)
# The parent folder is lib64 on centos/redhat, while on ubuntu it's lib.
FILE(GLOB kudu_lib ${KUDU_HOME}/lib*/libkudu_client.so*)
-install(FILES ${kudu_lib} DESTINATION ${IMPALA_INSTALLDIR}/lib)
+install(FILES ${kudu_lib} DESTINATION ${IMPALA_INSTALLDIR}/lib/native)
FILE(GLOB hadoop_lib $ENV{HADOOP_LIB_DIR}/native/libhadoop.so*)
-install(FILES ${hadoop_lib} DESTINATION ${IMPALA_INSTALLDIR}/lib)
+install(FILES ${hadoop_lib} DESTINATION ${IMPALA_INSTALLDIR}/lib/native)
-install(DIRECTORY fe/target/dependency/ DESTINATION ${IMPALA_INSTALLDIR}/jar
+install(DIRECTORY fe/target/dependency/ DESTINATION ${IMPALA_INSTALLDIR}/lib/jars
FILES_MATCHING PATTERN "*.jar")
install(DIRECTORY shell/build/impala-shell-$ENV{IMPALA_VERSION}/
diff --git a/be/src/service/CMakeLists.txt b/be/src/service/CMakeLists.txt
index 844b6587c..fc2b80a48 100644
--- a/be/src/service/CMakeLists.txt
+++ b/be/src/service/CMakeLists.txt
@@ -95,9 +95,9 @@ target_link_libraries(impalad
${IMPALA_LINK_LIBS}
)
-install(FILES ${STATESTORED_SYMLINK} DESTINATION ${IMPALA_INSTALLDIR}/bin)
-install(FILES ${CATALOGD_SYMLINK} DESTINATION ${IMPALA_INSTALLDIR}/bin)
-install(TARGETS impalad DESTINATION ${IMPALA_INSTALLDIR}/bin)
+install(FILES ${STATESTORED_SYMLINK} DESTINATION ${IMPALA_INSTALLDIR}/sbin)
+install(FILES ${CATALOGD_SYMLINK} DESTINATION ${IMPALA_INSTALLDIR}/sbin)
+install(TARGETS impalad DESTINATION ${IMPALA_INSTALLDIR}/sbin)
if (BUILD_WITH_NO_TESTS)
return()
diff --git a/package/bin/impala-env.sh b/package/bin/impala-env.sh
deleted file mode 100644
index 3655ac6cf..000000000
--- a/package/bin/impala-env.sh
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/bin/bash
-#
-# 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.
-
-if [[ -z "$JAVA_HOME" ]]; then
- echo "JAVA_HOME not set!"
- exit 1
-fi
-
-echo "Using JAVA_HOME: $JAVA_HOME"
-LIB_JVM_DIR=$(dirname $(find $JAVA_HOME -type f -name libjvm.so))
-LIB_JSIG_DIR=$(dirname $(find $JAVA_HOME -type f -name libjsig.so))
-
-export LC_ALL=en_US.utf8
-export LD_LIBRARY_PATH="/opt/impala/lib/:$LIB_JVM_DIR:$LIB_JSIG_DIR"
-export CLASSPATH="/opt/impala/conf:/opt/impala/jar/*"
-
-#TODO: Add graceful shutdown for impalads
-function stop_process {
- name=$1
- pid_file="/tmp/${name}.pid"
- if [[ -f $pid_file ]]; then
- PID=$(cat $pid_file)
- if ps $PID | grep $name; then
- echo "Killing $name with PID=$PID"
- kill $PID
- rm $pid_file
- echo "Killed $name"
- else
- rm $pid_file
- echo "Already stopped: $name is not running with PID=$PID. Removed stale $pid_file"
- fi
- else
- echo "PID file $pid_file not found!"
- fi
-}
-
-function wait_for_ready {
- name=$1
- port=$2
- pid=$3
-
- NUM_WAIT_ITERATIONS=20
- i=0
- while [[ $i -lt $NUM_WAIT_ITERATIONS ]]; do
- if ! ps $pid | grep $name > /dev/null 2>&1; then
- echo "$name with PID $pid doesn't exist"
- break
- fi
- STATUS=$(curl -s http://localhost:$port/healthz)
- if [[ $? != 0 ]]; then
- echo "Waiting for $name. Port $port not ready."
- elif [[ "$STATUS" != "OK" ]]; then
- echo "Waiting for $name to be ready"
- else
- echo "$name is ready"
- break
- fi
- sleep 2
- i=$((i+1))
- done
- if [[ "$STATUS" == "OK" ]]; then
- echo "Launched $name with PID $pid"
- elif [[ $i -eq $NUM_WAIT_ITERATIONS ]]; then
- echo "Timed out waiting for $name to be ready. Check logs for more details."
- else
- echo "Failed to launch $name"
- exit 1
- fi
-}
diff --git a/package/bin/impala.sh b/package/bin/impala.sh
new file mode 100755
index 000000000..f480f5c24
--- /dev/null
+++ b/package/bin/impala.sh
@@ -0,0 +1,271 @@
+#!/bin/bash
+#
+# 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.
+#
+# Script to manage Apache Impala services.
+# User can customize environment variables in '../conf/impala-env.sh'.
+# User can customize flags in '../conf/[impalad_flags...]', or override them in
+# commandline arguments when needed(e.g. multiple instance).
+#
+# To launch impalad using another username (e.g. "impala"):
+# sudo -E -u impala bin/impala.sh start impalad
+#
+# Note for setup:
+# Please set the correct JAVA_HOME in '../conf/impala-env.sh'.
+# Please set the correct hostnames in '../conf/[impalad_flags...]'.
+# Please modify core-site.xml, hdfs-site.xml, hive-site.xml in conf based on the cluster.
+set -euo pipefail
+
+init() {
+ : ${IMPALA_HOME:=$(cd $(dirname ${0})/..;pwd)}
+ export IMPALA_HOME
+ . ${IMPALA_HOME}/conf/impala-env.sh
+}
+
+check_counts() {
+ local counts=${1} period=${2}
+ [[ ${counts} =~ ^[0-9]+$ ]] || (echo "Invalid waiting counts:${counts}." && exit 1)
+ [[ ${period} =~ ^[1-9][0-9]*$ ]] || (echo "Invalid waiting period:${period}." && exit 1)
+}
+
+# Return 0 if service is running, else otherwise.
+status() {
+ local service=
+ while [[ $# -gt 0 ]]; do
+ case ${1} in
+ impalad|catalogd|statestored) service=${1} && shift && break ;;
+ *) usage && exit 1 ;;
+ esac
+ done
+ local service_pidfile_key=${service^^}_PIDFILE
+ local service_pidfile=${!service_pidfile_key}
+ if [[ ! -f ${service_pidfile} ]]; then
+ echo "${service} is stopped."
+ return 1
+ fi
+ local pid=$(cat ${service_pidfile})
+ if ps -p ${pid} -o comm=|grep ${service} &> /dev/null ; then
+ echo "${service} is running with PID ${pid}."
+ return 0
+ fi
+ echo "${service} is stopped."
+ return 1
+}
+
+# Return 0 if service is stopped in expected time, else otherwise.
+stop_await() {
+ local service=${1} service_pidfile=${2} counts=${3} period=${4}
+ [[ "${counts}" == "0" ]] && exit 0
+ for ((i=1; i<=${counts}; i++)); do
+ [[ ${i} -gt 1 ]] && sleep ${period}
+ if ! kill -0 ${pid} &> /dev/null; then
+ rm ${service_pidfile} && echo "(${i}/${counts}) ${service} is stopped." && return 0
+ else
+ echo "(${i}/${counts}) Waiting ${service} to stop."
+ fi
+ done
+ return 1
+}
+
+#TODO: Add graceful shutdown for impalads
+stop() {
+ local service= counts=20 period=2
+ while [[ $# -gt 0 ]]; do
+ case ${1} in
+ -c) counts=${2} && shift 2 ;;
+ -p) period=${2} && shift 2 ;;
+ impalad|catalogd|statestored) service=${1} && shift && break ;;
+ *) usage && exit 1 ;;
+ esac
+ done
+ check_counts ${counts} ${period}
+ local service_pidfile_key=${service^^}_PIDFILE
+ local service_pidfile=${!service_pidfile_key}
+ if [[ ! -f ${service_pidfile} ]]; then
+ echo "Already stopped: PID file '${service_pidfile}' not found."
+ exit 0
+ fi
+ local pid=$(cat ${service_pidfile})
+ if ! ps -p ${pid} -o comm=|grep ${service} &> /dev/null ; then
+ rm ${service_pidfile}
+ echo "Already stopped: ${service} is not running with PID ${pid}." \
+ "Removed stale file '${service_pidfile}'."
+ exit 0
+ fi
+ echo "Killing ${service} with PID ${pid}."
+ kill ${pid}
+ if ! stop_await ${service} ${service_pidfile} ${counts} ${period}; then
+ echo "Timed out waiting ${service} to stop, check logs for more details."
+ exit 1
+ fi
+}
+
+prerun() {
+ local message=${1:-"on"}
+ : ${JAVA_HOME:?"JAVA_HOME must be set to the location of your JDK!"}
+ if [[ ${message} == "on" ]]; then
+ echo "Using JAVA_HOME: ${JAVA_HOME}"
+ fi
+ local lib_jvm_dir=$(dirname $(find ${JAVA_HOME} -type f -name libjvm.so | head -1))
+ local lib_jsig_dir=$(dirname $(find ${JAVA_HOME} -type f -name libjsig.so | head -1))
+ if [[ -n "${HADOOP_HOME:=}" ]]; then
+ : ${HADOOP_LIB_DIR:=${HADOOP_HOME}/lib/native}
+ if [[ ${message} == "on" ]]; then
+ echo "Using hadoop native libs in '${HADOOP_LIB_DIR}'"
+ fi
+ else
+ : ${HADOOP_LIB_DIR:=${IMPALA_HOME}/lib/native}
+ if [[ ${message} == "on" ]]; then
+ echo "HADOOP_HOME not set, using hadoop native libs in '${HADOOP_LIB_DIR}'"
+ fi
+ fi
+ export LIBHDFS_OPTS="${LIBHDFS_OPTS:=} -Djava.library.path=${HADOOP_LIB_DIR}"
+ export LC_ALL=en_US.utf8
+ export CLASSPATH="${CLASSPATH}:${IMPALA_HOME}/conf:${IMPALA_HOME}/lib/jars/*"
+ export LD_LIBRARY_PATH+=":${IMPALA_HOME}/lib/native:${lib_jvm_dir}:${lib_jsig_dir}"
+}
+
+start() {
+ prerun
+ local service= counts=20 period=2
+ while [[ $# -gt 0 ]]; do
+ case ${1} in
+ -c) counts=${2} && shift 2 ;;
+ -p) period=${2} && shift 2 ;;
+ impalad|catalogd|statestored) service=${1} && shift && break ;;
+ *) usage && exit 1 ;;
+ esac
+ done
+ check_counts ${counts} ${period}
+ status ${service} && exit 0
+ local service_flagfile=${IMPALA_HOME}/conf/${service}_flags
+ local service_pidfile_key=${service^^}_PIDFILE
+ local service_pidfile=${!service_pidfile_key}
+ mkdir -p $(dirname ${service_pidfile})
+ # User can override '--flagfile' in the following commandline arguments.
+ ${IMPALA_HOME}/sbin/${service} \
+ --flagfile=${service_flagfile} \
+ ${@} &
+ local pid=$!
+ echo ${pid} > ${service_pidfile}
+ # Sleep 1s so the glog output won't be messed up with waiting messages.
+ sleep 1
+ health -c ${counts} -p ${period} ${service}
+}
+
+restart() {
+ stop ${@} && start ${@}
+}
+
+health() {
+ local service= counts=20 period=2
+ while [[ $# -gt 0 ]]; do
+ case ${1} in
+ -c) counts=${2} && shift 2 ;;
+ -p) period=${2} && shift 2 ;;
+ impalad|catalogd|statestored) service=${1} && shift ;;
+ *) usage && exit 1 ;;
+ esac
+ done
+ check_counts ${counts} ${period}
+ [[ "${counts}" == "0" ]] && exit 0
+ status ${service} || exit 1
+ # Determine Web Server port
+ local service_flagfile=${IMPALA_HOME}/conf/${service}_flags
+ local service_pidfile_key=${service^^}_PIDFILE
+ local service_pidfile=${!service_pidfile_key}
+ local pid=$(cat ${service_pidfile})
+ local port=
+ if [[ $(ps --cols 10000 -o args= -p ${pid}) =~ -webserver_port=([0-9]+) ]]; then
+ port=${BASH_REMATCH[1]}
+ else
+ port=$(awk -F= '/-webserver_port=/ {print $2;}' ${service_flagfile})
+ fi
+ if [[ -z "${port}" ]]; then
+ case ${service} in
+ impalad) port=25000;;
+ catalogd) port=25020;;
+ statestored) port=25010;;
+ esac
+ fi
+ # Request healthz code
+ for ((i=1; i<=${counts}; i++)); do
+ [[ ${i} -gt 1 ]] && sleep ${period} || true
+ local code=$(curl -s http://localhost:${port}/healthz)
+ if [[ $? != 0 ]]; then
+ echo "(${i}/${counts}) ${service} on port ${port} is not ready."
+ elif [[ "${code}" != "OK" ]]; then
+ echo "(${i}/${counts}) Waiting for ${service} to be ready."
+ else
+ echo "(${i}/${counts}) ${service} is ready."
+ exit 0
+ fi
+ done
+ echo "Timed out waiting for ${service} to be ready, check logs for more details."
+ exit 1
+}
+
+usage() {
+ echo "Usage: $0 <command> [<options>] <service> [<flags>]"
+ echo " $0 --version"
+ echo " $0 --help"
+ echo " command: {start|stop|restart|status|health}"
+ echo " service: {impalad|catalogd|statestored}"
+ echo " flags: in pattern '-key=val...'."
+ echo
+ echo " start: start an Impala daemon service, wait until service is ready."
+ echo " options:"
+ echo " -c: maximum count of checks, defaults to 20."
+ echo " -p: seconds of period between checks, defaults to 2."
+ echo
+ echo " stop: stop an Impala daemon service, wait until service is stopped."
+ echo " options:"
+ echo " -c: maximum count of checks, defaults to 20."
+ echo " -p: seconds of period between checks, defaults to 2."
+ echo
+ echo " restart: restart an Impala daemon service."
+ echo " options: same as start command."
+ echo
+ echo " status: check the process status of an Impala daemon service."
+ echo
+ echo " health: waiting until an Impala daemon service is ready."
+ echo " options:"
+ echo " -c: maximum count of checks, defaults to 20."
+ echo " -p: seconds of period between checks, defaults to 2."
+}
+
+version() {
+ if init &> /dev/null && prerun off && ${IMPALA_HOME}/sbin/impalad --version ; then
+ exit 0
+ fi
+ echo "Failed to get version!"
+ exit 1
+}
+
+main() {
+ [[ $# -ge 1 && ${1} == "--help" ]] && usage && exit 0
+ [[ $# -ge 1 && ${1} == "--version" ]] && version && exit 0
+ [[ $# -lt 2 ]] && usage && exit 1
+ local command=${1}
+ case ${command} in
+ start|stop|restart|status|health) shift && init && ${command} $@ ;;
+ *) usage && exit 1 ;;
+ esac
+}
+
+main ${@}
diff --git a/package/bin/start-catalogd.sh b/package/bin/start-catalogd.sh
deleted file mode 100755
index 9b472fe60..000000000
--- a/package/bin/start-catalogd.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-# Script to launch catalogd. Required JAVA_HOME being set.
-# Edit conf/catalogd_flags to set the correct hostname and state_store_host.
-# Edit core-site.xml, hdfs-site.xml, hive-site.xml, etc. in conf based on the cluster.
-# Example usage:
-# export JAVA_HOME=/usr/java/jdk1.8.0_232-cloudera
-# bin/start-catalogd.sh
-# To launch catalogd using another username (e.g. "impala"):
-# sudo -E -u impala bin/start-catalogd.sh
-
-echo "Using IMPALA_HOME: ${IMPALA_HOME:=/opt/impala}"
-source $IMPALA_HOME/bin/impala-env.sh
-$IMPALA_HOME/bin/catalogd --flagfile=$IMPALA_HOME/conf/catalogd_flags &
-PID=$!
-echo $PID > /tmp/catalogd.pid
-
-# Sleep 1s so the glog output won't be messed up with waiting messages
-sleep 1
-
-wait_for_ready catalogd 25020 $PID
diff --git a/package/bin/start-impalad.sh b/package/bin/start-impalad.sh
deleted file mode 100755
index 89ccbbd21..000000000
--- a/package/bin/start-impalad.sh
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-# Script to launch impalad. Required JAVA_HOME being set.
-# Edit conf/impalad_flags to set the correct hostnames.
-# Edit core-site.xml, hdfs-site.xml, hive-site.xml, etc. in conf based on the cluster.
-# Example usage:
-# export JAVA_HOME=/usr/java/jdk1.8.0_232-cloudera
-# bin/start-impalad.sh
-# To launch impalad using another username (e.g. "impala"):
-# sudo -E -u impala bin/start-impalad.sh
-
-echo "Using IMPALA_HOME: ${IMPALA_HOME:=/opt/impala}"
-source $IMPALA_HOME/bin/impala-env.sh
-
-if [[ -n "$HADOOP_HOME" ]]; then
- echo "Using HADOOP_HOME: $HADOOP_HOME"
- export HADOOP_LIB_DIR="${HADOOP_HOME}/lib"
- export LIBHDFS_OPTS="${LIBHDFS_OPTS:-} -Djava.library.path=${HADOOP_LIB_DIR}/native/"
- echo "Using hadoop native libs in ${HADOOP_LIB_DIR}/native/"
-else
- export LIBHDFS_OPTS="${LIBHDFS_OPTS:-} -Djava.library.path=${IMPALA_HOME}/lib"
- echo "HADOOP_HOME not set. Using hadoop native libs in ${IMPALA_HOME}/lib"
-fi
-
-$IMPALA_HOME/bin/impalad --flagfile=$IMPALA_HOME/conf/impalad_flags &
-PID=$!
-echo $PID > /tmp/impalad.pid
-
-# Sleep 1s so the glog output won't be messed up with waiting messages
-sleep 1
-
-wait_for_ready impalad 25000 $PID
diff --git a/package/bin/stop-catalogd.sh b/package/bin/stop-catalogd.sh
deleted file mode 100755
index 8649ed143..000000000
--- a/package/bin/stop-catalogd.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-#
-# 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.
-
-echo "Using IMPALA_HOME: ${IMPALA_HOME:=/opt/impala}"
-source $IMPALA_HOME/bin/impala-env.sh
-
-stop_process catalogd
diff --git a/package/bin/stop-impalad.sh b/package/bin/stop-impalad.sh
deleted file mode 100755
index 4e323e889..000000000
--- a/package/bin/stop-impalad.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-#
-# 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.
-
-echo "Using IMPALA_HOME: ${IMPALA_HOME:=/opt/impala}"
-source $IMPALA_HOME/bin/impala-env.sh
-
-stop_process impalad
diff --git a/package/bin/stop-statestored.sh b/package/bin/stop-statestored.sh
deleted file mode 100755
index e5aa9578d..000000000
--- a/package/bin/stop-statestored.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-#
-# 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.
-
-echo "Using IMPALA_HOME: ${IMPALA_HOME:=/opt/impala}"
-source $IMPALA_HOME/bin/impala-env.sh
-
-stop_process statestored
diff --git a/package/conf/catalogd_flags b/package/conf/catalogd_flags
index 7b94816a2..bbbf580ae 100644
--- a/package/conf/catalogd_flags
+++ b/package/conf/catalogd_flags
@@ -6,7 +6,6 @@
-log_filename=catalogd
-state_store_port=24000
-minidump_path=/var/log/impala-minidumps
--webserver_doc_root=/opt/impala
-catalog_topic_mode=minimal
-hms_event_polling_interval_s=0
-v=1
diff --git a/package/bin/start-statestored.sh b/package/conf/impala-env.sh
old mode 100755
new mode 100644
similarity index 50%
rename from package/bin/start-statestored.sh
rename to package/conf/impala-env.sh
index e3c78cd34..c5bb78de6
--- a/package/bin/start-statestored.sh
+++ b/package/conf/impala-env.sh
@@ -17,21 +17,27 @@
# specific language governing permissions and limitations
# under the License.
#
-# Script to launch statestore. Required JAVA_HOME being set.
-# Edit conf/statestore_flags to set a correct hostname.
-# Example usage:
-# export JAVA_HOME=/usr/java/jdk1.8.0_232-cloudera
-# bin/start-statestored.sh
-# To launch statestore using another username (e.g. "impala"):
-# sudo -E -u impala bin/start-statestored.sh
+# Specify default value for user-specific environment variables.
+# It's recommended to use a form that can be overridden from the command line, like
+# ': ${FOO:="bar"}', or 'export FOO=${FOO:-"bar"}' when the variable need to be exported.
-echo "Using IMPALA_HOME: ${IMPALA_HOME:=/opt/impala}"
-source $IMPALA_HOME/bin/impala-env.sh
-$IMPALA_HOME/bin/statestored --flagfile=$IMPALA_HOME/conf/statestore_flags &
-PID=$!
-echo $PID > /tmp/statestored.pid
+# Uncomment and modify next line to specify a valid JDK location.
+# : ${JAVA_HOME:="/usr/lib/jvm/java"}
-# Sleep 1s so the glog output won't be messed up with waiting messages
-sleep 1
+# Specify extra CLASSPATH.
+: ${CLASSPATH:=}
-wait_for_ready statestored 25010 $PID
+# Specify extra LD_LIBRARY_PATH.
+: ${LD_LIBRARY_PATH:=}
+
+# Uncomment next line to enable coredump.
+# ulimit -c unlimited
+
+# Specify JVM options.
+export JAVA_TOOL_OPTIONS=${JAVA_TOOL_OPTIONS:-}
+
+# Specify default pidfile directories.
+: ${IMPALAD_PIDFILE:="/tmp/impalad.pid"}
+: ${CATALOGD_PIDFILE:="/tmp/catalogd.pid"}
+: ${ADMISSIOND_PIDFILE:="/tmp/admissiond.pid"}
+: ${STATESTORED_PIDFILE:="/tmp/statestored.pid"}
diff --git a/package/conf/impalad_flags b/package/conf/impalad_flags
index 4c2dc3a92..6cd2a9d68 100644
--- a/package/conf/impalad_flags
+++ b/package/conf/impalad_flags
@@ -11,6 +11,5 @@
-local_library_dir=/var/lib/impala/udfs
-fair_scheduler_allocation_path=/opt/impala/conf/fair-scheduler.xml
-llama_site_path=/opt/impala/conf/llama-site.xml
--webserver_doc_root=/opt/impala
-v=1
-max_log_size=200
diff --git a/package/conf/statestore_flags b/package/conf/statestored_flags
similarity index 81%
rename from package/conf/statestore_flags
rename to package/conf/statestored_flags
index 9e53d3a70..10b0e9870 100644
--- a/package/conf/statestore_flags
+++ b/package/conf/statestored_flags
@@ -2,6 +2,5 @@
-log_dir=/var/log/statestore
-log_filename=statestored
-minidump_path=/var/log/impala-minidumps
--webserver_doc_root=/opt/impala
-v=1
-max_log_size=200
(impala) 01/07: IMPALA-10262: (Addendum) fix incorrect paths of shared libs in building the package
Posted by st...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
stigahuang pushed a commit to branch branch-3.4.2
in repository https://gitbox.apache.org/repos/asf/impala.git
commit 483dc98305873f014fc7e6c345ede6c065280c73
Author: stiga-huang <hu...@gmail.com>
AuthorDate: Mon Apr 8 20:36:52 2024 +0800
IMPALA-10262: (Addendum) fix incorrect paths of shared libs in building the package
This fixes the wrong paths for adding shared libs to the package due to
env var IMPALA_TOOLCHAIN_PACKAGES_HOME doesn't exist in the 3.4.x
branch.
Change-Id: I6469364a87441acdc7c70a8997bcaa21d720dde7
Reviewed-on: http://gerrit.cloudera.org:8080/21259
Reviewed-by: Zihao Ye <ey...@163.com>
Tested-by: Quanlong Huang <hu...@gmail.com>
---
CMakeLists.txt | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6828e5f04..69b5a64f2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -423,14 +423,13 @@ install(DIRECTORY "www/" DESTINATION ${IMPALA_INSTALLDIR}/www)
install(FILES fe/target/impala-frontend-$ENV{IMPALA_VERSION}.jar
DESTINATION ${IMPALA_INSTALLDIR}/jar)
-set(IMPALA_GCC_HOME $ENV{IMPALA_TOOLCHAIN_PACKAGES_HOME}/gcc-$ENV{IMPALA_GCC_VERSION})
-FILE(GLOB gcc_lib ${IMPALA_GCC_HOME}/lib64/libgcc_s.so.1*)
+FILE(GLOB gcc_lib ${GCC_ROOT}/lib64/libgcc_s.so.1*)
install(FILES ${gcc_lib} DESTINATION ${IMPALA_INSTALLDIR}/lib)
-FILE(GLOB cpp_lib ${IMPALA_GCC_HOME}/lib64/libstdc++.so.6*)
+FILE(GLOB cpp_lib ${GCC_ROOT}/lib64/libstdc++.so.6*)
install(FILES ${cpp_lib} DESTINATION ${IMPALA_INSTALLDIR}/lib)
-set(KUDU_HOME $ENV{IMPALA_TOOLCHAIN_PACKAGES_HOME}/kudu-$ENV{IMPALA_KUDU_VERSION}/release)
+set(KUDU_HOME $ENV{IMPALA_TOOLCHAIN}/kudu-$ENV{IMPALA_KUDU_VERSION}/release)
# The parent folder is lib64 on centos/redhat, while on ubuntu it's lib.
FILE(GLOB kudu_lib ${KUDU_HOME}/lib*/libkudu_client.so*)
install(FILES ${kudu_lib} DESTINATION ${IMPALA_INSTALLDIR}/lib)
(impala) 07/07: IMPALA-12979: Avoid using wildcard in CLASSPATH
Posted by st...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
stigahuang pushed a commit to branch branch-3.4.2
in repository https://gitbox.apache.org/repos/asf/impala.git
commit 3df9c0f139b9b3d0eba0cba9f5ea5a190bd14030
Author: stiga-huang <hu...@gmail.com>
AuthorDate: Tue Apr 9 11:44:00 2024 +0800
IMPALA-12979: Avoid using wildcard in CLASSPATH
Wildcard (*) in the classpath might not be resolved correctly. To be
robust, this patch modifies the script to list jars deployed by the
package and add them one by one to the CLASSPATH.
Tests:
- Verified on CentOS 7.9
Change-Id: Ib77d13684dbb6ed0ef8315fbc65fa6ef18ead120
Reviewed-on: http://gerrit.cloudera.org:8080/21265
Reviewed-by: Zihao Ye <ey...@163.com>
Reviewed-by: Xiang Yang <yx...@126.com>
Tested-by: Quanlong Huang <hu...@gmail.com>
---
package/bin/impala.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/package/bin/impala.sh b/package/bin/impala.sh
index f480f5c24..d4eb1be19 100755
--- a/package/bin/impala.sh
+++ b/package/bin/impala.sh
@@ -136,7 +136,11 @@ prerun() {
fi
export LIBHDFS_OPTS="${LIBHDFS_OPTS:=} -Djava.library.path=${HADOOP_LIB_DIR}"
export LC_ALL=en_US.utf8
- export CLASSPATH="${CLASSPATH}:${IMPALA_HOME}/conf:${IMPALA_HOME}/lib/jars/*"
+ CLASSPATH="${CLASSPATH}:${IMPALA_HOME}/conf"
+ for jar in ${IMPALA_HOME}/lib/jars/*; do
+ CLASSPATH="${CLASSPATH}:$jar"
+ done
+ export CLASSPATH
export LD_LIBRARY_PATH+=":${IMPALA_HOME}/lib/native:${lib_jvm_dir}:${lib_jsig_dir}"
}
(impala) 04/07: IMPALA-12288: Add BUILD_WITH_NO_TESTS option to remove test targets
Posted by st...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
stigahuang pushed a commit to branch branch-3.4.2
in repository https://gitbox.apache.org/repos/asf/impala.git
commit 3fe856f8cdb344f47f9c1eaea1a48d86dbc0605c
Author: zhangyifan27 <ch...@163.com>
AuthorDate: Fri Jul 21 20:22:27 2023 +0800
IMPALA-12288: Add BUILD_WITH_NO_TESTS option to remove test targets
This patch adds a new option 'BUILD_WITH_NO_TESTS' to tell CMake not
to generate test targets. In order to be consistent with the previous
test workflow, this option is only set ON when building impala using
the 'buildall.sh' script with '-notest' and '-package' flags. This
is useful for a packaging build which do not need to build all test
binaries.
Testing:
- Ran 'buildall.sh -release -package' with and without '-notests'
flag and verified generated executables.
Backport notes: resolved conflicts in following files
- be/src/codegen/CMakeLists.txt
- be/src/exec/parquet/CMakeLists.txt
- be/src/testutil/CMakeLists.txt
- be/src/util/CMakeLists.txt
Change-Id: I575ce76176c9f6a05fd2db0f420ebe6926d0272a
Reviewed-on: http://gerrit.cloudera.org:8080/20294
Reviewed-by: Michael Smith <mi...@cloudera.com>
Reviewed-by: Quanlong Huang <hu...@gmail.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
Reviewed-on: http://gerrit.cloudera.org:8080/21262
Reviewed-by: Yifan Zhang <ch...@163.com>
Tested-by: Quanlong Huang <hu...@gmail.com>
---
be/CMakeLists.txt | 53 +++++++++++++++++++-------------
be/src/benchmarks/CMakeLists.txt | 3 ++
be/src/catalog/CMakeLists.txt | 4 +++
be/src/codegen/CMakeLists.txt | 14 ++++++---
be/src/common/CMakeLists.txt | 22 +++++++------
be/src/exec/CMakeLists.txt | 4 +++
be/src/exec/parquet/CMakeLists.txt | 4 +++
be/src/experiments/CMakeLists.txt | 4 +++
be/src/exprs/CMakeLists.txt | 4 +++
be/src/gutil/CMakeLists.txt | 4 +++
be/src/rpc/CMakeLists.txt | 7 +++++
be/src/runtime/CMakeLists.txt | 4 +++
be/src/runtime/bufferpool/CMakeLists.txt | 4 +++
be/src/runtime/io/CMakeLists.txt | 4 +++
be/src/scheduling/CMakeLists.txt | 4 +++
be/src/service/CMakeLists.txt | 32 ++++++++++---------
be/src/statestore/CMakeLists.txt | 4 +++
be/src/testutil/CMakeLists.txt | 4 +++
be/src/udf/CMakeLists.txt | 4 +++
be/src/udf_samples/CMakeLists.txt | 4 +++
be/src/util/CMakeLists.txt | 34 +++++++++++---------
be/src/util/cache/CMakeLists.txt | 4 +++
buildall.sh | 3 ++
23 files changed, 163 insertions(+), 65 deletions(-)
diff --git a/be/CMakeLists.txt b/be/CMakeLists.txt
index c7bd31a63..ebaabeb0d 100644
--- a/be/CMakeLists.txt
+++ b/be/CMakeLists.txt
@@ -28,6 +28,8 @@ enable_testing()
# to CMakeFiles/<currentdir>.dir/<srcfile>.s
PROJECT(ASSEMBLER)
+option(BUILD_WITH_NO_TESTS "Do not generate test and benchmark targets" OFF)
+
# compiler flags that are common across debug/release builds
# -Wall: Enable all warnings.
# -Wno-sign-compare: suppress warnings for comparison between signed and unsigned
@@ -414,7 +416,6 @@ set (IMPALA_LIBS
security
Service
Statestore
- TestUtil
ThriftSaslTransport
token_proto
Udf
@@ -422,6 +423,10 @@ set (IMPALA_LIBS
UtilCache
)
+if (NOT BUILD_WITH_NO_TESTS)
+ set(IMPALA_LIBS ${IMPALA_LIBS} TestUtil)
+endif()
+
set (IMPALA_LINK_LIBS
${WL_START_GROUP}
${IMPALA_LIBS}
@@ -584,17 +589,19 @@ endif()
set(LLVM_IR_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/llvm-ir")
file(MAKE_DIRECTORY ${LLVM_IR_OUTPUT_DIRECTORY})
-# Add custom target to only build the backend tests
-# Note: this specifies "ALL" so it builds if running "make" with no arguments. This is
-# necessary due to the non-executable targets (i.e. generating backend test scripts)
-# that run for the unified backend tests.
-add_custom_target(be-test ALL)
+if (NOT BUILD_WITH_NO_TESTS)
+ # Add custom target to only build the backend tests
+ # Note: this specifies "ALL" so it builds if running "make" with no arguments. This is
+ # necessary due to the non-executable targets (i.e. generating backend test scripts)
+ # that run for the unified backend tests.
+ add_custom_target(be-test ALL)
-# Add custom target to build unified backend tests
-add_custom_target(unified-be-test)
+ # Add custom target to build unified backend tests
+ add_custom_target(unified-be-test)
-# Add custom target to build the unified backend test executable
-add_custom_target(unified-be-test-executable)
+ # Add custom target to build the unified backend test executable
+ add_custom_target(unified-be-test-executable)
+endif()
# Variable to use to aggregate all of the filter patterns, joined by ":"
set_property(GLOBAL PROPERTY AGG_UNIFIED_FILTER_PATTERN)
@@ -735,18 +742,20 @@ link_directories(
${CMAKE_CURRENT_SOURCE_DIR}/build/transport
)
-# Add custom target to validate the unified backend test executable and test match
-# patterns. At this point, all filter patterns have been aggregated from the individual
-# ADD_UNIFIED_BE_TEST calls into AGG_UNIFIED_FILTER_PATTERN.
-get_property(TOTAL_UNIFIED_FILTER_PATTERN GLOBAL PROPERTY AGG_UNIFIED_FILTER_PATTERN)
-add_custom_target(unified-be-test-validated-executable
- "${CMAKE_CURRENT_SOURCE_DIR}/../bin/validate-unified-backend-test-filters.py"
- "-f" "${TOTAL_UNIFIED_FILTER_PATTERN}"
- "-b" "${BUILD_OUTPUT_ROOT_DIRECTORY}/service/unifiedbetests")
-
-ADD_DEPENDENCIES(be-test unified-be-test)
-ADD_DEPENDENCIES(unified-be-test unified-be-test-validated-executable)
-ADD_DEPENDENCIES(unified-be-test-validated-executable unified-be-test-executable)
+if (NOT BUILD_WITH_NO_TESTS)
+ # Add custom target to validate the unified backend test executable and test match
+ # patterns. At this point, all filter patterns have been aggregated from the individual
+ # ADD_UNIFIED_BE_TEST calls into AGG_UNIFIED_FILTER_PATTERN.
+ get_property(TOTAL_UNIFIED_FILTER_PATTERN GLOBAL PROPERTY AGG_UNIFIED_FILTER_PATTERN)
+ add_custom_target(unified-be-test-validated-executable
+ "${CMAKE_CURRENT_SOURCE_DIR}/../bin/validate-unified-backend-test-filters.py"
+ "-f" "${TOTAL_UNIFIED_FILTER_PATTERN}"
+ "-b" "${BUILD_OUTPUT_ROOT_DIRECTORY}/service/unifiedbetests")
+
+ ADD_DEPENDENCIES(be-test unified-be-test)
+ ADD_DEPENDENCIES(unified-be-test unified-be-test-validated-executable)
+ ADD_DEPENDENCIES(unified-be-test-validated-executable unified-be-test-executable)
+endif()
# only generate statically linked libs and executables
set(BUILD_SHARED_LIBS OFF)
diff --git a/be/src/benchmarks/CMakeLists.txt b/be/src/benchmarks/CMakeLists.txt
index c09e71e9b..9381dc6fa 100644
--- a/be/src/benchmarks/CMakeLists.txt
+++ b/be/src/benchmarks/CMakeLists.txt
@@ -15,6 +15,9 @@
# specific language governing permissions and limitations
# under the License.
+if (BUILD_WITH_NO_TESTS)
+ return()
+endif()
# where to put generated libraries
set(LIBRARY_OUTPUT_PATH "${BUILD_OUTPUT_ROOT_DIRECTORY}/benchmarks")
diff --git a/be/src/catalog/CMakeLists.txt b/be/src/catalog/CMakeLists.txt
index 89fd96d26..273a82487 100644
--- a/be/src/catalog/CMakeLists.txt
+++ b/be/src/catalog/CMakeLists.txt
@@ -26,6 +26,10 @@ add_library(Catalog
)
add_dependencies(Catalog gen-deps)
+if (BUILD_WITH_NO_TESTS)
+ return()
+endif()
+
add_library(CatalogTests STATIC
catalog-util-test.cc
)
diff --git a/be/src/codegen/CMakeLists.txt b/be/src/codegen/CMakeLists.txt
index 0cf5ff594..16a9f9f7f 100644
--- a/be/src/codegen/CMakeLists.txt
+++ b/be/src/codegen/CMakeLists.txt
@@ -38,11 +38,6 @@ add_library(CodeGen
)
add_dependencies(CodeGen gen-deps gen_ir_descriptions)
-add_library(CodeGenTests STATIC
- instruction-counter-test.cc
-)
-add_dependencies(CodeGenTests gen-deps)
-
# output cross compile to ir metadata
set(IR_DESC_GEN_OUTPUT
$ENV{IMPALA_HOME}/be/generated-sources/impala-ir/impala-ir-names.h
@@ -106,6 +101,15 @@ add_custom_command(
DEPENDS ${IR_NO_SSE_OUTPUT_FILE}
)
+if (BUILD_WITH_NO_TESTS)
+ return()
+endif()
+
+add_library(CodeGenTests STATIC
+ instruction-counter-test.cc
+)
+add_dependencies(CodeGenTests gen-deps)
+
# Run the clang compiler to generate BC for llvm-codegen-test
add_custom_target(test-loop.bc
COMMAND ${LLVM_CLANG_EXECUTABLE} ${CLANG_IR_CXX_FLAGS} ${CLANG_INCLUDE_FLAGS} ${CMAKE_SOURCE_DIR}/testdata/llvm/test-loop.cc -o ${CMAKE_SOURCE_DIR}/llvm-ir/test-loop.bc
diff --git a/be/src/common/CMakeLists.txt b/be/src/common/CMakeLists.txt
index d2f30d139..70115cf75 100644
--- a/be/src/common/CMakeLists.txt
+++ b/be/src/common/CMakeLists.txt
@@ -37,12 +37,6 @@ add_library(Common
)
add_dependencies(Common gen-deps)
-add_library(CommonTests STATIC
- atomic-test.cc
- thread-debug-info-test.cc
-)
-add_dependencies(CommonTests gen-deps)
-
# Command to generate the build version file if not present. We don't automatically
# regenerate the file if present, which speeds up incremental builds but can lead
# to the version being stale.
@@ -58,9 +52,19 @@ add_library(GlobalFlags
)
add_dependencies(GlobalFlags gen-deps)
-ADD_UNIFIED_BE_LSAN_TEST(atomic-test AtomicTest.*)
-ADD_UNIFIED_BE_LSAN_TEST(thread-debug-info-test ThreadDebugInfo.*)
-
# Generate config.h from config.h.in, filling in variables from CMake
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h)
+
+if (BUILD_WITH_NO_TESTS)
+ return()
+endif()
+
+add_library(CommonTests STATIC
+ atomic-test.cc
+ thread-debug-info-test.cc
+)
+add_dependencies(CommonTests gen-deps)
+
+ADD_UNIFIED_BE_LSAN_TEST(atomic-test AtomicTest.*)
+ADD_UNIFIED_BE_LSAN_TEST(thread-debug-info-test ThreadDebugInfo.*)
diff --git a/be/src/exec/CMakeLists.txt b/be/src/exec/CMakeLists.txt
index c4440c1ba..2371c8e42 100644
--- a/be/src/exec/CMakeLists.txt
+++ b/be/src/exec/CMakeLists.txt
@@ -108,6 +108,10 @@ add_library(Exec
add_dependencies(Exec gen-deps)
+if (BUILD_WITH_NO_TESTS)
+ return()
+endif()
+
add_library(ExecTests STATIC
delimited-text-parser-test.cc
hash-table-test.cc
diff --git a/be/src/exec/parquet/CMakeLists.txt b/be/src/exec/parquet/CMakeLists.txt
index 7b18a26f1..e7b58c7a2 100644
--- a/be/src/exec/parquet/CMakeLists.txt
+++ b/be/src/exec/parquet/CMakeLists.txt
@@ -40,6 +40,10 @@ add_library(Parquet
add_dependencies(Parquet gen-deps)
+if (BUILD_WITH_NO_TESTS)
+ return()
+endif()
+
add_library(ParquetTests STATIC
hdfs-parquet-scanner-test.cc
parquet-bool-decoder-test.cc
diff --git a/be/src/experiments/CMakeLists.txt b/be/src/experiments/CMakeLists.txt
index a50798caa..f544025d4 100644
--- a/be/src/experiments/CMakeLists.txt
+++ b/be/src/experiments/CMakeLists.txt
@@ -26,6 +26,10 @@ add_library(Experiments
)
add_dependencies(Experiments gen-deps)
+if (BUILD_WITH_NO_TESTS)
+ return()
+endif()
+
add_executable(data-provider-test data-provider-test.cc)
add_executable(tuple-splitter-test tuple-splitter-test.cc)
add_executable(hash-partition-test hash-partition-test.cc)
diff --git a/be/src/exprs/CMakeLists.txt b/be/src/exprs/CMakeLists.txt
index b80d77c84..0efb1cdc6 100644
--- a/be/src/exprs/CMakeLists.txt
+++ b/be/src/exprs/CMakeLists.txt
@@ -71,6 +71,10 @@ add_library(Exprs
)
add_dependencies(Exprs gen-deps gen_ir_descriptions)
+if (BUILD_WITH_NO_TESTS)
+ return()
+endif()
+
add_library(ExprsTests STATIC
expr-test.cc
timezone_db-test.cc
diff --git a/be/src/gutil/CMakeLists.txt b/be/src/gutil/CMakeLists.txt
index 444ef809c..d5ac48b6d 100644
--- a/be/src/gutil/CMakeLists.txt
+++ b/be/src/gutil/CMakeLists.txt
@@ -70,6 +70,10 @@ ADD_EXPORTABLE_LIBRARY(gutil
# Disable warnings which trigger a lot in the Google code:
COMPILE_FLAGS "-funsigned-char -Wno-deprecated -Wno-char-subscripts")
+if (BUILD_WITH_NO_TESTS)
+ return()
+endif()
+
add_kudu_test(strings/string_util-test)
add_library(GUtilTests STATIC
diff --git a/be/src/rpc/CMakeLists.txt b/be/src/rpc/CMakeLists.txt
index ffd4481ab..851048b50 100644
--- a/be/src/rpc/CMakeLists.txt
+++ b/be/src/rpc/CMakeLists.txt
@@ -40,6 +40,13 @@ add_library(Rpc
)
add_dependencies(Rpc gen-deps)
+if (BUILD_WITH_NO_TESTS)
+ # thrift-util.cc uses the EXPECT_NO_THROW macro, explicitly linking gtest library
+ # to avoid linker errors.
+ target_link_libraries(Rpc gtest)
+ return()
+endif()
+
add_library(RpcTests STATIC
thrift-util-test.cc
)
diff --git a/be/src/runtime/CMakeLists.txt b/be/src/runtime/CMakeLists.txt
index 585b291fa..d03c608dd 100644
--- a/be/src/runtime/CMakeLists.txt
+++ b/be/src/runtime/CMakeLists.txt
@@ -87,6 +87,10 @@ add_library(Runtime
)
add_dependencies(Runtime gen-deps)
+if (BUILD_WITH_NO_TESTS)
+ return()
+endif()
+
add_library(RuntimeTests STATIC
coordinator-backend-state-test.cc
date-test.cc
diff --git a/be/src/runtime/bufferpool/CMakeLists.txt b/be/src/runtime/bufferpool/CMakeLists.txt
index e20640e2d..be8130205 100644
--- a/be/src/runtime/bufferpool/CMakeLists.txt
+++ b/be/src/runtime/bufferpool/CMakeLists.txt
@@ -31,6 +31,10 @@ add_library(BufferPool
)
add_dependencies(BufferPool gen-deps)
+if (BUILD_WITH_NO_TESTS)
+ return()
+endif()
+
add_library(BufferPoolTests STATIC
free-list-test.cc
suballocator-test.cc
diff --git a/be/src/runtime/io/CMakeLists.txt b/be/src/runtime/io/CMakeLists.txt
index 239d90112..eff0df1d2 100644
--- a/be/src/runtime/io/CMakeLists.txt
+++ b/be/src/runtime/io/CMakeLists.txt
@@ -41,6 +41,10 @@ add_library(IoTests STATIC
)
add_dependencies(IoTests gen-deps)
+if (BUILD_WITH_NO_TESTS)
+ return()
+endif()
+
# This test runs forever so should not be part of 'make test'
add_executable(disk-io-mgr-stress-test disk-io-mgr-stress-test.cc)
target_link_libraries(disk-io-mgr-stress-test ${IMPALA_TEST_LINK_LIBS})
diff --git a/be/src/scheduling/CMakeLists.txt b/be/src/scheduling/CMakeLists.txt
index 0b5aa74d3..42d2ac647 100644
--- a/be/src/scheduling/CMakeLists.txt
+++ b/be/src/scheduling/CMakeLists.txt
@@ -37,6 +37,10 @@ add_library(Scheduling STATIC
)
add_dependencies(Scheduling gen-deps)
+if (BUILD_WITH_NO_TESTS)
+ return()
+endif()
+
add_library(SchedulingTests STATIC
admission-controller-test.cc
cluster-membership-mgr-test.cc
diff --git a/be/src/service/CMakeLists.txt b/be/src/service/CMakeLists.txt
index 9371cbc80..844b6587c 100644
--- a/be/src/service/CMakeLists.txt
+++ b/be/src/service/CMakeLists.txt
@@ -47,13 +47,6 @@ add_library(Service
)
add_dependencies(Service gen-deps)
-add_library(ServiceTests STATIC
- hs2-util-test.cc
- impala-server-test.cc
- query-options-test.cc
-)
-add_dependencies(ServiceTests gen-deps)
-
# this shared library provides Impala executor functionality to FE test.
add_library(fesupport SHARED
fe-support.cc
@@ -74,10 +67,6 @@ add_executable(impalad
daemon-main.cc
)
-add_executable(unifiedbetests
- unified-betest-main.cc
-)
-
# All Impala daemons run from the same binary. The code that is run is determined by the
# name (i.e. argv[0]) of the command that executes the binary, so we create symlinks for
# statestored and catalogd. The symlinks are relative so they can be installed along with
@@ -106,13 +95,28 @@ target_link_libraries(impalad
${IMPALA_LINK_LIBS}
)
+install(FILES ${STATESTORED_SYMLINK} DESTINATION ${IMPALA_INSTALLDIR}/bin)
+install(FILES ${CATALOGD_SYMLINK} DESTINATION ${IMPALA_INSTALLDIR}/bin)
+install(TARGETS impalad DESTINATION ${IMPALA_INSTALLDIR}/bin)
+
+if (BUILD_WITH_NO_TESTS)
+ return()
+endif()
+
+add_executable(unifiedbetests
+ unified-betest-main.cc
+)
+
target_link_libraries(unifiedbetests
${JAVA_JSIG_LIBRARY} ${UNIFIED_TEST_LINK_LIBS})
ADD_DEPENDENCIES(unified-be-test-executable unifiedbetests)
-install(FILES ${STATESTORED_SYMLINK} DESTINATION ${IMPALA_INSTALLDIR}/bin)
-install(FILES ${CATALOGD_SYMLINK} DESTINATION ${IMPALA_INSTALLDIR}/bin)
-install(TARGETS impalad DESTINATION ${IMPALA_INSTALLDIR}/bin)
+add_library(ServiceTests STATIC
+ hs2-util-test.cc
+ impala-server-test.cc
+ query-options-test.cc
+)
+add_dependencies(ServiceTests gen-deps)
# Exception to unified be tests: Custom main() due to leak
ADD_BE_TEST(session-expiry-test session-expiry-test.cc) # TODO: this leaks thrift server
diff --git a/be/src/statestore/CMakeLists.txt b/be/src/statestore/CMakeLists.txt
index a2bc4c040..799d88a5c 100644
--- a/be/src/statestore/CMakeLists.txt
+++ b/be/src/statestore/CMakeLists.txt
@@ -30,4 +30,8 @@ add_library(Statestore
)
add_dependencies(Statestore gen-deps)
+if (BUILD_WITH_NO_TESTS)
+ return()
+endif()
+
ADD_BE_LSAN_TEST(statestore-test)
diff --git a/be/src/testutil/CMakeLists.txt b/be/src/testutil/CMakeLists.txt
index 17885fa71..4aee7be7e 100644
--- a/be/src/testutil/CMakeLists.txt
+++ b/be/src/testutil/CMakeLists.txt
@@ -18,6 +18,10 @@
cmake_minimum_required(VERSION 2.6)
+if (BUILD_WITH_NO_TESTS)
+ return()
+endif()
+
# where to put generated libraries
set(LIBRARY_OUTPUT_PATH "${BUILD_OUTPUT_ROOT_DIRECTORY}/testutil")
diff --git a/be/src/udf/CMakeLists.txt b/be/src/udf/CMakeLists.txt
index 0470716a8..d9ad7ecfa 100644
--- a/be/src/udf/CMakeLists.txt
+++ b/be/src/udf/CMakeLists.txt
@@ -32,5 +32,9 @@ add_library(ImpalaUdf udf.cc udf-ir.cc udf-test-harness.cc)
add_dependencies(ImpalaUdf gen-deps)
set_target_properties(ImpalaUdf PROPERTIES COMPILE_FLAGS "-DIMPALA_UDF_SDK_BUILD")
+if (BUILD_WITH_NO_TESTS)
+ return()
+endif()
+
ADD_UDF_TEST(udf-test)
ADD_UDF_TEST(uda-test)
diff --git a/be/src/udf_samples/CMakeLists.txt b/be/src/udf_samples/CMakeLists.txt
index e4aaf8d26..4f0751a51 100644
--- a/be/src/udf_samples/CMakeLists.txt
+++ b/be/src/udf_samples/CMakeLists.txt
@@ -54,6 +54,10 @@ add_dependencies(udf-sample-ir gen-deps)
COMPILE_TO_IR(uda-sample.cc )
add_dependencies(uda-sample-ir gen-deps)
+if (BUILD_WITH_NO_TESTS)
+ return()
+endif()
+
# This is an example of how to use the test harness to help develop UDF and UDAs.
add_executable(udf-sample-test udf-sample-test.cc)
target_link_libraries(udf-sample-test ImpalaUdf udfsample)
diff --git a/be/src/util/CMakeLists.txt b/be/src/util/CMakeLists.txt
index c8cd73566..1b8c41d5b 100644
--- a/be/src/util/CMakeLists.txt
+++ b/be/src/util/CMakeLists.txt
@@ -104,6 +104,25 @@ add_library(Util
${MPFIT_SRC_DIR}/mpfit.c)
add_dependencies(Util gen-deps gen_ir_descriptions)
+# Squeasel requires C99 compatibility to build.
+SET_SOURCE_FILES_PROPERTIES(${SQUEASEL_SRC_DIR}/squeasel.c
+ PROPERTIES COMPILE_FLAGS -std=c99)
+
+# shared library which provides native logging support to JVMs over JNI.
+add_library(loggingsupport SHARED
+ logging-support.cc
+)
+
+add_executable(parquet-reader parquet-reader.cc)
+
+target_link_libraries(parquet-reader ${IMPALA_LINK_LIBS})
+
+target_link_libraries(loggingsupport ${IMPALA_LINK_LIBS_DYNAMIC_TARGETS})
+
+if (BUILD_WITH_NO_TESTS)
+ return()
+endif()
+
add_library(UtilTests STATIC
benchmark-test.cc
bitmap-test.cc
@@ -149,21 +168,6 @@ add_library(UtilTests STATIC
)
add_dependencies(UtilTests gen-deps gen_ir_descriptions)
-# Squeasel requires C99 compatibility to build.
-SET_SOURCE_FILES_PROPERTIES(${SQUEASEL_SRC_DIR}/squeasel.c
- PROPERTIES COMPILE_FLAGS -std=c99)
-
-# shared library which provides native logging support to JVMs over JNI.
-add_library(loggingsupport SHARED
- logging-support.cc
-)
-
-add_executable(parquet-reader parquet-reader.cc)
-
-target_link_libraries(parquet-reader ${IMPALA_LINK_LIBS})
-
-target_link_libraries(loggingsupport ${IMPALA_LINK_LIBS_DYNAMIC_TARGETS})
-
ADD_UNIFIED_BE_LSAN_TEST(benchmark-test "BenchmarkTest.*")
ADD_UNIFIED_BE_LSAN_TEST(bitmap-test "Bitmap.*")
ADD_UNIFIED_BE_LSAN_TEST(bit-packing-test "BitPackingTest.*")
diff --git a/be/src/util/cache/CMakeLists.txt b/be/src/util/cache/CMakeLists.txt
index cb3595c04..8809ac683 100644
--- a/be/src/util/cache/CMakeLists.txt
+++ b/be/src/util/cache/CMakeLists.txt
@@ -26,6 +26,10 @@ add_library(UtilCache
)
add_dependencies(UtilCache gen-deps gen_ir_descriptions)
+if (BUILD_WITH_NO_TESTS)
+ return()
+endif()
+
add_library(UtilCacheTests STATIC
cache-test.cc
)
diff --git a/buildall.sh b/buildall.sh
index 0f5d03101..5cb180e3a 100755
--- a/buildall.sh
+++ b/buildall.sh
@@ -454,6 +454,9 @@ generate_cmake_files() {
if [[ $BUILD_SHARED_LIBS -eq 1 ]]; then
CMAKE_ARGS+=(-DBUILD_SHARED_LIBS=ON)
fi
+ if [[ "$BUILD_TESTS" -eq 0 && "$GEN_PACKAGE" -eq 1 ]]; then
+ CMAKE_ARGS+=(-DBUILD_WITH_NO_TESTS=ON)
+ fi
if [[ "${MAKE_CMD}" = "ninja" ]]; then
CMAKE_ARGS+=(-GNinja)
fi