Skip to content

Navigation Menu

Sign in
Sign up

Doc: Add Core Internals handbook under docs/ - #1971

Open
my-ship-it wants to merge 1 commit into
apache:main from
my-ship-it:doc/core-internals-handbook
Open

Doc: Add Core Internals handbook under docs/ #1971
my-ship-it wants to merge 1 commit into
apache:main from
my-ship-it:doc/core-internals-handbook

Conversation

@my-ship-it

@my-ship-it my-ship-it commented Sep 8, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

Summary

Adds a developer-oriented handbook for the Cloudberry kernel under
docs/core-internals/ — 21 chapters, 104 sections, organised into five
parts after the structure of Rogov's PostgreSQL 14 Internals.

Coverage: storage and data layout (heap, AO/AOCS, PAX, indexes, the
catalog), transactions and MVCC (isolation, snapshots, vacuum, locks and
the global deadlock detector, distributed transactions and 2PC), query
processing (stages, statistics, the PostgreSQL planner, distributed
planning, ORCA, the executor, Motion and the interconnect), high
availability and recovery, and resource management.

Read the handbook as a PDF (652 pages, 20 MB) so you can
review the content without building the site. All 113 diagrams are rendered
as vector SVG and the text is selectable and searchable. It was produced by
printing the handbook's HTML edition from a headless browser, so layout and
typography match the source. The file is a release asset, deliberately not
part of this diff — a 20 MB binary does not belong in the repository's
history.

What the chapters contain

Code excerpts 372, each fenced with title="file:line" pointing at the source it was read from
Captured psql sessions 487, split into an input block and an output block — transcripts from a running cluster, not illustrations
Diagrams 113 mermaid + 64 SVG figures
Cross-references internal §N.M links that resolve to section anchors and are checked at build time

Why here, and how the site uses it

The directory is written for Docusaurus so that apache/cloudberry-site
can pull it in as a git submodule with a sparse checkout limited to
docs/core-internals, served by its own docs plugin instance with an
autogenerated sidebar — the same arrangement already used for the PXF
documentation (apache/cloudberry-site#372). Keeping the source next to the
code it describes means a change to the engine and the change to its
description can travel in one commit.

A follow-up PR against cloudberry-site will add the submodule and the
three config touch points. It has to come second, since the submodule
needs a commit on this side to point at.

Nothing here depends on site-level configuration except one small MDX
component: 37 figures are CSS-laid-out HTML rather than SVG, and are handed
to that component as a string so MDX does not try to parse them as JSX. The
component and its CSS are a few lines and are described in the README.

Verification

  • Docusaurus 3 / MDX v3, built locally: no MDX compilation errors, no
    broken links, no broken anchors, 23 pages, all 64 figures resolved.
  • Apache RAT: every one of the 92 files carries the ASF license header,
    so no pom.xml exclusions are needed.
  • No environment-specific detail: host names, addresses and install
    paths from the machine the sessions were captured on are replaced with
    documentation-safe equivalents of identical width, so the column
    alignment of captured output is preserved. Verified across the markdown,
    the HTML and the PDF.

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Passed make installcheck
  • Passed make -C src/test installcheck-cbdb-parallel

Impact

Performance: None. No code is touched.

User-facing changes: New documentation. Nothing changes for existing
users until cloudberry-site links it in.

Dependencies: None added to this repository. A site that renders the
diagrams needs @docusaurus/theme-mermaid; without it the mermaid blocks
degrade to code blocks and everything else renders unchanged.

Checklist

Additional Context

On maintenance. The chapters describe a specific point in the tree's
history. Prose is the durable part; line numbers are the perishable part.
The title="file:line" convention is machine-readable on purpose — a CI
job can verify that every cited path still exists, which catches the worst
class of drift (a file that moved or was deleted) cheaply. I would rather
agree on that check in review than add it unilaterally here.

On the size of the review. This is a large diff and I do not expect
anyone to read 29k lines in a PR. Reading order that costs the least: the
attached PDF for the content, docs/core-internals/README.md for the
layout and conventions, and one chapter of your choice for the texture —
ch02 is the shortest, ch18 the most demanding. Chapter-level corrections
are welcome as ordinary follow-up PRs.

On the branch base. This branch is cut from an April snapshot of main
rather than today's tip, so GitHub will report it as behind. That is an
artifact of how it was pushed, not of the content: all 93 files are new
paths under docs/core-internals/, nothing else is touched, and the diff
GitHub computes is exactly those 93 additions. Happy to rebase onto current
main if you would rather review it that way.

On AI assistance. Disclosed above per AI_GUIDELINE.md. The generation
was AI-assisted; the technical claims, the code citations and the captured
sessions are mine to answer for, and I will answer review questions
directly rather than through a tool.

tuhaihe, leborchuk, and Alena0704 reacted with thumbs up emoji

Copy link
Copy Markdown
Contributor

That's awesome! I'll try to read it, cannot say could read the whole document within a day, but try my best )

Copy link
Copy Markdown
Contributor Author

That's awesome! I'll try to read it, cannot say could read the whole document within a day, but try my best )

Thanks a lot! Some oversights are inevitable. Really appreciate your time — no pressure to finish it in one day, just take your time.

Add a developer-oriented handbook for the Cloudberry kernel: 21
chapters and 104 sections covering storage, indexing, the catalog,
the executor (single-node and distributed), the dual optimizer
(PostgreSQL planner and ORCA), transactions, HA/recovery, and
resource management. It is organised into five parts after the
structure of Rogov's "PostgreSQL 14 Internals".
The content is written for Docusaurus so that apache/cloudberry-site
can pull it in as a submodule with a sparse checkout limited to
docs/core-internals, served by its own docs plugin instance with an
autogenerated sidebar -- the same arrangement already used for the
PXF documentation. It renders on GitHub as-is too.
What the chapters contain:
 - 372 code excerpts, each fenced with title="file:line" so a
 reader can go straight to the source it was read from
 - 487 psql sessions captured from a running cluster, split into
 an input block and an output block
 - 113 mermaid diagrams and 64 SVG figures
 - internal cross-references that resolve to section anchors and
 are validated at build time
Host names, addresses and install paths belonging to the machine
the sessions were captured on are replaced with documentation-safe
equivalents of identical width, so the column alignment of captured
output is preserved.
Every file carries the ASF license header, so no pom.xml RAT
exclusions are needed. The tree was verified against Docusaurus 3
with MDX v3: no compilation errors, no broken links, no broken
anchors.
See docs/core-internals/README.md for the layout, the conventions
and a note on maintenance -- file and line references describe a
point in the tree's history and will drift, which the
title="file:line" convention makes machine-checkable.
my-ship-it force-pushed the doc/core-internals-handbook branch from fa603a4 to 4208df9 Compare September 9, 2026 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@leborchuk leborchuk Awaiting requested review from leborchuk
@tuhaihe tuhaihe Awaiting requested review from tuhaihe
@yjhjstz yjhjstz Awaiting requested review from yjhjstz
@x4m x4m Awaiting requested review from x4m
@reshke reshke Awaiting requested review from reshke
@Smyatkin-Maxim Smyatkin-Maxim Awaiting requested review from Smyatkin-Maxim

At least 2 approving reviews are required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /