I am Sara Nabih, the accepted contributor for the WAL & MCP project with the PostgreSQL/pgmoneta ecosystem during Google Summer of Code 2026.
PostgreSQL's Write-Ahead Log (WAL) is the binary stream used for crash recovery, replication, and point-in-time recovery. My project built on the previous pgmoneta-walfilter work by improving WAL compatibility and inspection, adding MCP-driven WAL workflows, and researching whether physical WAL can be translated between PostgreSQL major versions.
I worked on PostgreSQL 19 compatibility, timestamp-based WAL inspection, walinfo support in the Rust-based pgmoneta_mcp daemon, and walbridge, an experimental PostgreSQL 18 to PostgreSQL 19 translation proxy. pgmoneta-walfilter changes selected records while preserving a WAL stream's layout; walinfo analyzes that stream; pgmoneta_mcp exposes pgmoneta operations to MCP clients; and walbridge translates a stream whose target records can have different LSN positions.
- Original Proposal:WAL & MCP proposal
- Email:nabihsara8@gmail.com
- LinkedIn:Sara Nabih
- Progress Report:pgmoneta discussion #1135
My original proposal covered advanced WAL filtering, PostgreSQL 19 compatibility, MCP-driven WAL workflows, timestamp-based transaction inspection, and automated validation. During the project, the work concentrated on the compatibility, inspection, MCP, and walbridge research tracks.
PostgreSQL 19 compatibility, commit-timestamp support, MCP walinfo, and the walbridge PoC all have concrete issues, pull requests, or branches. The planned relation-, RMGR-, user-, and LSN-range filtering extensions do not have distinct authored issues or pull requests in the reviewed history, so I do not present them as delivered. The walbridge work also expanded beyond the original filtering direction because the format comparison exposed a substantial, separate research question: whether record translation across major PostgreSQL versions is technically feasible.
I began by investigating the PostgreSQL 19 WAL-format changes and comparing the PostgreSQL source definitions with pgmoneta's WAL reader and descriptor code. This work was tracked in issue #1136 and PR #1137, and was later integrated into main.
The change updated the WAL reader, record-description code, walinfo, fixtures, tests, and documentation for the official PostgreSQL 19 format available at that time. I removed assumptions about temporary development-only layouts, including a transient xl_running_xacts change, and updated the reader for the PostgreSQL 19 page and heap-record evolution. I also fixed unsafe temporary WAL-file handling: extracting a WAL file with a predictable name in /tmp could otherwise allow stale data from a previous run to be read instead of the requested file.
PostgreSQL 19 changed again between Beta 3 and Beta 4. I created a separate pg19-beta4 branch, tracked by issue #1492, so that this compatibility update did not alter the walbridge PoC's Beta 3 target silently. The compatibility update was merged upstream through PR #1509, bringing pgmoneta in line with the PostgreSQL 19 Beta 4 definitions.
The update changes the accepted PostgreSQL 19 WAL magic from 0xD121 to 0xD122, adds PG_CONTROL_VERSION 1905, and updates ControlFileData to its final Beta 4 layout. It handles data_checksum_version_init, the related control-file CRC and field-offset changes, the final 96-byte checkpoint layout, logical_decoding_enabled, and the 64-bit next_multi_offset. I also corrected XLOG_CHECKPOINT_REDO to opcode 0xE0 with the final four-byte wal_level payload. The branch includes focused fixtures and tests for the magic number, checkpoint layout, control-file CRC placement, page geometry, and checkpoint-redo decoding.
One goal of the project was to make time-based WAL inspection practical. WAL records do not always contain a useful transaction timestamp directly, so I investigated PostgreSQL's commit-timestamp infrastructure and chose to use track_commit_timestamp instead of adding a separate metadata/indexing service.
This work is tracked in issue #1173 and PR #1174, and was later integrated into main. It updates the WAL reader, server integration, walinfo, test-server configuration, and WAL test utilities. When PostgreSQL is configured with track_commit_timestamp, transaction-associated WAL records can be correlated with their commit time through the XID.
This was an important design decision. A separate temporal index could answer more historical questions, but it would introduce its own storage, maintenance, and consistency requirements. Reusing PostgreSQL's existing commit-timestamp data gives pgmoneta a smaller and more maintainable solution for this feature. It also makes the limitation explicit: timestamps cannot be reconstructed if the source server did not record them.
I added walinfo support to the Rust-based pgmoneta_mcp daemon. The work is tracked by issue #124 and PR #127.
The implementation adds a walinfo client module and MCP handler, configuration and constants, API and user/developer documentation, handler tests, and a dedicated walinfo test. The goal is that an MCP client can ask for WAL information for a configured pgmoneta server through the existing management interface, rather than requiring a local command-line session.
This contribution connects the WAL analysis features in pgmoneta with AI-assisted and automated operational workflows. It keeps the actual WAL parsing in pgmoneta while giving clients a structured way to invoke that functionality.
The largest part of my project was walbridge, documented in research discussion #1229, tracked in issue #1238, developed on the walbridge branch, and merged upstream through PR #1239.
In simple terms, walbridge receives PostgreSQL 18 WAL, stores the original data, and translates it into PostgreSQL 19 format when a downstream client requests it.
The initial question was whether a PostgreSQL 18 primary could send physical WAL through a proxy that translates it into PostgreSQL 19 format for a downstream client. Before writing the migration code, I compared the two WAL formats record by record. This separated records that can pass through unchanged from fields that can be reconstructed from cluster configuration, layouts that can be rearranged mechanically, records that need synthesis or removal, and records that change serialized size.
One of the biggest challenges I encountered was discovering that translated WAL records can change size. This means that the LSN in the translated stream can differ from the corresponding upstream LSN. A proxy cannot simply forward xl_prev, replication feedback, restart positions, or reconnect requests unchanged. This led me to implement a persistent bidirectional LSN map. The encoder uses it when it emits translated WAL, and the sender uses it to map downstream feedback and resume positions back to the raw PostgreSQL 18 archive.
I chose a raw-WAL-only, translate-on-delivery design. The receiver uses pgmoneta's WAL client to fetch and retain raw PostgreSQL 18 WAL. When a downstream client requests WAL, the sender reads the retained raw records, passes changed records through the migration engine, and encodes a PostgreSQL 19 Beta 3 stream. The local archive remains ordinary source WAL rather than a second translated-WAL archive.
This decision keeps the original WAL usable by pgmoneta's existing tools and ensures that historical replay and live streaming share one decoding, migration, and encoding path. The persistent LSN map connects that delivery path to the feedback-based retention path: downstream flush feedback is converted back to the raw-WAL location and becomes the pruning watermark.
The implementation adds a pgmoneta-walbridge executable, configuration support, process orchestration, raw archive management, persistent forward and reverse LSN maps, a PG18-to-PG19-Beta-3 migration engine, a target WAL encoder, and user/developer documentation. On the downstream side it implements the physical-replication protocol subset required by the PoC: authentication, IDENTIFY_SYSTEM, READ_REPLICATION_SLOT, START_REPLICATION, XLogData, keepalives, and standby-status feedback.
The migration engine handles the changed PostgreSQL 18 to 19 record families: checkpoints, XLOG_CHECKPOINT_REDO, heap prune and visible records, MultiXact create/truncate records, GiST ASSIGN_LSN, end-of-recovery records, and the relevant heap flags. Unchanged record families retain their payload bytes, while the encoder rebuilds their target placement, page framing, xl_prev, and CRC.
The encoder writes PostgreSQL 19 page headers, preserves alignment, creates continuation records where a record crosses a page, rotates at segment boundaries, and calculates CRC32C for emitted records. This is essential because changing a record body invalidates its original CRC, and because a valid WAL file is more than a collection of individually valid records: the page headers, record chain, and continuation semantics must also be valid.
The work exposed several correctness bugs around partial WAL and segment boundaries. I corrected cross-segment continuation reconstruction so that record offsets are anchored at the page's fixed data start rather than a file cursor that has already advanced past a page header. I restricted partial-record reassembly to the immediate successor segment, preventing a stale fragment from an unrelated stream being joined accidentally. I also added CRC checking for records read from growing preallocated segments, so a zero-filled unwritten tail is deferred until real data arrives instead of being emitted as corrupt translated WAL.
These fixes matter outside of walbridge as well: WAL parsing at a segment boundary must preserve the exact record position and must distinguish an incomplete live tail from an invalid record.
The walbridge data flow is deliberately small and keeps raw WAL as the durable source of truth:
PG18 primary → WAL receiver → raw local WAL archive
↓
decoder / migration engine
↓
PG19 client ← physical sender ← PG19 WAL encoder
↕
persistent LSN map
The LSN map connects the two WAL address spaces. The encoder uses it while producing the target stream, and the sender uses it to map downstream feedback and resume requests to the raw PostgreSQL 18 archive. The other project components build on pgmoneta's version-aware reader: commit timestamps are resolved only when PostgreSQL recorded them, and MCP invokes walinfo through a client and handler rather than duplicating WAL parsing.
The central walbridge challenge was LSN stability. pgmoneta-walfilter can replace a record with a same-position XLOG_NOOP, but walbridge may change a record's serialized size. That affects record chaining, replication feedback, restart positions, and reconnect requests. The persistent bidirectional LSN map was therefore an architectural requirement, not an optimization.
Another challenge was distinguishing format differences that really require data translation from differences that only need a page-header rewrite or no change at all. I based the migration matrix on PostgreSQL's redo and validation behavior, not only on C structure diffs. This made it possible to identify whether a field was required, reconstructable, or irrelevant to correct replay.
The PostgreSQL 19 Beta 4 changes reinforced that compatibility work must follow final upstream definitions instead of development snapshots. Keeping the Beta 4 reader/control-file update on a separate branch avoided silently changing the PG19 Beta 3 walbridge target.
The MCP and timestamp work also reinforced that useful operational tooling depends on clear boundaries. pgmoneta_mcp provides the structured access layer, while pgmoneta remains responsible for WAL decoding. Commit-time queries depend on PostgreSQL having collected commit timestamps in the first place; a tool must make that prerequisite clear rather than manufacture a value it cannot know.
The PostgreSQL 19 compatibility update (PR #1509), transaction timestamp changes, and walbridge PoC (PR #1239) have been merged upstream. Future work includes reviewing MCP PR #127 and further evolving and validating walbridge against PostgreSQL 19 release formats.
The most important validation work is a reproducible real-binary PG18 → walbridge → PG19 pg_receivewal → pg_waldump run with preserved commands, logs, and received-WAL artifacts. The three walbridge Clang Debug failures also need investigation. A future project can decide whether real cross-major physical-standby recovery is a goal; it should not be inferred from the current client-tool PoC.
This project gave me practical experience with PostgreSQL internals that are normally invisible to application developers: physical WAL layout, record CRCs, page continuations, resource managers, control-file compatibility, replication protocol messages, and the effect of LSNs on recovery and replication.
My most important lesson was that binary compatibility is a behavioral problem, not only a C-structure comparison. Reading PostgreSQL's redo and validation paths was necessary to decide whether a changed field was required, reconstructable, or safe to ignore. The work also showed me the value of separating experimental architecture from compatibility maintenance and of reporting the boundary between tested behavior and design intent precisely.
I would like to thank @jesperpedersen for his continuous support and mentorship during GSoC. His thorough reviews and valuable suggestions encouraged me to look beyond the initial implementation, pay closer attention to edge cases, and develop a deeper understanding of PostgreSQL internals. His guidance also helped me make better technical decisions and approach challenges more thoughtfully.
I'm also grateful to the pgmoneta community for being so welcoming and supportive. Their willingness to answer questions, share knowledge, and provide helpful feedback made my GSoC journey both enjoyable and rewarding.