You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
last_transition_time timestamptz NOT NULL DEFAULT now()
796
804
);
797
-
INSERT INTO _pgro.restore_info (id, snapshot_id, snapshot_time)
798
-
VALUES (1, '${{PGRO_SNAPSHOT_ID}}', CASE WHEN '${{PGRO_SNAPSHOT_TIME}}' = '' THEN NULL ELSE '${{PGRO_SNAPSHOT_TIME}}'::timestamptz END)
805
+
ALTER TABLE _pgro.restore_info ADD COLUMN IF NOT EXISTS stage text NOT NULL DEFAULT 'restored';
806
+
ALTER TABLE _pgro.restore_info ADD COLUMN IF NOT EXISTS last_transition_time timestamptz NOT NULL DEFAULT now();
807
+
INSERT INTO _pgro.restore_info (id, snapshot_id, snapshot_time, stage, last_transition_time)
808
+
VALUES (1, '${{PGRO_SNAPSHOT_ID}}', CASE WHEN '${{PGRO_SNAPSHOT_TIME}}' = '' THEN NULL ELSE '${{PGRO_SNAPSHOT_TIME}}'::timestamptz END, '${{PGRO_STAGE}}', now())
799
809
ON CONFLICT (id) DO UPDATE
800
810
SET snapshot_id = EXCLUDED.snapshot_id,
801
811
snapshot_time = EXCLUDED.snapshot_time,
802
-
restored_at = now();
812
+
restored_at = now(),
813
+
stage = EXCLUDED.stage,
814
+
last_transition_time = now();
803
815
SQLEOF
804
816
805
817
echo "Stopping temporary postgres..."
@@ -951,6 +963,7 @@ if [ -f /pgdata/needs-reindex ]; then
951
963
PG_MAJOR=$(cat /pgdata/pgdata/PG_VERSION)
952
964
(
953
965
while ! pg_isready -q -U postgres -d postgres; do sleep 2; done
966
+
psql -U postgres -d postgres -c "UPDATE _pgro.restore_info SET stage = 'reindexing', last_transition_time = now() WHERE id = 1;"
954
967
for db in $(psql -U postgres -d postgres -At -c "SELECT datname FROM pg_database WHERE datallowconn AND datname <> 'template0'"); do
955
968
INDEXES=$(psql -U postgres -d "$db" -At -c "
956
969
SELECT DISTINCT indexrelid::regclass::text
@@ -973,6 +986,7 @@ if [ -f /pgdata/needs-reindex ]; then
973
986
done
974
987
done
975
988
rm -f /pgdata/needs-reindex
989
+
psql -U postgres -d postgres -c "UPDATE _pgro.restore_info SET stage = 'ready', last_transition_time = now() WHERE id = 1;"
0 commit comments