Repository navigation
Conversation
01237c9 to
3b56d29
Compare
c2a5026 to
d8fed9e
Compare
c999d4e to
d3a10f3
Compare
14db4ac to
bad9884
Compare
Recognize heap-only tuples with direct index anchors, xid-free collapse stubs and multiple redirects to one live tuple as valid heap representations, while continuing to check their chains. For heapallindexed, fingerprint the stored leaf keys with the TID of the snapshot-visible version reached through a valid anchor. Reject anchors that cross changes to the index, including away-and-back changes. Probe with the scanned heap version rather than a rebuilt anchor, so different valid anchors do not report missing entries and a broken chain cannot borrow coverage from another tuple. Use this path for heap handler aliases too. Validate raw TID bounds, physical links, tuple headers and bitmap bounds under the buffer share lock before walking visibility. In particular, never let an invalid block number reach a read that could extend the heap. Respect saved stub widths and ordinary off-page update links. Cover rebuilt anchors, concurrent updates and vacuum, aliases, old stub widths and corrupt keys, TIDs and chains. Check backend survival and unchanged heap storage after corruption errors. Carry selective chains and collapsed stubs through pg_upgrade as well. Add the pageinspect and recovery suites here, after both statistics and selective-aware amcheck are available. These include repeated prune replay and visibility map initialization without an applicable full-page image, with full-page writes and consistency checking both on and off, and visibility map tail truncation. Discussion: https://postgr.es/m/af02b486-6adc-494c-a357-1dd72f655dcf%40app.fastmail.com
Core disqualifies HOT-indexed updates unconditionally on the logical-replication apply path: HeapUpdateHotAllowable returns HEAP_UPDATE_ALL_INDEXES whenever IsLogicalWorker() is true, because a HOT-indexed update of a replica-identity attribute leaves a stale index leaf that the apply worker's replica-identity lookups would otherwise be exposed to. This commit relaxes that unconditional bail-out with a per-subscription hot_indexed_on_apply option (subhotindexedonapply: off / subset_only (default) / always). HeapUpdateHotAllowable now consults it when running in an apply worker: "off" keeps the unconditional bail-out, "subset_only" allows the HOT-indexed path only when the relation's indexed attributes are a subset of its primary-key attributes, and "always" applies no apply-path gating. The apply worker's replica-identity lookups (see RelationFindReplTupleByIndex) cope with the stale leaf, but only when the indexed attributes are a subset of the replica identity, which is what the default subset_only enforces. Wire the option through CREATE/ALTER SUBSCRIPTION, pg_subscription, pg_dump, and psql's \dRs+, and document it (create_subscription, alter_subscription, catalogs). Cover apply under each mode (039), apply under REPLICA IDENTITY FULL and a non-PK USING INDEX whose key is cycled (040), and decoding of HOT-indexed update chains (test_decoding). Requires a catversion bump. Authored-by: Greg Burd <greg@burd.me> Discussion: https://postgr.es/m/af02b486-6adc-494c-a357-1dd72f655dcf%40app.fastmail.com
src/test/modules/test_locator_tableam provides table AMs that store
rows exactly as heap does and differ only in the locator properties
they declare, so the parts of the locator contract that heap does
not exercise run in the regression tests:
- heap_noretain declares old_version_retained = false. A
SnapshotAny fetch by locator follows the update chain to the
row's current version, which is what an AM that updates in place
hands back, so a caller that wrongly re-fetches an old row after
an UPDATE gets the new one and the test fails. It covers AFTER
ROW UPDATE and DELETE triggers, OLD and NEW transition tables,
deferred constraint triggers, foreign key CASCADE and RESTRICT,
RETURNING OLD, MERGE, the trigger-copy spill under a small
work_mem, temp_file_limit failures, savepoint rollback, and a
cross-partition update.
- heap_wide declares a 16-byte locator, so every path that builds
an index on it must fail, and pg_indexam_has_property() reports
can_var_locator false for every in-core index AM.
- heap_bigoffset declares offsets up to MaxOffsetNumber, so the
planner must not consider bitmap scans of it and GIN must refuse
to index it.
- heap_orrecheck sets bitmap_or_inexact, so BitmapOr consults it.
The executor's version-naming bits are not exercised, since all
these AMs use heap's lock and update code. This is test scaffolding
for reviewers and is not meant to be committed.
A/B and single-variant benchmark scripts for HOT-indexed updates: build two postgres variants, run pgbench workloads exercising classic-HOT, non-HOT, and HOT-indexed paths, and a self-contained bloat probe that reports the skip count (index writes avoided on unchanged indexes) and changed-index bounding. Not for merge; kept for evaluating the feature.
There was a problem hiding this comment.
🔍 OCR found 26 issue(s).
- 25 inline, 1 in summary (inline capped at 25)
📄 src/test/modules/test_locator_tableam/sql/noretain.sql (L186-L187)
pg_ls_tmpdir() lists every file in the instance-wide pgsql_tmp directory, not just this session's. The limit_kb here is derived from a global sum(size), then fed to the per-session GUC temp_file_limit. If any concurrent backend has temp files when line 186 runs (e.g. under make check-world / meson running suites in parallel), the computed limit is inflated, the DO-block UPDATE no longer exceeds temp_file_limit, and the expected NOTICE: spill failed is not emitted — a spurious diff failure. Likewise SELECT count(*) > 0 AS spilled (line 154) and the <= :tmp1 comparison across lines 208-210 can flip when another session creates or removes temp files between the two reads. Deterministic resource accounting like this belongs in a TAP test with a dedicated single-session cluster, not a regression .sql. (high confidence)
| ParameterNames: true | ||
| DeducedTypes: true | ||
| CompileFlags: | ||
| CompilationDatabase: build/ # Search build/ directory for compile_commands.json |
There was a problem hiding this comment.
This clangd config encodes an environment-specific layout: a relative CompilationDatabase: build/ and the mismatched include pair -I. plus -I../../../../src/include. The deep relative include assumes clangd is invoked from a specific nested working directory, while -I. assumes the tree root; indexing results will differ depending on where clangd runs. Combined with -DPGDLLIMPORT=, this is clearly a per-developer file that does not belong in the committed tree. Prefer a local (gitignored) config.
| inherit (shellConfig) gdbConfig flameGraphScript pgbenchScript; | ||
| }; | ||
|
|
||
| environment.localBinInPath = true; |
There was a problem hiding this comment.
environment.localBinInPath is a NixOS module option, but here it is placed inside the per-system attrset returned to flake-utils.lib.eachDefaultSystem. After eachDefaultSystem transposes the result it becomes environment.<system>.localBinInPath, which is not a recognized flake output and does nothing (NixOS modules are not evaluated from flake outputs this way). It is dead config that references a module option in the wrong scope; drop it.
| where lp_flags = 1 -- LP_NORMAL | ||
| and (t_infomask2 & 2048) <> 0 -- HEAP_INDEXED_UPDATED | ||
| and (t_infomask2 & 2047) = 0 -- natts == 0 (stub sentinel) | ||
| \gset |
There was a problem hiding this comment.
The \gset here binds :stub_off only if the query returns a row. If the SIU collapse ever fails to leave a stub on block 0 (feature regression, or a layout change), \gset leaves :stub_off unset and the following two heap_force_* lines expand :'stub_off' to the literal text stub_off, producing a confusing "variable not set"/parse error rather than a clear failure. The pinned .out (offset 3) already catches a missing/moved stub via the output diff, so this is low severity, but consider asserting the stub was found (e.g. SELECT count(*) ... = 1) before the \gset, or at least a comment noting the block-0/single-stub assumption, to make the failure mode obvious.
| -- the live row is intact and reachable after the collapse | ||
| select id, a, b from htomb; |
There was a problem hiding this comment.
The comment claims the row is "reachable after the collapse," but this bare SELECT (no WHERE, no scan-method GUCs disabled) is satisfied by a sequential scan and never walks the LP_REDIRECT chain through the index. Unlike the hstub block below (which sets enable_seqscan=off/enable_bitmapscan=off and filters on the indexed columns), this test does not actually verify index reachability after the collapse, so the assertion is weaker than the comment advertises. Consider disabling seqscan/bitmapscan and querying where a = 12 to truly exercise the redirect walk.
| static inline bool | ||
| table_locator_is_stable(Relation rel) | ||
| { | ||
| return RelationGetLocatorDesc(rel)->stable; | ||
| } |
There was a problem hiding this comment.
Consistency/footgun: RelationUpdatesInPlace() below deliberately short-circuits on rel->rd_tableam != NULL before calling table_locator_old_version_retained(), because a relation can lack a table AM (foreign table, view). But table_locator_is_stable() and table_locator_old_version_retained() themselves call RelationGetLocatorDesc(), which unconditionally dereferences rel->rd_tableam->relation_locator. No current caller reaches these two helpers with rd_tableam == NULL, so this is not a live NULL-deref today, but the asymmetry is an easy-to-misuse API. Consider documenting "caller must hold a table AM" on these two inline helpers (or on RelationGetLocatorDesc) to match the guard that RelationUpdatesInPlace found necessary.
| if (ItemPointerGetOffsetNumber(&(heaptup->t_self)) == FirstOffsetNumber && | ||
| PageGetMaxOffsetNumber(page) == FirstOffsetNumber) | ||
| PageGetMaxOffsetNumber(page) == FirstOffsetNumber && | ||
| ((PageHeader) page)->pd_upper == | ||
| ((PageHeader) page)->pd_special - MAXALIGN(heaptup->t_len)) |
There was a problem hiding this comment.
This change to the XLOG_HEAP_INIT_PAGE eligibility (adding the pd_upper == pd_special - MAXALIGN(t_len) orphan-bytes guard) is a self-contained WAL-consistency fix for the pre-existing lp_truncate_only / wal_consistency_checking interaction described in the comment. It is logically independent of the HOT-indexed feature (the triggering path, vacuum's PRUNE_VACUUM_CLEANUP second pass, exists on master today) and is duplicated in log_heap_update(). Bundling an independent bug fix into this large feature patch violates the "one logical change per commit" / minimal-diff discipline and complicates bisect/revert. Split it into its own commit so it can be reviewed and back-patched on its own merits. (moderate confidence)
| * with 2-bit _vm forks that are not rewritten. The committer re-picks both | ||
| * values at commit time, along with the copy in t/010_vm_conversion.pl. | ||
| */ | ||
| #define VISIBILITYMAP_WIDTH_CHANGE_CAT_VER 202610201 |
There was a problem hiding this comment.
The catalog-version threshold is hardcoded here and independently duplicated in t/010_vm_conversion.pl ($width_change_cat_ver = 202610201). If the two drift (e.g. the committer updates one copy but not the other at push time), pg_upgrade and its own test silently disagree about when to rewrite the VM: the test would skip or exercise the wrong path while clusters initdb'd in the gap keep unrewritten 2-bit _vm forks -- a silent-corruption footgun. The in-tree precedent (DEFAULT_CHAR_SIGNEDNESS_CAT_VER) is not cross-checked by a test, so this duplication is a genuine new hazard. Consider having the TAP test derive/compare the value from a single authoritative source, or at minimum add an explicit cross-reference note in the test pointing back to this macro (and vice versa) so the two are updated together. Confidence: moderate.
| val=$(psql_as "$v" -Atc \ | ||
| "SELECT coalesce(n_tup_hot_indexed_upd, 0) FROM pg_stat_user_tables WHERE relname='$table'" 2>/dev/null) | ||
| [[ "$val" =~ ^[0-9]+$ ]] || val=0 |
There was a problem hiding this comment.
siu_count silently swallows all psql errors via 2>/dev/null and treats any non-numeric result as 0. That is intended to tolerate the missing n_tup_hot_indexed_upd column on the master build, but it cannot distinguish "column does not exist" from a genuine failure (connection refused, wrong port, server crashed mid-run). In those cases the function returns a valid-looking 0, and the SIU count silently drops into the CSV as zero, corrupting the A/B numbers without any signal. Since run.sh is set -euo pipefail, a plain query failure elsewhere would abort; here the swallowing defeats that. Consider probing column existence once (e.g. via to_regclass/pg_attribute or a has_column check) so a real query failure is distinguished from the expected master-side absence.
| static_assert(BITS_PER_HEAPBLOCK == 4, | ||
| "rewriteVisibilityMap assumes a 4-bit new layout"); | ||
| static_assert(MAPSIZE % 2 == 0, | ||
| "rewriteVisibilityMap assumes an even map size"); |
There was a problem hiding this comment.
Use the tree's compile-time assertion macros rather than bare static_assert. In function bodies the idiomatic form is StaticAssertStmt() (see c.h); bare static_assert is used in only one other place in the backend and nowhere else in src/bin. This keeps the code consistent with the rest of pg_upgrade and the wider tree.
| static_assert(BITS_PER_HEAPBLOCK == 4, | |
| "rewriteVisibilityMap assumes a 4-bit new layout"); | |
| static_assert(MAPSIZE % 2 == 0, | |
| "rewriteVisibilityMap assumes an even map size"); | |
| StaticAssertStmt(BITS_PER_HEAPBLOCK == 4, | |
| "rewriteVisibilityMap assumes a 4-bit new layout"); | |
| StaticAssertStmt(MAPSIZE % 2 == 0, | |
| "rewriteVisibilityMap assumes an even map size"); |
| UPDATE pg_am SET amhandler = (SELECT amhandler FROM pg_am | ||
| WHERE amname = 'heap_wide') | ||
| WHERE amname = 'heap_later'; |
There was a problem hiding this comment.
Directly mutating pg_am.amhandler with a plain UPDATE is fragile: the revert at lines 74-76 only runs if every intervening statement leaves the script running. If any REINDEX/TRUNCATE/VACUUM here were to abort the whole script (rather than erroring per-statement as expected), heap_later would be left pointing at heap_wide_handler and the trailing DROP ACCESS METHOD heap_later could leave a broken AM behind for any session that outlives this file. The approach works today only because pg_regress continues past per-statement errors; it is non-idiomatic and brittle. Consider whether the handler-repoint scenario can be exercised without hand-poking the catalog. (moderate confidence)
| DATA = test_locator_tableam--1.0.sql | ||
| PGFILEDESC = "test_locator_tableam - test table AMs for the locator contract" | ||
|
|
||
| REGRESS = noretain width_check max_offset bitmap_hooks |
There was a problem hiding this comment.
The REGRESS ordering is load-bearing: noretain.sql uses plain CREATE EXTENSION (and must run first), while width_check/max_offset/bitmap_hooks rely on CREATE EXTENSION IF NOT EXISTS to reuse the already-created extension. No file drops the extension, so reordering this list (or running a single test in isolation other than noretain) would fail on the plain CREATE EXTENSION. A brief comment noting the dependency, or making every file self-contained with IF NOT EXISTS plus a terminal DROP EXTENSION, would remove the hidden coupling. (moderate confidence)
| -- Must return the row. | ||
| SELECT count(*) AS bloom_bitmapand FROM bloom_hot_indexed WHERE bcol = 11 AND changed = 22; |
There was a problem hiding this comment.
This test claims to guard the BitmapAnd split-recheck path, but it is not self-verifying and can pass green without ever exercising it. Two problems:
- No
EXPLAIN (COSTS OFF)asserts the plan is actually aBitmapAndacross bothbloom_hot_indexed_bandbloom_hot_indexed_c. Withenable_indexscan = offon a one-row table, the planner is free to pick a single bitmap index scan on one index and apply the other equality as a recheck/filter, which never enters thebitmap_and_inexactunion path the comment describes. The query still returns 1, so the test passes while testing nothing. - There is no
ANALYZE, so the cost model runs on default statistics, making the chosen plan even less predictable across platforms/releases.
Add an EXPLAIN (COSTS OFF) before the count that pins the BitmapAnd shape (and ANALYZE the table), mirroring the EXPLAIN-based pattern used by the sibling bitmap test in test_locator_tableam/sql/bitmap_hooks.sql. Confidence: moderate.
| alias pg-full-clean='trash "$PG_BUILD_DIR" "$PG_INSTALL_DIR" 2>/dev/null || rm -rf "$PG_BUILD_DIR" "$PG_INSTALL_DIR"; echo "Build and install directories cleaned"' | ||
|
|
||
| # Database management | ||
| alias pg-init='trash "$PG_DATA_DIR" 2>/dev/null || rm -rf "$PG_DATA_DIR"; "$PG_INSTALL_DIR/bin/initdb" --debug --no-clean "$PG_DATA_DIR"' |
There was a problem hiding this comment.
Destructive aliases with no guard against an empty/unset variable are a data-loss footgun. If this script is sourced outside the Nix dev shell (where PG_DATA_DIR/PG_BUILD_DIR/PG_INSTALL_DIR are exported), rm -rf "$PG_DATA_DIR" becomes rm -rf "" and pkill -f "postgres.*-D.*$PG_DATA_DIR" matches far more broadly than intended. At minimum guard with [ -n "$PG_DATA_DIR" ] / [ -n "$PG_BUILD_DIR" ] before destroying. This file is personal tooling and ideally should not be in the patch at all.
|
|
||
| # Clean commands | ||
| alias pg-clean='ninja -C "$PG_BUILD_DIR" clean' | ||
| alias pg-full-clean='trash "$PG_BUILD_DIR" "$PG_INSTALL_DIR" 2>/dev/null || rm -rf "$PG_BUILD_DIR" "$PG_INSTALL_DIR"; echo "Build and install directories cleaned"' |
There was a problem hiding this comment.
Same empty-variable hazard as pg-init: with PG_BUILD_DIR/PG_INSTALL_DIR unset this expands to rm -rf "" "". Guard against empty values before the destructive command.
| @@ -1,4 +1,4 @@ | |||
| #!/usr/bin/perl | |||
| #!/usr/bin/env perl | |||
There was a problem hiding this comment.
Out-of-scope, unrelated change to a tracked committer/buildfarm tool. The entire PostgreSQL tree uniformly uses #!/usr/bin/perl for its in-tree Perl scripts (genbki.pl, gen_node_support.pl, mark_pgdllimport.pl, and dozens more). Switching only this file to #!/usr/bin/env perl deviates from the established convention, is unnecessary for the HOT-indexed feature, and could change which perl is picked up in CI/packaging environments. Revert this hunk.
| #!/usr/bin/env perl | |
| #!/usr/bin/perl |
| patches = (oldAttrs.patches or []) ++ [ | ||
| ./glibc-no-fortify-warning.patch | ||
| ]; |
There was a problem hiding this comment.
patchedGlibc references ./glibc-no-fortify-warning.patch, but that patch file is not part of this change set. If the file is absent from the tree, nix develop / flake evaluation of the default (gcc+glibc) and clang+glibc dev shells will fail outright; if it exists only as an untracked local file, the dev shell is non-reproducible. Either add the patch file to the repository or drop this override. (This whole Nix dev-shell scaffolding is also likely out of scope for an upstream PG patch.)
| uint8 mapOffset = HEAPBLK_TO_OFFSET(heapBlk); | ||
| char *map; | ||
| bool changed = false; | ||
|
|
||
| Assert(InRecovery || CritSectionCount > 0); | ||
| Assert(BufferIsValid(vmBuf)); | ||
| Assert(BufferGetBlockNumber(vmBuf) == mapBlock); | ||
| Assert(BufferIsLockedByMeInMode(vmBuf, BUFFER_LOCK_EXCLUSIVE)); | ||
|
|
||
| map = PageGetContents(BufferGetPage(vmBuf)); | ||
| if (((map[mapByte] >> mapOffset) & VISIBILITYMAP_LOCATOR_SPLIT) != 0) |
There was a problem hiding this comment.
These three new helpers declare map as char *, whereas the rest of this file (visibilitymap_set, visibilitymap_get_status) uses uint8 *. Because map[mapByte] is read and right-shifted (map[mapByte] >> mapOffset), on a platform where char is signed the promoted value would be sign-extended if the byte's top bit (0x80) were ever set. It is latent today only because the high bit of each nibble is currently unused (max byte value 0x77), but this relies on char signedness in violation of the project's portability rules and is inconsistent with the sibling functions. Declare map as uint8 * and cast PageGetContents(...) to (uint8 *), matching visibilitymap_set. Applies to all three new helpers (clear/set/get).
(portability, moderate confidence)
| uint8 mapOffset = HEAPBLK_TO_OFFSET(heapBlk); | |
| char *map; | |
| bool changed = false; | |
| Assert(InRecovery || CritSectionCount > 0); | |
| Assert(BufferIsValid(vmBuf)); | |
| Assert(BufferGetBlockNumber(vmBuf) == mapBlock); | |
| Assert(BufferIsLockedByMeInMode(vmBuf, BUFFER_LOCK_EXCLUSIVE)); | |
| map = PageGetContents(BufferGetPage(vmBuf)); | |
| if (((map[mapByte] >> mapOffset) & VISIBILITYMAP_LOCATOR_SPLIT) != 0) | |
| uint8 mapOffset = HEAPBLK_TO_OFFSET(heapBlk); | |
| uint8 *map; | |
| bool changed = false; | |
| Assert(InRecovery || CritSectionCount > 0); | |
| Assert(BufferIsValid(vmBuf)); | |
| Assert(BufferGetBlockNumber(vmBuf) == mapBlock); | |
| Assert(BufferIsLockedByMeInMode(vmBuf, BUFFER_LOCK_EXCLUSIVE)); | |
| map = (uint8 *) PageGetContents(BufferGetPage(vmBuf)); | |
| if (((map[mapByte] >> mapOffset) & VISIBILITYMAP_LOCATOR_SPLIT) != 0) |
| slot = MakeTupleTableSlot(RelationGetDescr(relation), &TTSOpsBufferHeapTuple, 0); | ||
| bslot = (BufferHeapTupleTableSlot *) slot; |
There was a problem hiding this comment.
This rewrite adds a full extra heap_fetch (buffer read + pin), a per-call TupleTableSlot alloc/free, and a scan of all indexed attributes (HeapUpdateModifiedIdxAttrs) on every catalog tuple update. heap_update then re-finds and re-forms the same old tuple from otid, so the old tuple is fetched twice. simple_heap_update is on the catalog/DDL hot path (CatalogTupleUpdate / CatalogTupleUpdateWithInfo), so this is a measurable per-update regression and per-call palloc churn. The comment itself concedes "this minor repetition of work is necessary" and that callers "already had the set of changed attributes (the replaces array)". Consider threading the already-known changed-columns set down from CatalogTupleUpdate instead of re-discovering it here, to avoid the double fetch and the slot churn. (Correctness is fine; flagging performance/maintainability for -hackers.)
| sed -i.bak 's/\.bitmap_and_inexact = heap_bitmap_and_inexact,/.bitmap_and_inexact = NULL,\/* split_ab: split-off *\//' \ | ||
| "$hh" |
There was a problem hiding this comment.
This edits a core backend source file in the developer's live working tree via sed -i.bak on src/backend/access/heap/heapam_handler.c after git checkout --detach, relying solely on an EXIT trap to restore. If the process is SIGKILL'd (or the host loses power) during the long meson compile/meson install step while the edit is in place, the EXIT trap never runs: the repo is left on a detached HEAD with an uncommitted edit to a core file and a stale .bak. A subsequent run then aborts at the git status --porcelain guard (line 50), requiring manual recovery. This is a footgun for a file committed to the source tree. Prefer applying the split-off change to a throwaway git worktree/clone under $BENCH (as build.sh already isolates installs), so the developer's checkout is never mutated.
| BENCH=${BENCH:-/scratch/siu-bench} | ||
| JOBS=${JOBS:-$( (command -v nproc >/dev/null && nproc) || sysctl -n hw.ncpu 2>/dev/null || echo 8 )} | ||
| if [ -z "${REPO:-}" ]; then | ||
| for candidate in "$HOME/ws/postgres/tepid" "$BENCH/repo" /scratch/pg; do |
There was a problem hiding this comment.
This benchmark tooling bakes in machine-specific absolute paths (/scratch/siu-bench, $HOME/ws/postgres/tepid, /scratch/pg) and a private branch name tepid as the default revision to build. These defaults are meaningful only on the author's host and leak the development branch name into the committed tree. For a patch destined for pgsql-hackers this is a likely rejection point: committed tooling should not default to a personal scratch directory or an unpublished branch. At minimum, resolve the source repo relative to the script location (BASH_SOURCE) and default the base/compare revisions to published refs (e.g. origin/master and HEAD) rather than tepid. Also confirm with maintainers whether this developer-only harness belongs in src/test/benchmarks/ at all, since it is wired into no Makefile/meson target.
| SELECT coalesce(sum(size), 0) AS tmp1 FROM pg_ls_tmpdir() \gset | ||
| UPDATE big SET v = v + 1; | ||
| SELECT coalesce(sum(size), 0) <= :tmp1 AS released FROM pg_ls_tmpdir(); |
There was a problem hiding this comment.
This comparison reads pg_ls_tmpdir() twice (into :tmp1 and again in the final SELECT). Because pg_ls_tmpdir() reflects the whole instance's pgsql_tmp directory, a concurrent backend creating or removing a temp file between the two reads flips released from t to f. Same session-isolation caveat as the limit_kb block above. (high confidence)
| # Main entry: heap_update | ||
| break heapam.c:3210 |
There was a problem hiding this comment.
This file is personal developer tooling and should not be committed to a PostgreSQL patch destined for pgsql-hackers/commitfest. It pollutes the tree root and violates the minimal-diff discipline. More concretely, it hardcodes absolute source line-number breakpoints into files that this very patch series heavily rewrites, so they are already stale. Verified examples: heap_update() now begins near heapam.c:3313 (not 3210); the HOT-decision block (use_hot_update = true when hot_mode != HEAP_UPDATE_ALL_INDEXES) is around heapam.c:4203, not 4019/4024/4033. These breakpoints will silently land on unrelated statements. Move this to a local (gitignored) file instead of including it in the patch.
| # Compute indexed_attrs for HOT indexed update chain following | ||
| break indexam.c:299 |
There was a problem hiding this comment.
These line-number breakpoints are stale/misplaced. indexam.c:299 is annotated "Compute indexed_attrs for HOT indexed update chain following", but the only indexam.c change in this series is scan->xs_index_only = index_only_scan; near line 352, which is unrelated. Likewise execIndexing.c:370 is annotated "Index skip decision ... index_unchanged_by_update", but that function was removed in this patch and replaced by ExecSetIndexUnchanged; the skip decision now lives in a different block. Hardcoded line numbers against actively-edited files are a footgun; prefer function-name breakpoints at minimum, and keep this out of the committed tree.
| pgbench_as "$v" -f "$BENCH/scripts/hot_indexed_update.sql" \ | ||
| -c "$CLIENTS" -j "$THREADS" -T "$DURATION" \ | ||
| -D "scale=$SCALE" -P "$SAMPLE" -n postgres >"$LOGDIR/pgbench_$v.log" 2>&1 & |
There was a problem hiding this comment.
soak.sh references $BENCH/scripts/hot_indexed_update.sql but never populates $BENCH/scripts. Unlike run.sh (lines 46-48) and split_ab.sh (lines 34-35), which do mkdir -p "$BENCH/scripts" and cp "$SRCDIR"/*.sql before referencing them, soak.sh only creates $LOGDIR and $BENCH/results (line 19). With the default BENCH=/scratch/siu-bench (not the checkout), this path does not exist, so pgbench fails with "file not found". Worse, because pgbench runs in the background (line 87) and wait "$pgb" is guarded by || true, the failure is silent: the sampler still runs for the full DURATION and the script emits a CSV of all-zero TPS samples instead of aborting. Add the same SRCDIR copy step run.sh/split_ab.sh use (and consider checking pgbench's exit status).
|
📊 OCR posted 24/25 inline comment(s). 1 could not be posted
|
No description provided.