debug.patch

text/x-patch

Filename: debug.patch
Type: text/x-patch
Part: 4
Message: Invalid control file checksum with AVX-512 during initdb on a clang19 -O0 build

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
src/backend/access/transam/xlog.c 4 0
src/bin/initdb/initdb.c 1 1
src/common/controldata_utils.c 6 0
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 1914859b2ee..cd40c3de06c 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -4436,6 +4436,8 @@ WriteControlFile(void)
 				offsetof(ControlFileData, crc));
 	FIN_CRC32C(ControlFile->crc);
 
+	elog(LOG, "WriteControlFile crc = %u, algo is avx = %d", ControlFile->crc, (pg_comp_crc32c == pg_comp_crc32c_avx512));
+
 	/*
 	 * We write out PG_CONTROL_FILE_SIZE bytes into pg_control, zero-padding
 	 * the excess over sizeof(ControlFileData).  This reduces the odds of
@@ -4554,6 +4556,8 @@ ReadControlFile(void)
 				offsetof(ControlFileData, crc));
 	FIN_CRC32C(crc);
 
+	elog(LOG, "ReadControlFile crc = %u, ControlFile->crc = %u, algo is avx = %d", crc, ControlFile->crc, (pg_comp_crc32c == pg_comp_crc32c_avx512));
+
 	if (!EQ_CRC32C(crc, ControlFile->crc))
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 62bbd08d9f6..69c561f67ad 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -1609,7 +1609,7 @@ bootstrap_template1(void)
 
 	initPQExpBuffer(&cmd);
 
-	printfPQExpBuffer(&cmd, "\"%s\" --boot %s %s", backend_exec, boot_options, extra_options);
+	printfPQExpBuffer(&cmd, "rr record \"%s\" --boot %s %s", backend_exec, boot_options, extra_options);
 	appendPQExpBuffer(&cmd, " -X %d", wal_segment_size_mb * (1024 * 1024));
 	if (data_checksums)
 		appendPQExpBufferStr(&cmd, " -k");
diff --git a/src/common/controldata_utils.c b/src/common/controldata_utils.c
index fa375dc9129..98de2fc9db5 100644
--- a/src/common/controldata_utils.c
+++ b/src/common/controldata_utils.c
@@ -211,6 +211,12 @@ update_controlfile(const char *DataDir,
 	memset(buffer, 0, PG_CONTROL_FILE_SIZE);
 	memcpy(buffer, ControlFile, sizeof(ControlFileData));
 
+#ifndef FRONTEND
+	elog(LOG, "update_controlfile crc = %u, algo is avx = %d", ControlFile->crc, (pg_comp_crc32c == pg_comp_crc32c_avx512));
+#else
+	pg_log_info("update_controlfile crc = %u, algo is avx = %d", ControlFile->crc, (pg_comp_crc32c == pg_comp_crc32c_avx512));
+#endif
+
 	snprintf(ControlFilePath, sizeof(ControlFilePath), "%s/%s", DataDir, XLOG_CONTROL_FILE);
 
 #ifndef FRONTEND