Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/internal/WASIX_PATCH_STACK.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ src/runtimes/liboliphaunt/wasix/tools/check-patch-stack.mjs --write
| 39 | `0039-oliphaunt-wasix-inline-sigsetjmp.patch` | Oliphaunt Maintainers <[email protected]> | oliphaunt-wasix: inline sigsetjmp |
| 40 | `0040-oliphaunt-wasix-set-libpq-sockets-nonblocking.patch` | Oliphaunt Maintainers <[email protected]> | oliphaunt-wasix: set libpq sockets nonblocking |
| 41 | `0041-oliphaunt-wasix-honor-noninteractive-psql-invocations.patch` | Oliphaunt Maintainers <[email protected]> | oliphaunt-wasix: honor noninteractive psql invocations |
| 42 | `0042-oliphaunt-wasix-default-wal-sync-to-fdatasync.patch` | Oliphaunt Maintainers <[email protected]> | oliphaunt-wasix: use explicit WAL sync operations |
| 42 | `0042-oliphaunt-wasix-use-explicit-wal-sync-operations.patch` | Oliphaunt Maintainers <[email protected]> | oliphaunt-wasix: use explicit WAL sync operations |

## Changed Upstream Files

Expand All @@ -74,7 +74,7 @@ src/runtimes/liboliphaunt/wasix/tools/check-patch-stack.mjs --write
| `src/backend/access/nbtree/nbtinsert.c` | `0017-oliphaunt-wasix-keep-btree-delete-scratch-on-stack.patch` | Adds the guarded int4 insert fast path. |
| `src/backend/access/nbtree/nbtsearch.c` | `0016-oliphaunt-wasix-add-btree-int4-compare-fast-path.patch`, `0026-oliphaunt-wasix-add-first-int4-leaf-compare-fast-path.patch` | Adds guarded int4 leaf fast paths. |
| `src/backend/access/transam/xact.c` | `0015-oliphaunt-wasix-add-top-xid-current-transaction-fast-path.patch` | Adds top-level current-transaction shortcut for embedded WASIX. |
| `src/backend/access/transam/xlog.c` | `0027-oliphaunt-wasix-avoid-xlog-size-checkpoint-requests.patch`, `0030-oliphaunt-wasix-avoid-xlogwrite-prevseg-division.patch`, `0042-oliphaunt-wasix-default-wal-sync-to-fdatasync.patch` | Keeps checkpoint work local, avoids expensive segment division, and exposes only explicit WAL sync operations under embedded WASIX. |
| `src/backend/access/transam/xlog.c` | `0027-oliphaunt-wasix-avoid-xlog-size-checkpoint-requests.patch`, `0030-oliphaunt-wasix-avoid-xlogwrite-prevseg-division.patch`, `0042-oliphaunt-wasix-use-explicit-wal-sync-operations.patch` | Keeps checkpoint work local, avoids expensive segment division, and exposes only explicit WAL sync operations under embedded WASIX. |
| `src/backend/commands/collationcmds.c` | `0033-oliphaunt-wasix-control-initdb-collation-discovery.patch` | System-collation import preserves PostgreSQL semantics unless a controlled seed producer suppresses discovery. |
| `src/backend/commands/copyfromparse.c` | `0006-oliphaunt-wasix-report-copy-protocol-state.patch` | Reports COPY protocol state to the host. |
| `src/backend/commands/copyto.c` | `0006-oliphaunt-wasix-report-copy-protocol-state.patch` | Reports COPY protocol state to the host. |
Expand Down Expand Up @@ -108,7 +108,7 @@ src/runtimes/liboliphaunt/wasix/tools/check-patch-stack.mjs --write
| `src/include/libpq/libpq-be.h` | `0002-oliphaunt-wasix-add-backend-host-io-hooks.patch` | Adds the host I/O callback table to Port only for embedded WASIX. |
| `src/include/port/atomics.h` | `0036-oliphaunt-wasix-specialize-single-backend-atomics.patch` | Selects scalar atomics only for the explicitly single-backend WASIX build. |
| `src/include/port/atomics/arch-wasix-single.h` | `0036-oliphaunt-wasix-specialize-single-backend-atomics.patch` | Preserves PostgreSQL atomic layouts and contracts without guest atomic instructions. |
| `src/include/port/wasix-dl.h` | `0001-oliphaunt-wasix-add-wasix-dl-build-spine.patch`, `0004-oliphaunt-wasix-add-host-lifecycle-exports.patch`, `0005-oliphaunt-wasix-add-loop-pumped-protocol-exports.patch`, `0006-oliphaunt-wasix-report-copy-protocol-state.patch`, `0009-oliphaunt-wasix-route-process-identity-through-port.patch`, `0010-oliphaunt-wasix-route-sysv-shmem-through-port.patch`, `0012-oliphaunt-wasix-capture-startup-errors.patch`, `0013-oliphaunt-wasix-fail-active-portals-on-host-recovery.patch`, `0034-oliphaunt-wasix-declare-hybrid-protocol-transport.patch`, `0039-oliphaunt-wasix-inline-sigsetjmp.patch`, `0042-oliphaunt-wasix-default-wal-sync-to-fdatasync.patch` | Defines the embedded WASIX port header, durability default, ABI redirects, and call-site SJLJ contract. |
| `src/include/port/wasix-dl.h` | `0001-oliphaunt-wasix-add-wasix-dl-build-spine.patch`, `0004-oliphaunt-wasix-add-host-lifecycle-exports.patch`, `0005-oliphaunt-wasix-add-loop-pumped-protocol-exports.patch`, `0006-oliphaunt-wasix-report-copy-protocol-state.patch`, `0009-oliphaunt-wasix-route-process-identity-through-port.patch`, `0010-oliphaunt-wasix-route-sysv-shmem-through-port.patch`, `0012-oliphaunt-wasix-capture-startup-errors.patch`, `0013-oliphaunt-wasix-fail-active-portals-on-host-recovery.patch`, `0034-oliphaunt-wasix-declare-hybrid-protocol-transport.patch`, `0039-oliphaunt-wasix-inline-sigsetjmp.patch`, `0042-oliphaunt-wasix-use-explicit-wal-sync-operations.patch` | Defines the embedded WASIX port header, durability default, ABI redirects, and call-site SJLJ contract. |
| `src/include/port/wasix-dl/sys/ipc.h` | `0010-oliphaunt-wasix-route-sysv-shmem-through-port.patch` | Provides the WASIX SysV IPC shim surface. |
| `src/include/port/wasix-dl/sys/shm.h` | `0010-oliphaunt-wasix-route-sysv-shmem-through-port.patch` | Provides the WASIX SysV shared-memory shim surface. |
| `src/include/storage/s_lock.h` | `0035-oliphaunt-wasix-use-single-backend-spinlocks.patch` | Specializes spinlocks only for the enforced single-backend WASIX runtime. |
Expand Down Expand Up @@ -137,15 +137,15 @@ src/runtimes/liboliphaunt/wasix/tools/check-patch-stack.mjs --write
| Single-backend WASIX atomics preserve ABI and operation contracts | `0036-oliphaunt-wasix-specialize-single-backend-atomics.patch` | `override CPPFLAGS += -DOLIPHAUNT_WASM_SINGLE_BACKEND_ATOMICS`, `postmaster mode is unavailable in the single-backend WASIX runtime`, `PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY`, `volatile uint64 value pg_attribute_aligned(8)`, `*expected = current` | Shared guest backend objects use scalar operations for Rust and TypeScript hosts; frontends, extensions, and every concurrent PostgreSQL build retain normal atomics. |
| WASIX strong randomness avoids descriptor pressure and forked state | `0037-oliphaunt-wasix-buffer-strong-random.patch` | `#elif defined(__wasi__)`, `wasix_strong_random_fill(void *buf, size_t len)`, `#if defined(OLIPHAUNT_WASM_SINGLE_USER)`, `wasix_strong_random_fill(wasix_strong_random_pool`, `if (errno == EINTR)`, `wasix_strong_random_used += copy_len`, `No guest-side state in a process that may fork.` | Every WASIX backend bypasses the virtual random device. The embedded backend amortizes host calls, while fork-capable backends keep no duplicable random state. |
| Unsupported writeback hints stay separate from real durability | `0038-oliphaunt-wasix-disable-unsupported-writeback-hints.patch` | `#if defined(OLIPHAUNT_WASM_SINGLE_USER)`, `Actual fsync/fdatasync durability remains enabled.`, `#elif defined(HAVE_SYNC_FILE_RANGE)` | The single-backend guest omits only pg_flush_data hints that WASIX rejects on read-only descriptors; PostgreSQL fsync and fdatasync remain active. |
| WASIX WAL durability exposes only explicit sync operations | `0042-oliphaunt-wasix-default-wal-sync-to-fdatasync.patch` | `PLATFORM_DEFAULT_WAL_SYNC_METHOD`, `WAL_SYNC_METHOD_FDATASYNC`, `OLIPHAUNT_WASM_EXPLICIT_WAL_SYNC_ONLY`, `explicit fd_datasync operation` | The shared PostgreSQL port selects fdatasync and removes open_sync/open_datasync from the WASIX GUC choices because Wasmer does not honor their open flags. |
| WASIX WAL durability exposes only explicit sync operations | `0042-oliphaunt-wasix-use-explicit-wal-sync-operations.patch` | `PLATFORM_DEFAULT_WAL_SYNC_METHOD`, `WAL_SYNC_METHOD_FDATASYNC`, `OLIPHAUNT_WASM_EXPLICIT_WAL_SYNC_ONLY`, `explicit fd_datasync operation` | The shared PostgreSQL port selects fdatasync and removes open_sync/open_datasync from the WASIX GUC choices because Wasmer does not honor their open flags. |
| PostgreSQL side modules own their SJLJ catch frames | `0039-oliphaunt-wasix-inline-sigsetjmp.patch` | `-DOLIPHAUNT_WASM_SIDE_MODULE`, `WebAssembly SJLJ requires setjmp to be visible at the protected call site.`, `defined(__wasm_exception_handling__) && defined(OLIPHAUNT_WASM_SIDE_MODULE)`, `#undef sigsetjmp`, `#define sigsetjmp(env, savesigs) ((void) (savesigs), setjmp(env))` | PG_TRY expands to a compiler-recognized setjmp in every PostgreSQL side module, so nested errors unwind to the live module-local handler. |
| Standalone WASIX libpq sockets are actually nonblocking | `0040-oliphaunt-wasix-set-libpq-sockets-nonblocking.patch` | `defined(SOCK_NONBLOCK) && !defined(__wasi__)`, `!defined(SOCK_NONBLOCK) || defined(__wasi__)`, `pg_set_noblock(conn->sock)` | WASIX uses PostgreSQL's existing fcntl fallback because Wasmer ignores socket type flags; native platforms retain upstream atomic socket creation. |
| Captured Oliphaunt psql scripts remain noninteractive | `0041-oliphaunt-wasix-honor-noninteractive-psql-invocations.patch` | `OLIPHAUNT_PSQL_NONINTERACTIVE`, `strcmp(oliphaunt_noninteractive, "1") == 0`, `!isatty(fileno(stdin)) || !isatty(fileno(stdout))` | Only the private exact-value marker overrides virtual terminal detection; ordinary WASIX psql retains upstream isatty semantics. |

