XX001 — data_corrupted
数据完整性不变量失败,如 TOAST 数据损坏。
英文手册覆盖始于 PostgreSQL 8.1. 来源历史与运行验证各自保留独立版本边界。
当前阅读 PG 18·选择有来源记录的版本
- aliases
- 未知
- class name
- Internal Error
- condition name
- data_corrupted
- lang
- en
- sqlstate
- XX001
版本定义 PG 18
XX001
速览 {#at-a-glance}
XX001 报告完整性不变量失败。固定源码覆盖 PGLZ TOAST 数据损坏、堆中不可能的 MultiXact/XID freeze 状态,以及 amcheck 检测到的元组/索引不匹配(其根因仍可能是堆/HOT 链)。
含义 {#meaning}
TOAST 解压器无法解码保存的压缩 datum 时,会以 ERRCODE_DATA_CORRUPTED 报错。堆 freeze 在 MultiXact 早于 relminmxid、在 freeze cutoff 前仍运行,或带有早于 relfrozenxid/可移除 cutoff 的 update XID 时,也使用此码。这些是存储数据和事务元数据的一致性检查,不是普通输入错误。
amcheck 的 heapallindexed 回调报告堆元组缺少匹配的索引元组。源码注释明确指出,表面上的索引扫描问题仍可能源于堆损坏、错误的 HOT 安全性判断或其他底层故障;可选提示只是建议使用更强的检查函数。
消息 {#messages}
- ERROR,SQLSTATE
XX001:compressed pglz data is corrupt。 - ERROR,SQLSTATE
XX001:found multixact %u from before relminmxid %u。 - ERROR,SQLSTATE
XX001:multixact %u from before multi freeze cutoff %u found to be still running。 - ERROR,SQLSTATE
XX001:multixact %u contains update XID %u from before relfrozenxid %u。 - ERROR,SQLSTATE
XX001:multixact %u contains committed update XID %u from before removable cutoff %u。 - ERROR,SQLSTATE
XX001:heap tuple (%u,%u) from table "%s" lacks matching index tuple within index "%s"。- 通过
bt_index_check进入时(该入口取得AccessShareLock,并向回调传入readonly=false),提示为:Retrying verification using the function bt_index_parent_check() might provide a more specific error.bt_index_parent_check入口取得ShareLock、传入readonly=true,不会附加这个提示。这里的 readonly 是内部校验模式,与 SQL 事务的transaction_read_only设置无关。
- 通过
诊断 {#diagnosis}
保留完整消息与标识符、关系/索引名称、数据块/页面上下文、校验和与副本比较、日志以及首次发现不变量的操作。TOAST 要定位所属表和压缩 datum 路径;堆消息要检查 relfrozenxid/relminmxid 与 MultiXact 历史,不能手工改系统目录。对 amcheck 记录调用的是 bt_index_check/AccessShareLock 还是 bt_index_parent_check/ShareLock,以及是否有提示;不要先假定索引是根因。
处理 {#response}
按完整性事件处理。显式事务中的 ERROR 需要先 ROLLBACK,或回到已有保存点,再发送 SQL;回滚不会修复存储对象。用只读流程比较可信备份、副本、校验和和存储历史,再按事故方案恢复或重建受影响表/TOAST 数据。只有证据确认损坏局限于索引时才考虑 REINDEX;它不是堆、TOAST、XID 或 MultiXact 不变量的通用修复。若另有 FATAL 或进程终止,恢复后使用新连接;不要为测试而制造损坏。
版本 {#versions}
锁定目录从 7.4 记录此条件;固定 TOAST、堆和 amcheck 源码覆盖 PostgreSQL 18.6。本源码页没有运行损坏或崩溃实验。
相关 {#related}
来源 {#sources}
src/backend/access/common/toast_compression.c#L90-L100
src/backend/access/heap/heapam.c#L6983-L7042
contrib/amcheck/verify_nbtree.c#L2760-L2818
contrib/amcheck/verify_nbtree.c#L252-L305
contrib/amcheck/verify_common.c#L60-L149
结构化证据记录保存完整性消息组、条件提示和源码/运行边界。
比较版本
SQLSTATE 证据与已记录的运行版本
claims · identity
{
"claim_id": "identity",
"limits": "",
"method": "Read locked definition snapshot.",
"position": 0,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "XX001 is data_corrupted in SQLSTATE Class XX."
}claims · resolved-paths
{
"claim_id": "resolved-paths",
"limits": "Source confirmation is not natural runtime and does not identify a particular incident root cause.",
"method": "Read complete fixed integrity-check contexts, amcheck entry points, and the lock-mode-to-readonly mapping.",
"position": 1,
"runtime": [],
"sources": [
"src.path.0",
"src.path.1",
"src.path.2",
"src.path.3",
"src.path.4"
],
"statement": "Fixed source paths cover PGLZ decompression corruption, MultiXact/XID freeze invariants, and the amcheck heapallindexed mismatch; bt_index_check uses AccessShareLock, while bt_index_parent_check uses ShareLock and causes the callback readonly flag that suppresses the parent-check hint."
}claims · history
{
"claim_id": "history",
"limits": "",
"method": "Use locked catalogue boundary.",
"position": 2,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "The locked catalogue records XX001 from 7.4; it does not prove the exact introduction rationale."
}messages · message.0
{
"limits": "",
"message_id": "message.0",
"path": "",
"position": 0,
"raw": {
"id": "message.0",
"primary_template": "compressed pglz data is corrupt",
"severity_source": "ERROR",
"sources": [
"src.path.0"
],
"sqlstate": "XX001"
},
"severity": "ERROR",
"sources": [
"src.path.0"
],
"templates": [
{
"kind": "primary",
"literal": "compressed pglz data is corrupt",
"position": 0,
"role": "",
"template": "compressed pglz data is corrupt"
}
]
}messages · message.1
{
"limits": "",
"message_id": "message.1",
"path": "",
"position": 1,
"raw": {
"id": "message.1",
"primary_template": "found multixact %u from before relminmxid %u",
"severity_source": "ERROR",
"sources": [
"src.path.1"
],
"sqlstate": "XX001"
},
"severity": "ERROR",
"sources": [
"src.path.1"
],
"templates": [
{
"kind": "primary",
"literal": "found multixact from before relminmxid",
"position": 0,
"role": "",
"template": "found multixact %u from before relminmxid %u"
}
]
}messages · message.2
{
"limits": "",
"message_id": "message.2",
"path": "",
"position": 2,
"raw": {
"id": "message.2",
"primary_template": "multixact %u from before multi freeze cutoff %u found to be still running",
"severity_source": "ERROR",
"sources": [
"src.path.1"
],
"sqlstate": "XX001"
},
"severity": "ERROR",
"sources": [
"src.path.1"
],
"templates": [
{
"kind": "primary",
"literal": "multixact from before multi freeze cutoff found to be still running",
"position": 0,
"role": "",
"template": "multixact %u from before multi freeze cutoff %u found to be still running"
}
]
}messages · message.3
{
"limits": "",
"message_id": "message.3",
"path": "",
"position": 3,
"raw": {
"id": "message.3",
"primary_template": "multixact %u contains update XID %u from before relfrozenxid %u",
"severity_source": "ERROR",
"sources": [
"src.path.1"
],
"sqlstate": "XX001"
},
"severity": "ERROR",
"sources": [
"src.path.1"
],
"templates": [
{
"kind": "primary",
"literal": "multixact contains update XID from before relfrozenxid",
"position": 0,
"role": "",
"template": "multixact %u contains update XID %u from before relfrozenxid %u"
}
]
}messages · message.4
{
"limits": "",
"message_id": "message.4",
"path": "",
"position": 4,
"raw": {
"id": "message.4",
"primary_template": "multixact %u contains committed update XID %u from before removable cutoff %u",
"severity_source": "ERROR",
"sources": [
"src.path.1"
],
"sqlstate": "XX001"
},
"severity": "ERROR",
"sources": [
"src.path.1"
],
"templates": [
{
"kind": "primary",
"literal": "multixact contains committed update XID from before removable cutoff",
"position": 0,
"role": "",
"template": "multixact %u contains committed update XID %u from before removable cutoff %u"
}
]
}messages · message.5
{
"limits": "",
"message_id": "message.5",
"path": "",
"position": 5,
"raw": {
"context": "bt_index_parent_check uses ShareLock and callback readonly=true, so this hint is not appended there.",
"hint_condition": "bt_index_check (AccessShareLock; callback readonly=false)",
"hint_template": "Retrying verification using the function bt_index_parent_check() might provide a more specific error.",
"id": "message.5",
"primary_template": "heap tuple (%u,%u) from table \"%s\" lacks matching index tuple within index \"%s\"",
"severity_source": "ERROR",
"sources": [
"src.path.2",
"src.path.3",
"src.path.4"
],
"sqlstate": "XX001"
},
"severity": "ERROR",
"sources": [
"src.path.2",
"src.path.3",
"src.path.4"
],
"templates": [
{
"kind": "primary",
"literal": "heap tuple ( , ) from table \" \" lacks matching index tuple within index \" \"",
"position": 0,
"role": "",
"template": "heap tuple (%u,%u) from table \"%s\" lacks matching index tuple within index \"%s\""
},
{
"kind": "hint",
"literal": "Retrying verification using the function bt_index_parent_check() might provide a more specific error.",
"position": 1,
"role": "",
"template": "Retrying verification using the function bt_index_parent_check() might provide a more specific error."
}
]
}sources · src.errcodes.18.6
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/errcodes.txt",
"position": 0,
"sha256": "6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba",
"source_id": "src.errcodes.18.6",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt#L500"
}sources · src.path.0
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/access/common/toast_compression.c",
"position": 1,
"sha256": "87d3c4337f09c991f5baefdbed6247fb93095c99f346ebb3622b8f5ee10e0064",
"source_id": "src.path.0",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/common/toast_compression.c#L90"
}sources · src.path.1
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/access/heap/heapam.c",
"position": 2,
"sha256": "57e3396476fc5d269bd2944b549a671f2699bf8ed43668e661090548ca206a16",
"source_id": "src.path.1",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/heap/heapam.c#L6983"
}sources · src.path.2
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "contrib/amcheck/verify_nbtree.c",
"position": 3,
"sha256": "a59ae7540a990e5a70e8eb9cedbcad7c62e3e86b1ad426142c8931ee188b752d",
"source_id": "src.path.2",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/amcheck/verify_nbtree.c#L2760"
}sources · src.path.3
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "contrib/amcheck/verify_nbtree.c",
"position": 4,
"sha256": "a59ae7540a990e5a70e8eb9cedbcad7c62e3e86b1ad426142c8931ee188b752d",
"source_id": "src.path.3",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/amcheck/verify_nbtree.c#L252"
}sources · src.path.4
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "contrib/amcheck/verify_common.c",
"position": 5,
"sha256": "8e591fc7b73760af0bea05987093064087b26f6b80856228d95f7c0d8e2d266a",
"source_id": "src.path.4",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/amcheck/verify_common.c#L60"
}来源引用
定义来源
center · PostgreSQL 18 · english-manuals:dbdd723801b62ed2589e8aebcfc69232e86c113c49266eae217b520b15eea342
正文语言: zh-Hans · english-manuals:dbdd723801b62ed2589e8aebcfc69232e86c113c49266eae217b520b15eea342