You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
errorcode check + shell formatting applied
This commit is contained in:
committed by
Leonid Fedorov
parent
7c27d803ba
commit
4b17d1aa02
@ -21,22 +21,19 @@ BUILD_TYPE_OPTIONS=("Debug" "RelWithDebInfo")
|
||||
DISTRO_OPTIONS=("ubuntu:20.04" "ubuntu:22.04" "ubuntu:24.04" "debian:11" "debian:12" "rockylinux:8" "rockylinux:9")
|
||||
|
||||
GCC_VERSION="11"
|
||||
BUILD_DELAY_SECONDS="${BUILD_DELAY_SECONDS:-1s}"
|
||||
BUILD_DIR="verylongdirnameforverystrangecpackbehavior"
|
||||
MDB_CMAKE_FLAGS=""
|
||||
|
||||
source $SCRIPT_LOCATION/utils.sh
|
||||
|
||||
|
||||
if [ "$EUID" -ne 0 ]
|
||||
then error "Please run script as root to install MariaDb to system paths"
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
error "Please run script as root to install MariaDb to system paths"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Arguments received: $@"
|
||||
message "Building Mariadb Server from $color_yellow$MDB_SOURCE_PATH$color_normal"
|
||||
|
||||
|
||||
optparse.define short=t long=build-type desc="Build Type: ${BUILD_TYPE_OPTIONS[*]}" variable=MCS_BUILD_TYPE
|
||||
optparse.define short=d long=distro desc="Choose your OS: ${DISTRO_OPTIONS[*]}" variable=OS
|
||||
optparse.define short=D long=install-deps desc="Install dependences" variable=INSTALL_DEPS default=false value=true
|
||||
@ -87,15 +84,13 @@ if [[ $pkg_format = "deb" ]]; then
|
||||
CONFIG_DIR=$DEB_CONFIG_DIR
|
||||
fi
|
||||
|
||||
disable_git_restore_frozen_revision()
|
||||
{
|
||||
disable_git_restore_frozen_revision() {
|
||||
cd $MDB_SOURCE_PATH
|
||||
git config submodule.storage/columnstore/columnstore.update none
|
||||
cd - >/dev/null
|
||||
}
|
||||
|
||||
select_branch()
|
||||
{
|
||||
select_branch() {
|
||||
cd $SCRIPT_LOCATION
|
||||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
BRANCHES=($(git branch --list --no-color | grep "[^* ]+" -Eo))
|
||||
@ -117,8 +112,7 @@ select_branch()
|
||||
message "Columnstore will be built from $color_yellow$CURRENT_BRANCH$color_cyan branch"
|
||||
}
|
||||
|
||||
install_deps()
|
||||
{
|
||||
install_deps() {
|
||||
message_split
|
||||
|
||||
RPM_BUILD_DEPS="dnf install -y lz4 lz4-devel systemd-devel git make libaio-devel openssl-devel boost-devel bison \
|
||||
@ -153,8 +147,7 @@ install_deps()
|
||||
eval "$command"
|
||||
}
|
||||
|
||||
stop_service()
|
||||
{
|
||||
stop_service() {
|
||||
message_split
|
||||
message "Stopping MariaDB services"
|
||||
systemctl stop mariadb
|
||||
@ -162,8 +155,7 @@ stop_service()
|
||||
systemctl stop mcs-storagemanager
|
||||
}
|
||||
|
||||
check_service()
|
||||
{
|
||||
check_service() {
|
||||
if systemctl is-active --quiet $1; then
|
||||
message "$1 $color_normal[$color_green OK $color_normal]"
|
||||
else
|
||||
@ -172,8 +164,7 @@ check_service()
|
||||
fi
|
||||
}
|
||||
|
||||
start_service()
|
||||
{
|
||||
start_service() {
|
||||
message_split
|
||||
message "Starting MariaDB services"
|
||||
systemctl start mariadb-columnstore
|
||||
@ -189,10 +180,9 @@ start_service()
|
||||
check_service mcs-writeengineserver
|
||||
}
|
||||
|
||||
start_storage_manager_if_needed()
|
||||
{
|
||||
start_storage_manager_if_needed() {
|
||||
if [[ $CLOUD_STORAGE_ENABLED = true ]]; then
|
||||
export MCS_USE_S3_STORAGE=1;
|
||||
export MCS_USE_S3_STORAGE=1
|
||||
message_split
|
||||
message "Starting Storage Manager service"
|
||||
systemctl start mcs-storagemanager
|
||||
@ -200,8 +190,7 @@ start_storage_manager_if_needed()
|
||||
fi
|
||||
}
|
||||
|
||||
clean_old_installation()
|
||||
{
|
||||
clean_old_installation() {
|
||||
message_split
|
||||
message "Cleaning old installation"
|
||||
rm -rf /var/lib/columnstore/data1/*
|
||||
@ -260,15 +249,13 @@ modify_packaging() {
|
||||
sed -i 's/--fail-missing/--list-missing/' debian/rules
|
||||
|
||||
# Tweak debian packaging stuff
|
||||
for i in mariadb-plugin libmariadbd;
|
||||
do
|
||||
for i in mariadb-plugin libmariadbd; do
|
||||
sed -i "/Package: $i.*/,/^$/d" debian/control
|
||||
done
|
||||
|
||||
sed -i 's/Depends: galera.*/Depends:/' debian/control
|
||||
|
||||
for i in galera wsrep ha_sphinx embedded;
|
||||
do
|
||||
for i in galera wsrep ha_sphinx embedded; do
|
||||
sed -i "/$i/d" debian/*.install
|
||||
done
|
||||
fi
|
||||
@ -369,7 +356,6 @@ construct_cmake_flags(){
|
||||
message "Buiding without microbenchmarks"
|
||||
fi
|
||||
|
||||
|
||||
if [[ "$OS" == *"rocky"* ]]; then
|
||||
OS_VERSION=${OS//[^0-9]/}
|
||||
MDB_CMAKE_FLAGS="${MDB_CMAKE_FLAGS} -DRPM=rockylinux${OS_VERSION}"
|
||||
@ -409,25 +395,37 @@ init_submodules(){
|
||||
fi
|
||||
}
|
||||
|
||||
check_errorcode() {
|
||||
if [ $? -ne 0 ]; then
|
||||
message_split
|
||||
error "!!!! BUILD FAILED !!!!"
|
||||
message_split
|
||||
exit 1
|
||||
fi
|
||||
cd - >/dev/null
|
||||
}
|
||||
|
||||
build_package() {
|
||||
modify_packaging
|
||||
RESULT_DIR=$(echo "$OS" | sed 's/://g' | sed 's/\//-/g')
|
||||
mkdir $RESULT_DIR
|
||||
|
||||
if [[ $pkg_format == "rpm" ]]; then
|
||||
command="cmake ${MDB_CMAKE_FLAGS} && sleep ${BUILD_DELAY_SECONDS} && make -j\$(nproc) package"
|
||||
command="cmake ${MDB_CMAKE_FLAGS} && make -j\$(nproc) package"
|
||||
else
|
||||
command="mk-build-deps debian/control -t 'apt-get -y -o Debug::pkgProblemResolver=yes --no-install-recommends' -r -i && \
|
||||
sleep ${BUILD_DELAY_SECONDS} && CMAKEFLAGS='${MDB_CMAKE_FLAGS}' debian/autobake-deb.sh"
|
||||
CMAKEFLAGS='${MDB_CMAKE_FLAGS}' debian/autobake-deb.sh"
|
||||
fi
|
||||
|
||||
echo "Building a package for $OS"
|
||||
echo "Build command: $command"
|
||||
eval "$command"
|
||||
|
||||
check_errorcode
|
||||
|
||||
}
|
||||
|
||||
build_binary()
|
||||
{
|
||||
build_binary() {
|
||||
MARIA_BUILD_PATH=$(realpath $MARIA_BUILD_PATH)
|
||||
message_split
|
||||
message "Building sources in $color_yellow$MCS_BUILD_TYPE$color_cyan mode"
|
||||
@ -446,21 +444,14 @@ build_binary()
|
||||
${CMAKE_BIN_NAME} $MDB_CMAKE_FLAGS -S$MDB_SOURCE_PATH -B$MARIA_BUILD_PATH | spinner
|
||||
message_split
|
||||
|
||||
${CMAKE_BIN_NAME} --build $MARIA_BUILD_PATH -j $CPUS | onelinearizator && \
|
||||
${CMAKE_BIN_NAME} --build $MARIA_BUILD_PATH -j $CPUS | onelinearizator &&
|
||||
message "Installing silently" &&
|
||||
${CMAKE_BIN_NAME} --install $MARIA_BUILD_PATH | spinner 30
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
message_split
|
||||
error "!!!! BUILD FAILED !!!!"
|
||||
message_split
|
||||
exit 1
|
||||
fi
|
||||
cd - > /dev/null
|
||||
check_errorcode
|
||||
}
|
||||
|
||||
check_user_and_group()
|
||||
{
|
||||
check_user_and_group() {
|
||||
user=$1
|
||||
if [ -z "$(grep $user /etc/passwd)" ]; then
|
||||
message "Adding user $user into /etc/passwd"
|
||||
@ -468,14 +459,13 @@ check_user_and_group()
|
||||
fi
|
||||
|
||||
if [ -z "$(grep $user /etc/group)" ]; then
|
||||
GroupID = `awk -F: '{uid[$3]=1}END{for(x=100; x<=999; x++) {if(uid[x] != ""){}else{print x; exit;}}}' /etc/group`
|
||||
GroupID = $(awk -F: '{uid[$3]=1}END{for(x=100; x<=999; x++) {if(uid[x] != ""){}else{print x; exit;}}}' /etc/group)
|
||||
message "Adding group $user with id $GroupID"
|
||||
groupadd -g $GroupID $user
|
||||
fi
|
||||
}
|
||||
|
||||
run_unit_tests()
|
||||
{
|
||||
run_unit_tests() {
|
||||
message_split
|
||||
if [[ $SKIP_UNIT_TESTS = true ]]; then
|
||||
warn "Skipping unittests"
|
||||
@ -487,8 +477,7 @@ run_unit_tests()
|
||||
fi
|
||||
}
|
||||
|
||||
run_microbenchmarks_tests()
|
||||
{
|
||||
run_microbenchmarks_tests() {
|
||||
message_split
|
||||
if [[ $RUN_BENCHMARKS = false ]]; then
|
||||
warn "Skipping microbenchmarks"
|
||||
@ -500,20 +489,17 @@ run_microbenchmarks_tests()
|
||||
fi
|
||||
}
|
||||
|
||||
disable_plugins_for_bootstrap()
|
||||
{
|
||||
disable_plugins_for_bootstrap() {
|
||||
find /etc -type f -exec sed -i 's/plugin-load-add=auth_gssapi.so//g' {} +
|
||||
find /etc -type f -exec sed -i 's/plugin-load-add=ha_columnstore.so//g' {} +
|
||||
}
|
||||
|
||||
enable_columnstore_back()
|
||||
{
|
||||
enable_columnstore_back() {
|
||||
echo plugin-load-add=ha_columnstore.so >>$CONFIG_DIR/columnstore.cnf
|
||||
sed -i '/\[mysqld\]/a\plugin-load-add=ha_columnstore.so' $CONFIG_DIR/columnstore.cnf
|
||||
}
|
||||
|
||||
fix_config_files()
|
||||
{
|
||||
fix_config_files() {
|
||||
message Fixing config files
|
||||
|
||||
THREAD_STACK_SIZE="20M"
|
||||
@ -561,14 +547,12 @@ fix_config_files()
|
||||
fi
|
||||
}
|
||||
|
||||
make_dir()
|
||||
{
|
||||
make_dir() {
|
||||
mkdir -p $1
|
||||
chown mysql:mysql $1
|
||||
}
|
||||
|
||||
install()
|
||||
{
|
||||
install() {
|
||||
if [[ $RECOMPILE_ONLY = false ]]; then
|
||||
message_split
|
||||
message "Installing MariaDB"
|
||||
@ -580,7 +564,6 @@ install()
|
||||
check_user_and_group mysql
|
||||
check_user_and_group syslog
|
||||
|
||||
|
||||
make_dir $CONFIG_DIR
|
||||
|
||||
echo "[client-server]
|
||||
@ -648,15 +631,13 @@ install()
|
||||
chmod 777 /var/log/mariadb/columnstore
|
||||
}
|
||||
|
||||
|
||||
smoke()
|
||||
{
|
||||
smoke() {
|
||||
if [[ $SKIP_SMOKE = false ]]; then
|
||||
message_split
|
||||
message "Creating test database"
|
||||
mariadb -e "create database if not exists test;"
|
||||
message "Selecting magic numbers"
|
||||
MAGIC=`mysql -N test < $MDB_SOURCE_PATH/storage/columnstore/columnstore/tests/scripts/smoke.sql`
|
||||
MAGIC=$(mysql -N test <$MDB_SOURCE_PATH/storage/columnstore/columnstore/tests/scripts/smoke.sql)
|
||||
if [[ $MAGIC == '42' ]]; then
|
||||
message "Great answer correct!"
|
||||
else
|
||||
@ -665,14 +646,12 @@ smoke()
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
generate_svgs()
|
||||
{
|
||||
generate_svgs() {
|
||||
if [[ $DRAW_DEPS = true ]]; then
|
||||
message_split
|
||||
warn "Generating svgs with dependency graph to $REPORT_PATH"
|
||||
for f in $MDB_SOURCE_PATH/mariadb.dot.*;
|
||||
do dot -Tsvg -o $REPORT_PATH/`basename $f`.svg $f;
|
||||
for f in $MDB_SOURCE_PATH/mariadb.dot.*; do
|
||||
dot -Tsvg -o $REPORT_PATH/$(basename $f).svg $f
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
Reference in New Issue
Block a user