Skip to content
Snippets Groups Projects
Commit dd425e79 authored by Dan Notestein's avatar Dan Notestein
Browse files

create_zfs_dataset creates an empty snapshot, snapshot_zfs_datasets checks if...

parent 8293bd07
No related branches found
No related tags found
2 merge requests!66Merge develop to master for release,!50create_zfs_dataset creates an empty snapshot, snapshot_zfs_datasets checks if...
......@@ -133,3 +133,6 @@ mkdir -p "$TOP_LEVEL_DATASET_MOUNTPOINT/logs/caddy"
chown -R 1000:100 "$TOP_LEVEL_DATASET_MOUNTPOINT/logs"
# 105:109 is postgres:postgres inside the container
chown -R 105:109 "$TOP_LEVEL_DATASET_MOUNTPOINT/logs/postgresql" "$TOP_LEVEL_DATASET_MOUNTPOINT/logs/pgbadger"
# Create a snapshot called 'empty'
./snapshot_zfs_datasets.sh empty
......@@ -134,6 +134,33 @@ fi
echo "All datasets appear unmountable"
if [ "$SNAPSHOT_NAME" != "empty" ]; then
if [ ! -e "${TOP_LEVEL_DATASET_MOUNTPOINT}/shared_memory/shared_memory.bin" ]; then
echo "Warning: No shared memory file found in the shared_memory directory"
exit 1
fi
last_shared_memory_write=$(stat -c %Y "${TOP_LEVEL_DATASET_MOUNTPOINT}/shared_memory/shared_memory.bin")
last_blockchain_write=$(find "${TOP_LEVEL_DATASET_MOUNTPOINT}/blockchain" -type f -printf '%T@\n' | sort -n | tail -1)
if [ -z "$last_blockchain_write" ]; then
echo "Warning: No files found in the blockchain directory"
exit 1
fi
time_diff=$((last_blockchain_write - last_shared_memory_write))
if [ $time_diff -gt 300 ] || [ $time_diff -lt -300 ]; then
echo "Warning: The shared_memory.bin file was not written to within 5 minutes of the last write to a file in the blockchain directory."
read -p "Do you want to continue? (y/n): " choice
case "$choice" in
y|Y ) echo "Continuing...";;
n|N ) echo "Aborting."; exit 1;;
* ) echo "Invalid input. Aborting."; exit 1;;
esac
fi
fi
if [ $PUBLIC_SNAPSHOT -eq 1 ]; then
stdbuf -o0 echo ""
stdbuf -o0 echo "Moving log files out of the dataset because this is a public snapshot... "
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment