Skip to content

Commit df679cc

Browse files
committed
adjust the table
1 parent 6f13abf commit df679cc

2 files changed

Lines changed: 72 additions & 72 deletions

File tree

CN/modules/ROOT/pages/master/compatibility_features_design/alter_index_unusable_impl.adoc

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,40 +14,40 @@
1414
`ALTER INDEX ... UNUSABLE` 的实现分为五个层次:
1515

1616
```
17-
┌───────────────────────────────────┐
18-
│ Layer 1: Oracle 解析器 (ora_gram.y + ora_kwlist.h) │
19-
│ ─ 新增 UNUSABLE 关键字(UNRESERVED_KEYWORD, BARE_LABEL) │
20-
│ ─ ALTER INDEX qualified_name UNUSABLE → OraAlterIndexUnusableStmt │
21-
└───────────────────────────────────┘
22-
23-
┌───────────────────────────────────┐
24-
│ Layer 2: 语句分发 (tcop/utility.c) │
25-
│ ─ T_OraAlterIndexUnusableStmt 与既有 T_OraAlterIndexRebuildStmt │
26-
│ 并列出现在 4 处:只读事务分类 / ProcessUtilitySlow / │
27-
│ CreateCommandTag / GetCommandLogLevel │
28-
└───────────────────────────────────┘
29-
30-
┌───────────────────────────────────┐
31-
│ Layer 3: 执行层 (commands/indexcmds.c) │
32-
│ ─ ExecOraAlterIndexUnusable():权限检查、解析锁定目标索引、 │
33-
│ 拒绝分区索引、调用 index_set_unusable(indexOid, true) │
34-
└───────────────────────────────────┘
35-
36-
┌───────────────────────────────────┐
37-
│ Layer 4: 目录层 (catalog/index.c + include/catalog/pg_index.h) │
38-
│ ─ 新增 pg_index.indisunusable 列 │
39-
│ ─ index_set_unusable():与 index_set_state_flags() 同构的独立 │
40-
│ catalog 更新函数 │
41-
│ ─ index_create() 的 values[] 数组补充该列初始值(false) │
42-
│ ─ reindex_index() 在既有"修复索引状态"分支中一并清除该标记 │
43-
└───────────────────────────────────┘
44-
45-
┌───────────────────────────────────┐
46-
│ Layer 5: 规划器 / 执行器 (plancat.c + BuildIndexInfo) │
47-
│ ─ get_relation_info() 跳过 indisunusable 的索引 │
48-
│ ─ BuildIndexInfo() 令 ii_ReadyForInserts 一并反映该标记, │
49-
│ execIndexing.c 既有的跳过逻辑自然覆盖,无需改动执行器本身 │
50-
└───────────────────────────────────┘
17+
┌───────────────────────────────────────────────────────────────────────
18+
│ Layer 1: Oracle 解析器 (ora_gram.y + ora_kwlist.h)
19+
│ ─ 新增 UNUSABLE 关键字(UNRESERVED_KEYWORD, BARE_LABEL)
20+
│ ─ ALTER INDEX qualified_name UNUSABLE → OraAlterIndexUnusableStmt
21+
└───────────────────────────────────────────────────────────────────────
22+
23+
┌───────────────────────────────────────────────────────────────────────
24+
│ Layer 2: 语句分发 (tcop/utility.c)
25+
│ ─ T_OraAlterIndexUnusableStmt 与既有 T_OraAlterIndexRebuildStmt
26+
│ 并列出现在 4 处:只读事务分类 / ProcessUtilitySlow /
27+
│ CreateCommandTag / GetCommandLogLevel
28+
└───────────────────────────────────────────────────────────────────────
29+
30+
┌───────────────────────────────────────────────────────────────────────
31+
│ Layer 3: 执行层 (commands/indexcmds.c)
32+
│ ─ ExecOraAlterIndexUnusable():权限检查、解析锁定目标索引、
33+
│ 拒绝分区索引、调用 index_set_unusable(indexOid, true)
34+
└───────────────────────────────────────────────────────────────────────
35+
36+
┌───────────────────────────────────────────────────────────────────────
37+
│ Layer 4: 目录层 (catalog/index.c + include/catalog/pg_index.h)
38+
│ ─ 新增 pg_index.indisunusable 列
39+
│ ─ index_set_unusable():与 index_set_state_flags() 同构的独立
40+
│ catalog 更新函数
41+
│ ─ index_create() 的 values[] 数组补充该列初始值(false)
42+
│ ─ reindex_index() 在既有"修复索引状态"分支中一并清除该标记
43+
└───────────────────────────────────────────────────────────────────────
44+
45+
┌───────────────────────────────────────────────────────────────────────
46+
│ Layer 5: 规划器 / 执行器 (plancat.c + BuildIndexInfo)
47+
│ ─ get_relation_info() 跳过 indisunusable 的索引
48+
│ ─ BuildIndexInfo() 令 ii_ReadyForInserts 一并反映该标记,
49+
│ execIndexing.c 既有的跳过逻辑自然覆盖,无需改动执行器本身
50+
└───────────────────────────────────────────────────────────────────────
5151
```
5252

5353
=== 语法与解析

EN/modules/ROOT/pages/master/compatibility_features_design/alter_index_unusable_impl_en.adoc

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -14,45 +14,45 @@ This document explains in detail how the `ALTER INDEX ... UNUSABLE` feature in I
1414
The implementation of `ALTER INDEX ... UNUSABLE` is divided into five layers:
1515

1616
```
17-
┌───────────────────────────────────┐
18-
│ Layer 1: Oracle Parser (ora_gram.y + ora_kwlist.h) │
19-
│ ─ Adds the UNUSABLE keyword (UNRESERVED_KEYWORD, BARE_LABEL) │
20-
│ ─ ALTER INDEX qualified_name UNUSABLE → OraAlterIndexUnusableStmt │
21-
└───────────────────────────────────┘
22-
23-
┌───────────────────────────────────┐
24-
│ Layer 2: Statement Dispatch (tcop/utility.c) │
25-
│ ─ T_OraAlterIndexUnusableStmt appears alongside the existing │
26-
│ T_OraAlterIndexRebuildStmt in 4 places: read-only transaction │
27-
│ classification / ProcessUtilitySlow / CreateCommandTag / │
28-
│ GetCommandLogLevel │
29-
└───────────────────────────────────┘
30-
31-
┌───────────────────────────────────┐
32-
│ Layer 3: Execution Layer (commands/indexcmds.c) │
33-
│ ─ ExecOraAlterIndexUnusable(): permission check, resolves and │
34-
│ locks the target index, rejects partitioned indexes, calls │
35-
│ index_set_unusable(indexOid, true) │
36-
└───────────────────────────────────┘
37-
38-
┌───────────────────────────────────┐
17+
┌───────────────────────────────────────────────────────────────────────
18+
│ Layer 1: Oracle Parser (ora_gram.y + ora_kwlist.h)
19+
│ ─ Adds the UNUSABLE keyword (UNRESERVED_KEYWORD, BARE_LABEL)
20+
│ ─ ALTER INDEX qualified_name UNUSABLE → OraAlterIndexUnusableStmt
21+
└───────────────────────────────────────────────────────────────────────
22+
23+
┌───────────────────────────────────────────────────────────────────────
24+
│ Layer 2: Statement Dispatch (tcop/utility.c)
25+
│ ─ T_OraAlterIndexUnusableStmt appears alongside the existing
26+
│ T_OraAlterIndexRebuildStmt in 4 places: read-only transaction
27+
│ classification / ProcessUtilitySlow / CreateCommandTag /
28+
│ GetCommandLogLevel
29+
└───────────────────────────────────────────────────────────────────────
30+
31+
┌───────────────────────────────────────────────────────────────────────
32+
│ Layer 3: Execution Layer (commands/indexcmds.c)
33+
│ ─ ExecOraAlterIndexUnusable(): permission check, resolves and
34+
│ locks the target index, rejects partitioned indexes, calls
35+
│ index_set_unusable(indexOid, true)
36+
└───────────────────────────────────────────────────────────────────────
37+
38+
┌─────────────────────────────────────────────────────────────────────────
3939
│ Layer 4: Catalog Layer (catalog/index.c + include/catalog/pg_index.h) │
40-
│ ─ Adds the pg_index.indisunusable column │
41-
│ ─ index_set_unusable(): a standalone catalog update function │
42-
│ structurally mirroring index_set_state_flags() │
43-
│ ─ index_create()'s values[] array is extended with an initial │
44-
│ value (false) for this column │
45-
│ ─ reindex_index() clears this flag as part of its existing │
46-
│ "repair index state" branch │
47-
└───────────────────────────────────┘
48-
49-
┌───────────────────────────────────┐
50-
│ Layer 5: Planner / Executor (plancat.c + BuildIndexInfo) │
51-
│ ─ get_relation_info() skips indexes with indisunusable set │
52-
│ ─ BuildIndexInfo() makes ii_ReadyForInserts reflect this flag as │
53-
│ well, so the existing skip logic in execIndexing.c naturally │
54-
│ covers it — no changes to the executor itself are needed │
55-
└───────────────────────────────────┘
40+
│ ─ Adds the pg_index.indisunusable column
41+
│ ─ index_set_unusable(): a standalone catalog update function
42+
│ structurally mirroring index_set_state_flags()
43+
│ ─ index_create()'s values[] array is extended with an initial
44+
│ value (false) for this column
45+
│ ─ reindex_index() clears this flag as part of its existing
46+
│ "repair index state" branch
47+
└─────────────────────────────────────────────────────────────────────────
48+
49+
┌───────────────────────────────────────────────────────────────────────
50+
│ Layer 5: Planner / Executor (plancat.c + BuildIndexInfo)
51+
│ ─ get_relation_info() skips indexes with indisunusable set
52+
│ ─ BuildIndexInfo() makes ii_ReadyForInserts reflect this flag as
53+
│ well, so the existing skip logic in execIndexing.c naturally
54+
│ covers it — no changes to the executor itself are needed
55+
└───────────────────────────────────────────────────────────────────────
5656
```
5757

5858
=== Grammar and Parsing

0 commit comments

Comments
 (0)