-
Notifications
You must be signed in to change notification settings - Fork 1
Add support for ARIES UNDO and constant time recovery #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
94cc2d3
17bea06
08ac44b
fa14dd9
158dbec
97e3006
60ecab0
39b989a
9400681
d6220d8
ab608f8
1f97ae4
319635a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,3 +43,6 @@ lib*.pc | |
| /Release/ | ||
| /tmp_install/ | ||
| /portlock/ | ||
|
|
||
| # local build/install prefix (never commit) | ||
| /inst/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Local development ignores (not tracked in .gitignore) | ||
| # To enable: git config core.excludesFile .local-gitignore | ||
| .local-gitignore | ||
|
Comment on lines
+1
to
+3
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file should not be committed.
Comment on lines
+1
to
+3
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This entire file does not belong in the patch. Specific problems:
Drop this file from the patch entirely. If any of these patterns are truly project-wide, add them to the existing
Comment on lines
+1
to
+3
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file should not be part of the patch. It is a purely personal, local developer-convenience artifact: its own header notes it is "not tracked in .gitignore" and requires an opt-in
Comment on lines
+1
to
+3
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This entire file should not be committed. It is a per-developer local artifact -- the header comment itself states it is "not tracked in .gitignore" and is meant to be enabled locally via |
||
| build/ | ||
| build-valgrind/ | ||
| build-asan/ | ||
| install/ | ||
| install-valgrind/ | ||
| install-asan/ | ||
| .direnv/ | ||
| .cache/ | ||
| .history | ||
| test-db/ | ||
| log/ | ||
| results/ | ||
| regression.diffs | ||
| regression.out | ||
| *.core | ||
| core.* | ||
| CLAUDE.md | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -210,6 +210,7 @@ static void bt_child_highkey_check(BtreeCheckState *state, | |
| static void bt_downlink_missing_check(BtreeCheckState *state, bool rightsplit, | ||
| BlockNumber blkno, Page page); | ||
| static void bt_tuple_present_callback(Relation index, ItemPointer tid, | ||
| const RowID *rowid, | ||
| Datum *values, bool *isnull, | ||
| bool tupleIsAlive, void *checkstate); | ||
| static IndexTuple bt_normalize_tuple(BtreeCheckState *state, | ||
|
|
@@ -2779,7 +2780,8 @@ bt_downlink_missing_check(BtreeCheckState *state, bool rightsplit, | |
| * also allows us to detect the corruption in many cases. | ||
| */ | ||
| static void | ||
| bt_tuple_present_callback(Relation index, ItemPointer tid, Datum *values, | ||
| bt_tuple_present_callback(Relation index, ItemPointer tid, const RowID *rowid, | ||
| Datum *values, | ||
| bool *isnull, bool tupleIsAlive, void *checkstate) | ||
| { | ||
| BtreeCheckState *state = (BtreeCheckState *) checkstate; | ||
|
|
@@ -2860,6 +2862,32 @@ bt_normalize_tuple(BtreeCheckState *state, IndexTuple itup) | |
| /* Caller should only pass "logical" non-pivot tuples here */ | ||
| Assert(!BTreeTupleIsPosting(itup) && !BTreeTupleIsPivot(itup)); | ||
|
|
||
| /* | ||
| * For a wider-than-TID identity (e.g. RECNO's (TID, gen)) the on-page | ||
| * leaf tuples carry a trailing suffix (the generation) that is NOT part | ||
| * of the key+TID the heapallindexed scan reconstructs. The suffix must | ||
| * be excluded from the fingerprint: an index whose key was not touched by | ||
| * an unrelated in-place UPDATE keeps its original-generation entry, while | ||
| * the live tuple's shared per-row generation has since advanced -- the | ||
| * key+TID still match, only the (irrelevant-here) suffix differs. Reform | ||
| * from the key datums so the leaf tuple (with suffix) and the heap-derived | ||
| * tuple (without) fingerprint to the identical base tuple. index_getattr | ||
| * reads only the key attributes and ignores the trailing suffix. | ||
| */ | ||
| if (RelationGetIndexRowIdWidth(state->rel) > sizeof(ItemPointerData)) | ||
| { | ||
| Datum widevals[INDEX_MAX_KEYS]; | ||
| bool widenull[INDEX_MAX_KEYS]; | ||
|
|
||
| for (i = 0; i < tupleDescriptor->natts; i++) | ||
| widevals[i] = index_getattr(itup, TupleDescAttr(tupleDescriptor, i)->attnum, | ||
| tupleDescriptor, &widenull[i]); | ||
| reformed = index_form_tuple(tupleDescriptor, widevals, widenull); | ||
| reformed->t_tid = itup->t_tid; | ||
| /* Continue normalization on the suffix-free base tuple. */ | ||
| itup = reformed; | ||
|
Comment on lines
+2885
to
+2888
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Memory leak in the wide-RowID reform path. When the tuple has varlena datums and |
||
| } | ||
|
|
||
| /* Easy case: It's immediately clear that tuple has no varlena datums */ | ||
| if (!IndexTupleHasVarwidths(itup)) | ||
| return itup; | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -72,7 +72,8 @@ initCachedPage(BloomBuildState *buildstate) | |||||
| * Per-tuple callback for table_index_build_scan. | ||||||
| */ | ||||||
| static void | ||||||
| bloomBuildCallback(Relation index, ItemPointer tid, Datum *values, | ||||||
| bloomBuildCallback(Relation index, ItemPointer tid, const RowID *rowid, | ||||||
| Datum *values, | ||||||
| bool *isnull, bool tupleIsAlive, void *state) | ||||||
| { | ||||||
| BloomBuildState *buildstate = (BloomBuildState *) state; | ||||||
|
|
@@ -176,12 +177,14 @@ blinsert(Relation index, Datum *values, bool *isnull, | |||||
| ItemPointer ht_ctid, Relation heapRel, | ||||||
| IndexUniqueCheck checkUnique, | ||||||
| bool indexUnchanged, | ||||||
| IndexInfo *indexInfo) | ||||||
| IndexInfo *indexInfo, | ||||||
| const RowID *rowid) | ||||||
| { | ||||||
| BloomState blstate; | ||||||
| BloomTuple *itup; | ||||||
| MemoryContext oldCtx; | ||||||
| MemoryContext insertCtx; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unrelated whitespace churn: this blank line was inserted in the middle of the local-variable declaration block and is not required by the signature change. Per minimal-diff discipline, drop it to keep the patch focused.
Suggested change
|
||||||
|
|
||||||
| BloomMetaPageData *metaData; | ||||||
| Buffer buffer, | ||||||
| metaBuffer; | ||||||
|
|
@@ -191,6 +194,8 @@ blinsert(Relation index, Datum *values, bool *isnull, | |||||
| OffsetNumber nStart; | ||||||
| GenericXLogState *state; | ||||||
|
|
||||||
| (void) rowid; /* bloom stores only the heap TID */ | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||||||
|
|
||||||
| insertCtx = AllocSetContextCreate(CurrentMemoryContext, | ||||||
| "Bloom insert temporary context", | ||||||
| ALLOCSET_DEFAULT_SIZES); | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,10 +10,12 @@ OBJS = \ | |
| gistfuncs.o \ | ||
| hashfuncs.o \ | ||
| heapfuncs.o \ | ||
| rawpage.o | ||
| rawpage.o \ | ||
| recnofuncs.o | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This bumps pageinspect to 1.14 and wires in recnofuncs.o, adding three new SQL-callable functions (recno_page_items, recno_page_stats, recno_tuple_infomask_flags). However, REGRESS is not extended and there is no sql/recno*.sql test for these functions, so the new behavior is entirely untested. Per PostgreSQL patch standards a user-visible change requires regression coverage. Add a recno pageinspect regress test to REGRESS (and the mirror list in meson.build), and update sql/oldextversions.sql to exercise the 1.13->1.14 upgrade path (matching the existing 1.11/1.12 pattern). (moderate confidence)
Comment on lines
+13
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new pageinspect 1.14 upgrade adds three SQL functions ( |
||
|
|
||
| EXTENSION = pageinspect | ||
| DATA = pageinspect--1.12--1.13.sql \ | ||
| DATA = pageinspect--1.13--1.14.sql \ | ||
| pageinspect--1.12--1.13.sql \ | ||
|
Comment on lines
+17
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This bumps pageinspect to 1.14, adding three new SQL-callable functions (recno_page_items, recno_page_stats, recno_tuple_infomask_flags) in recnofuncs.c, but REGRESS is not extended and there is no new sql/recno*.sql test. Per PostgreSQL patch standards, a user-visible change needs regression coverage. Add a recno pageinspect regress test to REGRESS here (and the mirror list in meson.build), and update sql/oldextversions.sql to exercise the 1.13->1.14 upgrade path (matching the existing 1.11/1.12 pattern). (moderate confidence) |
||
| pageinspect--1.11--1.12.sql pageinspect--1.10--1.11.sql \ | ||
| pageinspect--1.9--1.10.sql pageinspect--1.8--1.9.sql \ | ||
| pageinspect--1.7--1.8.sql pageinspect--1.6--1.7.sql \ | ||
|
|
@@ -32,7 +34,8 @@ REGRESS = \ | |
| gin \ | ||
| gist \ | ||
| hash \ | ||
| oldextversions | ||
| oldextversions \ | ||
| hot_updates | ||
|
Comment on lines
+37
to
+38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The patch's actual new pageinspect functionality is |
||
|
|
||
| ifdef USE_PGXS | ||
| PG_CONFIG = pg_config | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should not be part of the patch.
.local-gitignoreis a personal, local-development convenience file (note the comment: "not tracked in .gitignore" and the intent to be wired up viagit config core.excludesFile). Committing it violates the minimal-diff discipline: it is unrelated to the stated purpose of the change and would draw an immediate rejection on pgsql-hackers.Several concrete problems compound this:
.local-gitignore), which is self-contradictory once it is actually tracked in the repository.CLAUDE.md, an AI-assistant artifact that has no business being referenced from the PostgreSQL source tree.log/,results/,regression.diffs,regression.out,build/,install/are developer-environment concerns; anything genuinely worth ignoring for all contributors belongs in the tree's real.gitignorefiles, not a personal excludes file checked into the repo.Remove this file from the commit entirely and keep it out of version control (e.g., add it to your global/local excludes instead).