Skip to content

Commit adbbd19

Browse files
committed
Update RecentXmin
1 parent 51e68f0 commit adbbd19

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

contrib/pg_xtm/dtmd/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CC=gcc
2-
CFLAGS=-g -Wall -Iinclude -D_LARGEFILE64_SOURCE -DDEBUG
2+
CFLAGS=-g -Wall -Iinclude -D_LARGEFILE64_SOURCE # -DDEBUG
33
LIBUV_PREFIX=$(HOME)/libuv-build
44
LIBUV_CFLAGS=-I"$(LIBUV_PREFIX)/include" -L"$(LIBUV_PREFIX)/lib"
55
LIBUV_LDFLAGS=-luv -pthread

contrib/pg_xtm/pg_dtm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,6 @@ static void DtmMergeSnapshots(Snapshot dst, Snapshot src)
183183
}
184184
}
185185
dst->xcnt = j;
186-
if (RecentXmin > dst->xmin) {
187-
RecentXmin = dst->xmin;
188-
}
189186
DumpSnapshot(dst, "merged");
190187
}
191188

@@ -207,6 +204,9 @@ static void DtmUpdateRecentXmin(void)
207204
if (TransactionIdFollows(RecentGlobalXmin, xmin)) {
208205
RecentGlobalXmin = xmin;
209206
}
207+
if (TransactionIdFollows(RecentXmin, xmin)) {
208+
RecentXmin = xmin;
209+
}
210210
}
211211
}
212212

src/backend/access/heap/heapam.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7611,10 +7611,10 @@ heap_xlog_visible(XLogReaderState *record)
76117611
* we did for the heap page. If this results in a dropped bit, no
76127612
* real harm is done; and the next VACUUM will fix it.
76137613
*/
7614-
if (lsn > PageGetLSN(vmpage))
7614+
if (lsn > PageGetLSN(vmpage)) {
76157615
visibilitymap_set(reln, blkno, InvalidBuffer, lsn, vmbuffer,
76167616
xlrec->cutoff_xid);
7617-
7617+
}
76187618
ReleaseBuffer(vmbuffer);
76197619
FreeFakeRelcacheEntry(reln);
76207620
}

src/backend/access/heap/pruneheap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ heap_page_prune_opt(Relation relation, Buffer buffer)
9898
OldestXmin = RecentGlobalXmin;
9999
else
100100
OldestXmin = RecentGlobalDataXmin;
101-
101+
fprintf(stderr, "PRUNEHEAP: xmin=%d\n", OldestXmin);
102102
Assert(TransactionIdIsValid(OldestXmin));
103103

104104
/*

src/backend/access/heap/visibilitymap.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
#include "access/heapam_xlog.h"
8686
#include "access/visibilitymap.h"
8787
#include "access/xlog.h"
88+
#include "utils/snapmgr.h"
8889
#include "miscadmin.h"
8990
#include "storage/bufmgr.h"
9091
#include "storage/lmgr.h"
@@ -253,6 +254,9 @@ visibilitymap_set(Relation rel, BlockNumber heapBlk, Buffer heapBuf,
253254
Page page;
254255
char *map;
255256

257+
fprintf(stderr, "Visibilitymap cutoff %d, RecentLocalDataXmin=%d\n", cutoff_xid, RecentGlobalDataXmin);
258+
return;
259+
256260
#ifdef TRACE_VISIBILITYMAP
257261
elog(DEBUG1, "vm_set %s %d", RelationGetRelationName(rel), heapBlk);
258262
#endif

0 commit comments

Comments
 (0)