From ff4943042f9761fb4e84432da563f43eb3559a3b Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Thu, 19 Apr 2018 11:28:03 +0300 Subject: [PATCH] Fix datatype for number of heap tuples during last cleanup It appears that new fields introduced in 857f9c36 have inconsistent datatypes: BTMetaPageData.btm_last_cleanup_num_heap_tuples is of float4 type, while xl_btree_metadata.last_cleanup_num_heap_tuples is of double type. IndexVacuumInfo.num_heap_tuples, which is a source of values for both former fields is of double type. So, make both those fields in BTMetaPageData and xl_btree_metadata use float8 type in order to match the precision of the source. That shouldn't be double type, because we always use types with explicit width in WAL. Patch introduces incompatibility of on-disk format since 857f9c36 commit, but that versions never was released, so just bump catalog version to avoid possible confusion. Author: Alexander Korortkov --- src/include/access/nbtree.h | 2 +- src/include/access/nbtxlog.h | 2 +- src/include/catalog/catversion.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h index 7aa6afbbb8..1194be9281 100644 --- a/src/include/access/nbtree.h +++ b/src/include/access/nbtree.h @@ -105,7 +105,7 @@ typedef struct BTMetaPageData /* following fields are available since page version 3 */ TransactionId btm_oldest_btpo_xact; /* oldest btpo_xact among of * deleted pages */ - float4 btm_last_cleanup_num_heap_tuples; /* number of heap tuples + float8 btm_last_cleanup_num_heap_tuples; /* number of heap tuples * during last cleanup */ } BTMetaPageData; diff --git a/src/include/access/nbtxlog.h b/src/include/access/nbtxlog.h index c55b618ff7..819373031c 100644 --- a/src/include/access/nbtxlog.h +++ b/src/include/access/nbtxlog.h @@ -52,7 +52,7 @@ typedef struct xl_btree_metadata BlockNumber fastroot; uint32 fastlevel; TransactionId oldest_btpo_xact; - double last_cleanup_num_heap_tuples; + float8 last_cleanup_num_heap_tuples; } xl_btree_metadata; /* diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index acd6791563..2954cba6b3 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 201804091 +#define CATALOG_VERSION_NO 201804191 #endif