Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Fix pg_upgrade for 9.3 with data checksums.
authorSimon Riggs <simon@2ndQuadrant.com>
Tue, 30 Apr 2013 14:49:24 +0000 (15:49 +0100)
committerSimon Riggs <simon@2ndQuadrant.com>
Tue, 30 Apr 2013 14:49:24 +0000 (15:49 +0100)
Previous changes misconstrued pg_upgrade internals
causing build farm breakages.

contrib/pg_upgrade/controldata.c
contrib/pg_upgrade/pg_upgrade.h

index e9376e207f434330aeb80e59634f7bf64a81dc7e..d1acff5c9f87b2517e0f9bbdef9d564d4a438d0a 100644 (file)
@@ -56,7 +56,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
    bool        got_toast = false;
    bool        got_date_is_int = false;
    bool        got_float8_pass_by_value = false;
-   bool        got_data_checksums = false;
+   bool        got_data_checksum_version = false;
    char       *lc_collate = NULL;
    char       *lc_ctype = NULL;
    char       *lc_monetary = NULL;
@@ -135,8 +135,8 @@ get_control_data(ClusterInfo *cluster, bool live_check)
    /* Only in <= 9.2 */
    if (GET_MAJOR_VERSION(cluster->major_version) <= 902)
    {
-       cluster->controldata.data_checksums = false;
-       got_data_checksums = true;
+       cluster->controldata.data_checksum_version = 0;
+       got_data_checksum_version = true;
    }
 
    /* we have the result of cmd in "output". so parse it line by line now */
@@ -401,7 +401,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
            cluster->controldata.float8_pass_by_value = strstr(p, "by value") != NULL;
            got_float8_pass_by_value = true;
        }
-       else if ((p = strstr(bufin, "checksums")) != NULL)
+       else if ((p = strstr(bufin, "checksum")) != NULL)
        {
            p = strchr(p, ':');
 
@@ -410,8 +410,8 @@ get_control_data(ClusterInfo *cluster, bool live_check)
 
            p++;                /* removing ':' char */
            /* used later for contrib check */
-           cluster->controldata.data_checksums = strstr(p, "enabled") != NULL;
-           got_data_checksums = true;
+           cluster->controldata.data_checksum_version = str2uint(p);
+           got_data_checksum_version = true;
        }
        /* In pre-8.4 only */
        else if ((p = strstr(bufin, "LC_COLLATE:")) != NULL)
@@ -496,7 +496,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
        !got_tli ||
        !got_align || !got_blocksz || !got_largesz || !got_walsz ||
        !got_walseg || !got_ident || !got_index || !got_toast ||
-       !got_date_is_int || !got_float8_pass_by_value || !got_data_checksums)
+       !got_date_is_int || !got_float8_pass_by_value || !got_data_checksum_version)
    {
        pg_log(PG_REPORT,
            "The %s cluster lacks some required control information:\n",
@@ -556,8 +556,8 @@ get_control_data(ClusterInfo *cluster, bool live_check)
            pg_log(PG_REPORT, "  float8 argument passing method\n");
 
        /* value added in Postgres 9.3 */
-       if (!got_data_checksums)
-           pg_log(PG_REPORT, "  data checksums\n");
+       if (!got_data_checksum_version)
+           pg_log(PG_REPORT, "  data checksum version\n");
 
        pg_log(PG_FATAL,
               "Cannot continue without required control information, terminating\n");
@@ -622,10 +622,10 @@ check_control_data(ControlData *oldctrl,
    }
 
    /* We might eventually allow upgrades from checksum to no-checksum clusters. */
-   if (oldctrl->data_checksums != newctrl->data_checksums)
+   if (oldctrl->data_checksum_version != newctrl->data_checksum_version)
    {
        pg_log(PG_FATAL,
-              "old and new pg_controldata checksums settings are invalid or do not match\n");
+              "old and new pg_controldata checksum versions are invalid or do not match\n");
    }
 }
 
index 370315f0cb34bc5824dc7974aac1cfc3aa136302..00f719791c8fae6bb9a45dece2bdc42b11e85a0e 100644 (file)
@@ -202,7 +202,7 @@ typedef struct
    uint32      toast;
    bool        date_is_int;
    bool        float8_pass_by_value;
-   bool        data_checksums;
+   bool        data_checksum_version;
    char       *lc_collate;
    char       *lc_ctype;
    char       *encoding;