From ac52f4f2d66885c25b99befd942825c16fd2759e Mon Sep 17 00:00:00 2001 From: Konstantin Knizhnik Date: Wed, 20 Apr 2022 13:24:38 +0300 Subject: [PATCH] Set superuser when initializing database for wal recovery (#1544) --- test_runner/batch_others/test_wal_restore.py | 2 +- zenith_utils/scripts/restore_from_wal.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test_runner/batch_others/test_wal_restore.py b/test_runner/batch_others/test_wal_restore.py index 8cc27a455c..2dbde954fc 100644 --- a/test_runner/batch_others/test_wal_restore.py +++ b/test_runner/batch_others/test_wal_restore.py @@ -33,4 +33,4 @@ def test_wal_restore(zenith_env_builder: ZenithEnvBuilder, str(port) ]) restored.start() - assert restored.safe_psql('select count(*) from t') == [(1000000, )] + assert restored.safe_psql('select count(*) from t', user='zenith_admin') == [(1000000, )] diff --git a/zenith_utils/scripts/restore_from_wal.sh b/zenith_utils/scripts/restore_from_wal.sh index f05fbc609a..4983449f24 100755 --- a/zenith_utils/scripts/restore_from_wal.sh +++ b/zenith_utils/scripts/restore_from_wal.sh @@ -5,7 +5,7 @@ DATA_DIR=$3 PORT=$4 SYSID=`od -A n -j 24 -N 8 -t d8 $WAL_PATH/000000010000000000000002* | cut -c 3-` rm -fr $DATA_DIR -env -i LD_LIBRARY_PATH=$PG_BIN/../lib $PG_BIN/initdb -E utf8 -D $DATA_DIR --sysid=$SYSID +env -i LD_LIBRARY_PATH=$PG_BIN/../lib $PG_BIN/initdb -E utf8 -U zenith_admin -D $DATA_DIR --sysid=$SYSID echo port=$PORT >> $DATA_DIR/postgresql.conf REDO_POS=0x`$PG_BIN/pg_controldata -D $DATA_DIR | fgrep "REDO location"| cut -c 42-` declare -i WAL_SIZE=$REDO_POS+114