Fix datatype for number of heap tuples during last cleanup
authorTeodor Sigaev <teodor@sigaev.ru>
Thu, 19 Apr 2018 08:28:03 +0000 (11:28 +0300)
committerTeodor Sigaev <teodor@sigaev.ru>
Thu, 19 Apr 2018 08:28:03 +0000 (11:28 +0300)
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
src/include/access/nbtxlog.h
src/include/catalog/catversion.h

index 7aa6afbbb8077a962c04c2418125a07a2425edc2..1194be928110502e979f7fd619aa69b48a3edf1d 100644 (file)
@@ -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;
 
index c55b618ff7d2c8261a6d848fcedcb6aef26931ea..819373031cdf262713377bda2fb1f55368138a76 100644 (file)
@@ -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;
 
 /*
index acd6791563bec997739371f5cc96cf9bf04e1045..2954cba6b32134d7286a8cce9d9c53625c3b2f01 100644 (file)
@@ -53,6 +53,6 @@
  */
 
 /*                                                     yyyymmddN */
-#define CATALOG_VERSION_NO     201804091
+#define CATALOG_VERSION_NO     201804191
 
 #endif