## PostgreSQL Patch Symbols

- `OLIPHAUNT_WASM_EXIT_ALIVE` (`0004-oliphaunt-wasix-add-host-lifecycle-exports.patch`, `0005-oliphaunt-wasix-add-loop-pumped-protocol-exports.patch`)
- `OLIPHAUNT_WASM_EXPLICIT_WAL_SYNC_ONLY` (`0042-oliphaunt-wasix-default-wal-sync-to-fdatasync.patch`)
- `OLIPHAUNT_WASM_EXPLICIT_WAL_SYNC_ONLY` (`0042-oliphaunt-wasix-use-explicit-wal-sync-operations.patch`)
- `OLIPHAUNT_WASM_HOST_EXPORT` (`0003-oliphaunt-wasix-export-startup-packet-parser.patch`, `0004-oliphaunt-wasix-add-host-lifecycle-exports.patch`, `0005-oliphaunt-wasix-add-loop-pumped-protocol-exports.patch`)
- `OLIPHAUNT_WASM_SIDE_MODULE` (`0039-oliphaunt-wasix-inline-sigsetjmp.patch`)
- `OLIPHAUNT_WASM_SINGLE_BACKEND_ATOMICS` (`0035-oliphaunt-wasix-use-single-backend-spinlocks.patch`, `0036-oliphaunt-wasix-specialize-single-backend-atomics.patch`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@
0039-oliphaunt-wasix-inline-sigsetjmp.patch
0040-oliphaunt-wasix-set-libpq-sockets-nonblocking.patch
0041-oliphaunt-wasix-honor-noninteractive-psql-invocations.patch
0042-oliphaunt-wasix-default-wal-sync-to-fdatasync.patch
0042-oliphaunt-wasix-use-explicit-wal-sync-operations.patch
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ series = [
"0039-oliphaunt-wasix-inline-sigsetjmp.patch",
"0040-oliphaunt-wasix-set-libpq-sockets-nonblocking.patch",
"0041-oliphaunt-wasix-honor-noninteractive-psql-invocations.patch",
"0042-oliphaunt-wasix-default-wal-sync-to-fdatasync.patch",
"0042-oliphaunt-wasix-use-explicit-wal-sync-operations.patch",
]
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ const REQUIRED_AUDIT_CHECKS = [
},
{
requirement: 'WASIX WAL durability exposes only explicit sync operations',
patches: ['0042-oliphaunt-wasix-default-wal-sync-to-fdatasync.patch'],
patches: ['0042-oliphaunt-wasix-use-explicit-wal-sync-operations.patch'],
evidence: [
'PLATFORM_DEFAULT_WAL_SYNC_METHOD',
'WAL_SYNC_METHOD_FDATASYNC',
Expand Down
4 changes: 2 additions & 2 deletions tools/xtask/src/postgres_guard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pub(crate) fn check_postgres_source_spine() -> Result<()> {
"0037-oliphaunt-wasix-buffer-strong-random.patch",
"0038-oliphaunt-wasix-disable-unsupported-writeback-hints.patch",
"0039-oliphaunt-wasix-inline-sigsetjmp.patch",
"0042-oliphaunt-wasix-default-wal-sync-to-fdatasync.patch",
"0042-oliphaunt-wasix-use-explicit-wal-sync-operations.patch",
] {
ensure!(
series.contains(&required),
Expand Down Expand Up @@ -198,7 +198,7 @@ pub(crate) fn check_postgres_source_spine() -> Result<()> {
)?;
ensure_file_contains_all(
&Path::new(POSTGRES_PATCH_DIR)
.join("0042-oliphaunt-wasix-default-wal-sync-to-fdatasync.patch"),
.join("0042-oliphaunt-wasix-use-explicit-wal-sync-operations.patch"),
&[
"src/include/port/wasix-dl.h",
"PLATFORM_DEFAULT_WAL_SYNC_METHOD",
Expand Down
Loading