From c81ede8644ea8cdd71b102235f7cd2fffa2a53d2 Mon Sep 17 00:00:00 2001 From: Anastasia Lubennikova Date: Thu, 22 Sep 2022 20:51:31 +0300 Subject: [PATCH] Hotfix for safekeeper timelines with unknown pg_version. Assume DEFAULT_PG_VERSION = 14 --- safekeeper/src/wal_storage.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/safekeeper/src/wal_storage.rs b/safekeeper/src/wal_storage.rs index 95ad71bbbd..eee7c703f9 100644 --- a/safekeeper/src/wal_storage.rs +++ b/safekeeper/src/wal_storage.rs @@ -125,7 +125,17 @@ impl PhysicalStorage { wal_seg_size, state.commit_lsn, )?, - _ => bail!("unsupported postgres version"), + pg_majorversion => { + // This is a quik hack to work with old timelines that don't have + // pg_version in the control file. We can remove it after this is fixed properly. + const DEFAULT_PG_MAJOR_VERSION: u32 = 14; + warn!("unknown postgres version {pg_majorversion} assume {DEFAULT_PG_MAJOR_VERSION}"); + postgres_ffi::v14::xlog_utils::find_end_of_wal( + &timeline_dir, + wal_seg_size, + state.commit_lsn, + )? + } } };