timescaledb/scripts/test_repairs.sh
Markos Fountoulakis fab16f3798 Fix segfault in Continuous Aggregates
Add the missing variables to the finalization view of Continuous
Aggregates and the corresponding columns to the materialization table.
Cover the case of targets that contain Aggref nodes and Var nodes
that are outside of the Aggref nodes at the same time.

Stop rebuilding the Continuous Aggregate view with ALTER MATERIALIZED
VIEW. Attempt to repair the view at post-update time instead, and fail
gracefully if it is not possible to do so without raw hypertable schema
or data modifications.

Stop rebuilding the Continuous Aggregate view when switching realtime
aggregation on and off. Instead, manipulate the User View by either:
  1. removing the UNION ALL right-hand side and the WHERE clause when
     disabling realtime aggregation
  2. adding the Direct View to the right of a UNION ALL operator and
     defining WHERE clauses with the relevant watermark checks when
     enabling realtime aggregation

Fixes #3898
2022-04-18 12:54:20 +03:00

51 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
set -o pipefail
SCRIPT_DIR=$(dirname $0)
BASE_DIR=${PWD}/${SCRIPT_DIR}/..
GIT_ID=$(git -C ${BASE_DIR} describe --dirty --always | sed -e "s|/|_|g")
TEST_TMPDIR=${TEST_TMPDIR:-$(mktemp -d 2>/dev/null || mktemp -d -t 'timescaledb_repair_test' || mkdir -p /tmp/${RANDOM})}
UPDATE_TO_IMAGE=${UPDATE_TO_IMAGE:-repair_test}
UPDATE_TO_TAG=${UPDATE_TO_TAG:-${GIT_ID}}
# Build the docker image with current source here so that the parallel
# tests don't all compete in trying to build it first
IMAGE_NAME=${UPDATE_TO_IMAGE} TAG_NAME=${UPDATE_TO_TAG} PG_VERSION=${PG_VERSION} bash ${SCRIPT_DIR}/docker-build.sh
# Run repair tests in parallel
declare -A tests
for tag in ${TAGS}; do
UPDATE_FROM_TAG=${tag} TEST_VERSION=${TEST_VERSION} bash $SCRIPT_DIR/test_repair_from_tag.sh ${TEST_UPDATE_FROM_TAGS_EXTRA_ARGS} > ${TEST_TMPDIR}/${tag}.log 2>&1 &
tests[$!]=${tag}
echo "Launched test ${tag} with pid $!"
done
# Need to wait on each pid in a loop to return the exit status of each
for pid in "${!tests[@]}"; do
echo "Waiting for test pid $pid"
wait $pid
exit_code=$?
echo "Test ${tests[$pid]} (pid $pid) exited with code $exit_code"
if [ $exit_code -ne 0 ]; then
FAIL_COUNT=$((FAIL_COUNT + 1))
FAILED_TEST=${tests[$pid]}
if [ -f ${TEST_TMPDIR}/${FAILED_TEST}.log ]; then
echo "###### Failed $UPDATE_TO_TAG test log below #####"
cat ${TEST_TMPDIR}/${FAILED_TEST}.log
fi
fi
echo "###### test log $UPDATE_TO_TAG below #####"
cat ${TEST_TMPDIR}/${tests[$pid]}.log
done
if [ "$KEEP_TEMP_DIRS" = "false" ]; then
echo "Cleaning up temporary directory"
rm -rf ${TEST_TMPDIR}
fi
exit $FAIL_COUNT