From 2c4c03e60464717f0e234cdffe17ae78457b4f2d Mon Sep 17 00:00:00 2001 From: Tomi Eckert Date: Mon, 19 Jan 2026 11:28:33 +0100 Subject: [PATCH] feat(backup): added thread to config --- backup/backup.conf | 3 +++ backup/backup.hook.sh | 5 +++++ backup/backup.sh | 8 +++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/backup/backup.conf b/backup/backup.conf index b71efad..7c74749 100644 --- a/backup/backup.conf +++ b/backup/backup.conf @@ -37,6 +37,9 @@ COMPRESS_SCHEMA=true # for a 40GB tenant. COMPRESS_TENANT=true +# Number of threads to use for schema export. +THREADS=1 + # --- Target Identifiers --- # The name of the schema to be exported when BACKUP_TYPE is 'schema' or 'all'. diff --git a/backup/backup.hook.sh b/backup/backup.hook.sh index 98225c6..161ba3d 100644 --- a/backup/backup.hook.sh +++ b/backup/backup.hook.sh @@ -11,7 +11,12 @@ HDBSQL_PATH_INPUT=$(which hdbsql) # Default values if not found HDBSQL_PATH_INPUT=${HDBSQL_PATH_INPUT:-"/usr/sap/hdbclient/hdbsql"} +# Calculate default threads (half of available) +TOTAL_THREADS=$(nproc --all) +THREADS_DEFAULT=$((TOTAL_THREADS / 2)) + # Update backup.conf sed -i "s#^HDBSQL_PATH=\".*\"#HDBSQL_PATH=\"$HDBSQL_PATH_INPUT\"#" backup.conf +sed -i "s#^THREADS=.\"*\"#THREADS=\"$THREADS_DEFAULT\"#" backup.conf echo "backup.conf updated successfully!" \ No newline at end of file diff --git a/backup/backup.sh b/backup/backup.sh index 6f17fc3..7137e6e 100644 --- a/backup/backup.sh +++ b/backup/backup.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Version: 1.0.8 +# Version: 1.1.0 # Author: Tomi Eckert # ============================================================================== # SAP HANA Backup Script @@ -47,6 +47,9 @@ case "$BACKUP_TYPE" in for schema in $SCHEMA_NAMES; do echo "⬇️ Starting schema export for '${schema}'..." SCHEMA_EXPORT_OPTIONS="$COMMON_OPTIONS" + if [[ -n "$THREADS" ]]; then + SCHEMA_EXPORT_OPTIONS+=" -t $THREADS" + fi if [[ "$COMPRESS_SCHEMA" == "true" ]]; then SCHEMA_EXPORT_OPTIONS+=" --compress" fi @@ -77,6 +80,9 @@ case "$BACKUP_TYPE" in for schema in $SCHEMA_NAMES; do echo "⬇️ Starting schema export for '${schema}'..." SCHEMA_EXPORT_OPTIONS="$COMMON_OPTIONS" + if [[ -n "$THREADS" ]]; then + SCHEMA_EXPORT_OPTIONS+=" -t $THREADS" + fi if [[ "$COMPRESS_SCHEMA" == "true" ]]; then SCHEMA_EXPORT_OPTIONS+=" --compress" fi