提交 87d3b35a 编写于 作者: S Simon Riggs

Fix pg_upgrade for 9.3 with data checksums.

Previous changes misconstrued pg_upgrade internals
causing build farm breakages.
上级 be475a24
...@@ -56,7 +56,7 @@ get_control_data(ClusterInfo *cluster, bool live_check) ...@@ -56,7 +56,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
bool got_toast = false; bool got_toast = false;
bool got_date_is_int = false; bool got_date_is_int = false;
bool got_float8_pass_by_value = 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_collate = NULL;
char *lc_ctype = NULL; char *lc_ctype = NULL;
char *lc_monetary = NULL; char *lc_monetary = NULL;
...@@ -135,8 +135,8 @@ get_control_data(ClusterInfo *cluster, bool live_check) ...@@ -135,8 +135,8 @@ get_control_data(ClusterInfo *cluster, bool live_check)
/* Only in <= 9.2 */ /* Only in <= 9.2 */
if (GET_MAJOR_VERSION(cluster->major_version) <= 902) if (GET_MAJOR_VERSION(cluster->major_version) <= 902)
{ {
cluster->controldata.data_checksums = false; cluster->controldata.data_checksum_version = 0;
got_data_checksums = true; got_data_checksum_version = true;
} }
/* we have the result of cmd in "output". so parse it line by line now */ /* 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) ...@@ -401,7 +401,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
cluster->controldata.float8_pass_by_value = strstr(p, "by value") != NULL; cluster->controldata.float8_pass_by_value = strstr(p, "by value") != NULL;
got_float8_pass_by_value = true; got_float8_pass_by_value = true;
} }
else if ((p = strstr(bufin, "checksums")) != NULL) else if ((p = strstr(bufin, "checksum")) != NULL)
{ {
p = strchr(p, ':'); p = strchr(p, ':');
...@@ -410,8 +410,8 @@ get_control_data(ClusterInfo *cluster, bool live_check) ...@@ -410,8 +410,8 @@ get_control_data(ClusterInfo *cluster, bool live_check)
p++; /* removing ':' char */ p++; /* removing ':' char */
/* used later for contrib check */ /* used later for contrib check */
cluster->controldata.data_checksums = strstr(p, "enabled") != NULL; cluster->controldata.data_checksum_version = str2uint(p);
got_data_checksums = true; got_data_checksum_version = true;
} }
/* In pre-8.4 only */ /* In pre-8.4 only */
else if ((p = strstr(bufin, "LC_COLLATE:")) != NULL) else if ((p = strstr(bufin, "LC_COLLATE:")) != NULL)
...@@ -496,7 +496,7 @@ get_control_data(ClusterInfo *cluster, bool live_check) ...@@ -496,7 +496,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
!got_tli || !got_tli ||
!got_align || !got_blocksz || !got_largesz || !got_walsz || !got_align || !got_blocksz || !got_largesz || !got_walsz ||
!got_walseg || !got_ident || !got_index || !got_toast || !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, pg_log(PG_REPORT,
"The %s cluster lacks some required control information:\n", "The %s cluster lacks some required control information:\n",
...@@ -556,8 +556,8 @@ get_control_data(ClusterInfo *cluster, bool live_check) ...@@ -556,8 +556,8 @@ get_control_data(ClusterInfo *cluster, bool live_check)
pg_log(PG_REPORT, " float8 argument passing method\n"); pg_log(PG_REPORT, " float8 argument passing method\n");
/* value added in Postgres 9.3 */ /* value added in Postgres 9.3 */
if (!got_data_checksums) if (!got_data_checksum_version)
pg_log(PG_REPORT, " data checksums\n"); pg_log(PG_REPORT, " data checksum version\n");
pg_log(PG_FATAL, pg_log(PG_FATAL,
"Cannot continue without required control information, terminating\n"); "Cannot continue without required control information, terminating\n");
...@@ -622,10 +622,10 @@ check_control_data(ControlData *oldctrl, ...@@ -622,10 +622,10 @@ check_control_data(ControlData *oldctrl,
} }
/* We might eventually allow upgrades from checksum to no-checksum clusters. */ /* 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, 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");
} }
} }
......
...@@ -202,7 +202,7 @@ typedef struct ...@@ -202,7 +202,7 @@ typedef struct
uint32 toast; uint32 toast;
bool date_is_int; bool date_is_int;
bool float8_pass_by_value; bool float8_pass_by_value;
bool data_checksums; bool data_checksum_version;
char *lc_collate; char *lc_collate;
char *lc_ctype; char *lc_ctype;
char *encoding; char *encoding;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册