Files
neon/libs/utils/scripts/restore_from_wal.sh
abhijeet 330d9a8b02 testing if santiser work
moved sanitizers in its owm workflow

merged all jobs into onme

cleaned up failing job

cleaned up failing job

running just tests

fixing build

reverting changes

fixing linter error and build error

clearning up job

added wal and extension builds

fixing build

fixing build

fixing build

added use sanitizer patch

testing if sanitiser work in main workflow

fixed format issue

fixing format issue

fixing format issue

added flags

disabled flags

enabling flags

enabling flags

added more options to flag

fixing build

fixing build

testing the regression run

added asan and usban flag for regression test

commented unit test and release build

fixing build

fix neon for sanitizers

enabled unit test

updated branch to test the fix

updated branch to test the fix

updated the commit id

fixing build

restoring the submodules to main

updated git modules and revision of commit

updated postgres 16 vendor dir

removed test
2024-01-19 11:32:26 +00:00

23 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
set -euxo pipefail
PG_BIN=$1
WAL_PATH=$2
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 ASAN_OPTIONS="$ASAN_OPTIONS" UBSAN_OPTIONS="$UBSAN_OPTIONS" "$PG_BIN"/initdb -E utf8 -U cloud_admin -D "$DATA_DIR" --sysid="$SYSID"
echo "port=$PORT" >> "$DATA_DIR"/postgresql.conf
echo "shared_preload_libraries='\$libdir/neon_rmgr.so'" >> "$DATA_DIR"/postgresql.conf
REDO_POS=0x$("$PG_BIN"/pg_controldata -D "$DATA_DIR" | grep -F "REDO location"| cut -c 42-)
declare -i WAL_SIZE=$REDO_POS+114
"$PG_BIN"/pg_ctl -D "$DATA_DIR" -l "$DATA_DIR/logfile.log" start
"$PG_BIN"/pg_ctl -D "$DATA_DIR" -l "$DATA_DIR/logfile.log" stop -m immediate
cp "$DATA_DIR"/pg_wal/000000010000000000000001 .
cp "$WAL_PATH"/* "$DATA_DIR"/pg_wal/
for partial in "$DATA_DIR"/pg_wal/*.partial ; do mv "$partial" "${partial%.partial}" ; done
dd if=000000010000000000000001 of="$DATA_DIR"/pg_wal/000000010000000000000001 bs=$WAL_SIZE count=1 conv=notrunc
rm -f 000000010000000000000001