From 5b27581911a96b978c82a30f2c6a1c7c0041eecc Mon Sep 17 00:00:00 2001 From: Daniel Shelepanov Date: Wed, 15 Feb 2023 20:41:14 +0300 Subject: [PATCH 1/2] [PBKP-531] hotfix PGPROEE11 now supports ptrack for CFS --- engine.c | 14 +++++++++++++- engine.h | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/engine.c b/engine.c index 329f13a..7234cc4 100644 --- a/engine.c +++ b/engine.c @@ -117,16 +117,28 @@ is_cfm_file_path(const char *filepath) { off_t get_cfs_relation_file_decompressed_size(RelFileNodeBackend rnode, const char *fullpath, ForkNumber forknum) { File fd; - int compressor; off_t size; +#if PG_VERSION_NUM >= 120000 + int compressor; compressor = md_get_compressor_internal(nodeOf(rnode), rnode.backend, forknum); fd = PathNameOpenFile(fullpath, O_RDWR | PG_BINARY, compressor); +#else + fd = PathNameOpenFile(fullpath, O_RDWR | PG_BINARY | PG_COMPRESSION); +#endif if(fd < 0) return (off_t)-1; +#if PG_VERSION_NUM >= 120000 size = FileSize(fd); +#else + size = FileSeek(fd, 0, SEEK_END); + + if (size < 0) + return (off_t) -1; +#endif + FileClose(fd); return size; diff --git a/engine.h b/engine.h index 3ba868c..56777fc 100644 --- a/engine.h +++ b/engine.h @@ -45,7 +45,7 @@ #define PTRACK_MAGIC_SIZE 4 /* CFS support macro */ -#if defined(PGPRO_EE) && PG_VERSION_NUM >= 120000 +#if defined(PGPRO_EE) && PG_VERSION_NUM >= 110000 #define CFS_SUPPORT 1 #endif From eec9cbd85890bcd2c70e5d563eae2d3dde3c9bdd Mon Sep 17 00:00:00 2001 From: Daniel Shelepanov Date: Sun, 19 Feb 2023 20:22:34 +0300 Subject: [PATCH 2/2] refactored a little bit --- engine.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/engine.c b/engine.c index 7234cc4..afaae1f 100644 --- a/engine.c +++ b/engine.c @@ -134,9 +134,6 @@ get_cfs_relation_file_decompressed_size(RelFileNodeBackend rnode, const char *fu size = FileSize(fd); #else size = FileSeek(fd, 0, SEEK_END); - - if (size < 0) - return (off_t) -1; #endif FileClose(fd);