Skip to content
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

Save prepared statements to be able to use them with connetion pooling #281

Open
wants to merge 46 commits into
base: REL_15_STABLE_neon
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
f341594
Neon rebased to REL_15_STABLE (up to 0a9045c9ff)
lubennikovaav Jul 22, 2022
290ba8c
fix regression tests
lubennikovaav Aug 10, 2022
259ee69
rebase to the latest origin and resolve conflicts
lubennikovaav Aug 16, 2022
0e44ead
Remove contrib neon and neon_test_utils.
lubennikovaav Aug 24, 2022
7cca665
Prevent access to uninitalized shaerd memory in InstallXLogFileSegmen…
lubennikovaav Aug 24, 2022
8dccc09
Remove Dockerfile, it's now in the neon repo
lubennikovaav Aug 29, 2022
de43d1f
Move backpressure throttling implementation to neon extension (#203)
knizhnik Sep 2, 2022
a661533
Merge last written cache lsn with new main branch (#201)
knizhnik Sep 4, 2022
216c6d1
Local prefetch implementation for Postgres 15
hlinnaka Sep 13, 2022
681dc96
Set last written LSN for the created relation (#212)
hlinnaka Sep 16, 2022
3a9fec1
Use normal install program to install server headers.
hlinnaka Sep 12, 2022
125fe69
Update expected output for sysviews test because of changed default v…
knizhnik Sep 12, 2022
51fda47
Undo diasming VM check warning in vacuumlazy.c (#214)
knizhnik Sep 20, 2022
13fb90c
Set Neon-specific FMGR_ABI_EXTRA
lubennikovaav Sep 21, 2022
c6a30fb
Don't use newline in PG_VERSION file.
lubennikovaav Sep 21, 2022
00c68fe
Unset ArchiveRecoveryRequested for Neon code path.
lubennikovaav Sep 21, 2022
748e9a4
Fix memory leak in ApplyRecord
knizhnik Sep 21, 2022
3af5dc6
Rebase to Stamp 15.0
lubennikovaav Oct 5, 2022
6e4d997
Pin pages with speculative insert tuples to prevent their reconstruct…
knizhnik Oct 20, 2022
448bafa
Fix shared memory initialization for last written LSN cache (#226)
knizhnik Oct 24, 2022
b1ef4ab
Fix upper boundary caculation in the chunks loop in SetLastWrittenLSN…
knizhnik Oct 28, 2022
a81e2b6
Stamp XLP_FIRST_IS_CONTRECORD only if we start writing with page offset.
arssher Oct 28, 2022
d509e1b
Move walredo process code under pgxn in the main 'neon' repository.
hlinnaka Oct 31, 2022
d53d568
Misc cleanup, mostly to reduce unnecessary differences with upstream.
hlinnaka Oct 31, 2022
99947e8
Optimize prefetch patterns in both heap seqscan and vacuum scans. (#228)
MMeent Nov 7, 2022
d71a77c
Fix prefetch issues in parallel scans and vacuum's cleanup scan (#235)
MMeent Nov 11, 2022
cb8971d
Fix expected results for regression tests (#238)
bayandin Nov 15, 2022
a3b5c0d
Use prefetch in pg_prewarm extension (#237)
knizhnik Nov 17, 2022
59220f1
PG15: Prefetch cleanup (#241)
MMeent Nov 23, 2022
285cd13
Drop unlogged table in regress test to avoid noise in tests
lubennikovaav Nov 21, 2022
46c44e8
Do not produce open file error for unlogged relations (#240)
knizhnik Nov 24, 2022
6ac694c
Maintain last written LSN for each page to enable prefetch on vacuum,…
knizhnik Nov 24, 2022
d3188f2
Prefetch cleanup: (#246)
MMeent Dec 5, 2022
c772b48
Set lsn fix v15 (#252)
knizhnik Dec 8, 2022
f538627
Show prefetch statistic in EXPLAIN (#249)
knizhnik Jan 12, 2023
ba841dd
Implement efficient prefetch for parallel bitmap heap scan (#258)
knizhnik Feb 14, 2023
ad5e789
Unlogged index fix v15 (#262)
knizhnik Feb 22, 2023
9a20933
Fix bitmap scan prefetch (#261)
knizhnik Feb 23, 2023
919851e
Revert handling of UNLOGGED tables on compute side v15.
arssher Feb 24, 2023
1af2632
Allow external main functions to skip config load and make last
kelvich Feb 23, 2023
257aaef
Remove walredo-related hacks from InternalIpcMemoryCreate()
kelvich Mar 6, 2023
f8a650e
Adjust prefetch target for parallel bitmap scan (#274)
knizhnik Mar 27, 2023
03505eb
Copy iterator result in BitmapHeapNext (#276)
knizhnik Apr 7, 2023
4ad87b0
Prefetch for index and index-only scans (#271)
knizhnik Apr 7, 2023
aee72b7
[PG15] Feature/replicas (#279)
MMeent Apr 13, 2023
52ef300
Save prepared statements to be able to use them with connetion pooling
knizhnik Apr 27, 2023
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
Prev Previous commit
Next Next commit
Misc cleanup, mostly to reduce unnecessary differences with upstream.
Fix indentation, remove unused definitions, resolve some FIXMEs.
  • Loading branch information
hlinnaka authored and MMeent committed Feb 10, 2023
commit d53d568778b2b49e8c75c7bae50d159f64318419
1 change: 1 addition & 0 deletions src/backend/access/spgist/spginsert.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ spgbuild(Relation heap, Relation index, IndexInfo *indexInfo)
SpGistInitBuffer(nullbuffer, SPGIST_LEAF | SPGIST_NULLS);
MarkBufferDirty(nullbuffer);


END_CRIT_SECTION();

UnlockReleaseBuffer(metabuffer);
Expand Down
3 changes: 1 addition & 2 deletions src/backend/access/transam/xlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -4740,7 +4740,6 @@ BootStrapXLOG(void)
ReadControlFile();
}


static char *
str_time(pg_time_t tnow)
{
Expand Down Expand Up @@ -6486,7 +6485,7 @@ LogCheckpointEnd(bool restartpoint)
average_sync_time = 0;
if (CheckpointStats.ckpt_sync_rels > 0)
average_sync_time = CheckpointStats.ckpt_agg_sync_time /
CheckpointStats.ckpt_sync_rels;
CheckpointStats.ckpt_sync_rels;
average_msecs = (long) ((average_sync_time + 999) / 1000);

if (restartpoint)
Expand Down
3 changes: 0 additions & 3 deletions src/backend/access/transam/xloginsert.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,6 @@ static XLogRecData *XLogRecordAssemble(RmgrId rmid, uint8 info,
static bool XLogCompressBackupBlock(char *page, uint16 hole_offset,
uint16 hole_length, char *dest, uint16 *dlen);

/* Timeout in milliseconds for delaying WAL inserts to avoid WAL overflow */
#define MB ((XLogRecPtr)1024*1024)

/*
* Begin constructing a WAL record. This must be called before the
* XLogRegister* functions and XLogInsert().
Expand Down
3 changes: 2 additions & 1 deletion src/backend/access/transam/xlogprefetcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -720,8 +720,9 @@ XLogPrefetcherNextBlock(uintptr_t pgsr_private, XLogRecPtr *lsn)
* We could try to have a fast path for repeated references to the
* same relation (with some scheme to handle invalidations
* safely), but for now we'll call smgropen() every time.
*
* Only permanent relations are WAL-logged, so RELPERSISTENCE_PERMANENT.
*/
//FIXME what relpersistence should we use here?
reln = smgropen(block->rnode, InvalidBackendId, RELPERSISTENCE_PERMANENT);

/*
Expand Down
2 changes: 0 additions & 2 deletions src/backend/access/transam/xlogreader.c
Original file line number Diff line number Diff line change
Expand Up @@ -1846,7 +1846,6 @@ DecodeXLogRecord(XLogReaderState *state,
}
else
blk->hole_length = BLCKSZ - blk->bimg_len;

datatotal += blk->bimg_len;

/*
Expand Down Expand Up @@ -1992,7 +1991,6 @@ DecodeXLogRecord(XLogReaderState *state,

/* Report the actual size we used. */
decoded->size = MAXALIGN(out - (char *) decoded);

Assert(DecodeXLogRecordRequiredSpace(record->xl_tot_len) >=
decoded->size);

Expand Down
2 changes: 0 additions & 2 deletions src/backend/access/transam/xlogrecovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -1452,8 +1452,6 @@ FinishWalRecovery(void)
* An important side-effect of this is to load the last page into
* xlogreader. The caller uses it to initialize the WAL for writing.
*/


if (!InRecovery)
{
lastRec = CheckPointLoc;
Expand Down
1 change: 0 additions & 1 deletion src/backend/access/transam/xlogutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,6 @@ XLogReadBufferForRedoExtended(XLogReaderState *record,
{
if (mode == RBM_ZERO_AND_LOCK || mode == RBM_ZERO_AND_CLEANUP_LOCK)
{
//FIXME assume relpersistence permanent. Is it always true?
*buf = ReadBufferWithoutRelcache(rnode, forknum,
blkno, mode, NULL, true);
return BLK_DONE;
Expand Down
44 changes: 22 additions & 22 deletions src/backend/replication/walsender.c
Original file line number Diff line number Diff line change
Expand Up @@ -2879,7 +2879,7 @@ XLogSendPhysical(void)
*
* In theory we could make XLogFlush() record a time in shmem whenever WAL
* is flushed and we could get that time as well as the LSN when we call
* GetFlushRecPtr(NULL) above (and likewise for the cascading standby
* GetFlushRecPtr() above (and likewise for the cascading standby
* equivalent), but rather than putting any new code into the hot WAL path
* it seems good enough to capture the time here. We should reach this
* after XLogFlush() runs WalSndWakeupProcessRequests(), and although that
Expand Down Expand Up @@ -2974,8 +2974,8 @@ XLogSendPhysical(void)
Assert(nbytes <= MAX_SEND_SIZE);

/*
* OK to read and send the slice.
*/
* OK to read and send the slice.
*/
if (output_message.data)
resetStringInfo(&output_message);
else
Expand All @@ -2987,32 +2987,32 @@ XLogSendPhysical(void)
pq_sendint64(&output_message, 0); /* sendtime, filled in last */

/*
* Read the log directly into the output buffer to avoid extra memcpy
* calls.
*/
* Read the log directly into the output buffer to avoid extra memcpy
* calls.
*/
enlargeStringInfo(&output_message, nbytes);

retry:
if (!WALRead(xlogreader,
&output_message.data[output_message.len],
startptr,
nbytes,
xlogreader->seg.ws_tli, /* Pass the current TLI because
* only WalSndSegmentOpen controls
* whether new TLI is needed. */
&errinfo))
&output_message.data[output_message.len],
startptr,
nbytes,
xlogreader->seg.ws_tli, /* Pass the current TLI because
* only WalSndSegmentOpen controls
* whether new TLI is needed. */
&errinfo))
WALReadRaiseError(&errinfo);

/* See logical_read_xlog_page(). */
XLByteToSeg(startptr, segno, xlogreader->segcxt.ws_segsize);
CheckXLogRemoved(segno, xlogreader->seg.ws_tli);

/*
* During recovery, the currently-open WAL file might be replaced with the
* file of the same name retrieved from archive. So we always need to
* check what we read was valid after reading into the buffer. If it's
* invalid, we try to open and read the file again.
*/
* During recovery, the currently-open WAL file might be replaced with the
* file of the same name retrieved from archive. So we always need to
* check what we read was valid after reading into the buffer. If it's
* invalid, we try to open and read the file again.
*/
if (am_cascading_walsender)
{
WalSnd *walsnd = MyWalSnd;
Expand All @@ -3035,12 +3035,12 @@ XLogSendPhysical(void)
output_message.data[output_message.len] = '\0';

/*
* Fill the send timestamp last, so that it is taken as late as possible.
*/
* Fill the send timestamp last, so that it is taken as late as possible.
*/
resetStringInfo(&tmpbuf);
pq_sendint64(&tmpbuf, GetCurrentTimestamp());
memcpy(&output_message.data[1 + sizeof(int64) + sizeof(int64)],
tmpbuf.data, sizeof(int64));
tmpbuf.data, sizeof(int64));

pq_putmessage_noblock('d', output_message.data, output_message.len);

Expand Down Expand Up @@ -3078,7 +3078,7 @@ XLogSendLogical(void)
/*
* We'll use the current flush point to determine whether we've caught up.
* This variable is static in order to cache it across calls. Caching is
* helpful because GetFlushRecPtr(NULL) needs to acquire a heavily-contended
* helpful because GetFlushRecPtr() needs to acquire a heavily-contended
* spinlock.
*/
static XLogRecPtr flushPtr = InvalidXLogRecPtr;
Expand Down
4 changes: 3 additions & 1 deletion src/backend/storage/buffer/bufmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
#include "utils/timestamp.h"
#include "replication/walsender.h"


/* Note: these two macros only work on shared buffers, not local ones! */
#define BufHdrGetBlock(bufHdr) ((Block) (BufferBlocks + ((Size) (bufHdr)->buf_id) * BLCKSZ))
#define BufferGetLSN(bufHdr) (PageGetLSN(BufHdrGetBlock(bufHdr)))
Expand Down Expand Up @@ -806,13 +807,14 @@ ReadBufferWithoutRelcache(RelFileNode rnode, ForkNumber forkNum,
bool hit;

SMgrRelation smgr = smgropen(rnode, InvalidBackendId,
RELPERSISTENCE_PERMANENT);
RELPERSISTENCE_PERMANENT);

return ReadBuffer_common(smgr, permanent ? RELPERSISTENCE_PERMANENT :
RELPERSISTENCE_UNLOGGED, forkNum, blockNum,
mode, strategy, &hit);
}


/*
* ReadBuffer_common -- common logic for all ReadBuffer variants
*
Expand Down
1 change: 1 addition & 0 deletions src/backend/storage/page/bufpage.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ PageRestoreTempPage(Page tempPage, Page oldPage)

pageSize = PageGetPageSize(tempPage);
memcpy((char *) oldPage, (char *) tempPage, pageSize);

pfree(tempPage);
}

Expand Down
2 changes: 0 additions & 2 deletions src/backend/utils/misc/guc.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ static int syslog_facility = 0;
static void assign_syslog_facility(int newval, void *extra);
static void assign_syslog_ident(const char *newval, void *extra);
static void assign_session_replication_role(int newval, void *extra);

static bool check_temp_buffers(int *newval, void **extra, GucSource source);
static bool check_bonjour(bool *newval, void **extra, GucSource source);
static bool check_ssl(bool *newval, void **extra, GucSource source);
Expand Down Expand Up @@ -12309,7 +12308,6 @@ assign_session_replication_role(int newval, void *extra)
ResetPlanCache();
}


static bool
check_temp_buffers(int *newval, void **extra, GucSource source)
{
Expand Down
2 changes: 0 additions & 2 deletions src/include/access/xlog.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@
#define SYNC_METHOD_OPEN_DSYNC 4 /* for O_DSYNC */
extern PGDLLIMPORT int sync_method;


extern PGDLLIMPORT XLogRecPtr ProcLastRecPtr;
extern PGDLLIMPORT XLogRecPtr XactLastRecEnd;

extern PGDLLIMPORT XLogRecPtr XactLastCommitEnd;

/*
Expand Down
2 changes: 1 addition & 1 deletion src/include/access/xlogreader.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ struct XLogReaderState
/* Set when XLP_FIRST_IS_OVERWRITE_CONTRECORD is found */
XLogRecPtr overwrittenRecPtr;

/* Disable validation to allow dumpng corrupt WAL */
/* Disable validation to allow dumping corrupt WAL */
bool skip_page_validation;
bool skip_invalid_records;
bool skip_lsn_checks;
Expand Down
15 changes: 8 additions & 7 deletions src/include/replication/walsender.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ extern void WalSndRqstFileReload(void);

/*
* Hook to check for WAL receiving backpressure.
* Return value in microseconds */
* Return value in microseconds
*/
extern uint64 (*delay_backend_us)(void);

/* expose these so that they can be reused by the neon walproposer extension */
Expand All @@ -60,12 +61,12 @@ extern TimeOffset LagTrackerRead(int head, XLogRecPtr lsn, TimestampTz now);
extern void ProcessStandbyReply(XLogRecPtr writePtr, XLogRecPtr flushPtr,
XLogRecPtr applyPtr, TimestampTz replyTime,
bool replyRequested);
void PhysicalConfirmReceivedLocation(XLogRecPtr lsn);
void ProcessStandbyHSFeedback(TimestampTz replyTime,
TransactionId feedbackXmin,
uint32 feedbackEpoch,
TransactionId feedbackCatalogXmin,
uint32 feedbackCatalogEpoch);
extern void PhysicalConfirmReceivedLocation(XLogRecPtr lsn);
extern void ProcessStandbyHSFeedback(TimestampTz replyTime,
TransactionId feedbackXmin,
uint32 feedbackEpoch,
TransactionId feedbackCatalogXmin,
uint32 feedbackCatalogEpoch);

/*
* Remember that we want to wakeup walsenders later
Expand Down
2 changes: 0 additions & 2 deletions src/include/storage/bufmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,6 @@ extern void BufferGetTag(Buffer buffer, RelFileNode *rnode,

extern void MarkBufferDirtyHint(Buffer buffer, bool buffer_std);

extern void MarkBufferPermanent(Buffer buffer);

extern void UnlockBuffers(void);
extern void LockBuffer(Buffer buffer, int mode);
extern bool ConditionalLockBuffer(Buffer buffer);
Expand Down