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

Persist pg_stat informartion in PS #353

Closed
wants to merge 213 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
213 commits
Select commit Hold shift + click to select a range
bb232e4
[smgr_api] [community] smgr_api.patch
lubennikovaav May 16, 2021
1fea158
[contrib/zenith] contrib_zenith.patch
lubennikovaav May 16, 2021
bcec423
[walredo] zenith_wal_redo.patch
lubennikovaav May 16, 2021
ebc0c85
lastWrittenPageLSN.patch
lubennikovaav May 16, 2021
04ec52d
Fix GetPage requests right after replaying CREATE DATABASE
hlinnaka May 21, 2021
baaf511
handle_eviction_of_non_wal_logged_pages.patch
lubennikovaav May 16, 2021
692fe7b
[walproposer] wal_proposer.patch
lubennikovaav May 16, 2021
4f5fda3
persist_unlogged_tables.patch
lubennikovaav May 16, 2021
ab0444b
fix_pg_table_size.patch
lubennikovaav May 16, 2021
50411e4
[walredo] fix_gin_redo.patch
lubennikovaav May 16, 2021
f4e2717
[walredo] fix_brin_redo.patch
lubennikovaav May 16, 2021
1b9952f
speculative_records_workaround.patch
lubennikovaav May 16, 2021
fcb2f87
wallog_t_ctid.patch
lubennikovaav May 16, 2021
d7c8f82
vacuumlazy_debug_stub.patch
lubennikovaav May 16, 2021
7a320aa
[test] zenith_test_evict.patch
lubennikovaav May 16, 2021
3eb1f33
fix_sequence_wallogging.patch
lubennikovaav May 16, 2021
48cc50f
Bring back change that got lost in refactoring. silence ReadBuffer_co…
lubennikovaav May 18, 2021
1ebadd5
[contrib/zenith] [refer #225] if insert WAL position points at the en…
knizhnik Jun 7, 2021
67d24ab
[walproposer] Create replication slot for walproposer to avoid loose …
knizhnik Jun 8, 2021
403ee91
[walproposer] Skip absent WAL segment removed by pg_resetwal
lubennikovaav Aug 17, 2021
0dd1510
[walproposer] Fix breaking out of WalProposerPoll and WaitEventSetWai…
arssher Jun 11, 2021
6f8969e
[walproposer] Make it possible to start postgres without reading chec…
knizhnik Jun 17, 2021
523cfb5
[walproposer] Simplify WL_LATCH_SET testing in the walproposer
ololobus Jul 5, 2021
54920ab
[walredo] Add basic support for Seccomp BPF mode
funbringer Jun 24, 2021
91d807d
[smgr_api] [contrib/zenith] 1. Do not call mdinit from smgrinit() bec…
knizhnik Jul 9, 2021
1102d5e
[walproposer] [contrib/zenith] support zenith_tenant
LizardWizzard Jul 15, 2021
7fe2b38
[walproposer] Remove graceful termination of COPY during walproposer …
arssher Aug 4, 2021
3bd486c
[walproposer] [contrib/zenith] [refer #395] Do no align sart replicat…
knizhnik Aug 9, 2021
6ffe626
[test] Add contrib/zenith_test_utils with helpers for testing and deb…
lubennikovaav Aug 10, 2021
4ef07de
[walproposer] Change condition for triggering recovery
knizhnik Aug 11, 2021
446c217
[contrib/zenith] Use authentication token passed as environment varia…
LizardWizzard Aug 4, 2021
2970de6
[contrib/zenith] Fix race condition while WAL-logging page, leading t…
hlinnaka Aug 13, 2021
ff579a1
[walproposer] Rework walkeeper protocol to use libpq (#60)
sharnoff Aug 13, 2021
c724669
Build zenithdb/compute-node:latest in CI (zenithdb/console#125)
ololobus Aug 16, 2021
96976a8
zenith_regression_tests.patch
lubennikovaav Aug 23, 2021
1266e2d
Add test function to flush the shared buffer cache.
hlinnaka Aug 24, 2021
ab9a350
Basic safekeeper refactoring and bug fixing.
arssher Aug 17, 2021
1fd47d4
Rename VCL to epochStartLsn and restart_lsn to truncate_lsn.
arssher Aug 27, 2021
6367cab
[refer #27] Implement shared relsize cache to improve zenith performa…
knizhnik Aug 3, 2021
c3108aa
Cleanup walproposer changes from #60
sharnoff Aug 31, 2021
185526e
pass tenant id in connection string to safekeeper
LizardWizzard Aug 31, 2021
0c5683c
Ask pageserver only with LSN's aligned on record boundary.
kelvich Aug 31, 2021
a338ff3
[refer #506] Correctly initialize all fields of WAL page header for f…
knizhnik Sep 1, 2021
4e5cc6e
Add --sync-safekeepers starting standalone walproposer to sync safeke…
knizhnik Aug 19, 2021
9cd318f
Update Dockerfile
ololobus Aug 27, 2021
58d1e95
Fix compiler warnings in walproposer.c
ololobus Sep 10, 2021
689e2f0
Always advance truncateLsn to commitLsn, keeping it on record boundary.
arssher Sep 9, 2021
c8d0664
Minor logging editing.
arssher Sep 10, 2021
ea81340
Fix walproposer starting streaming point.
arssher Sep 10, 2021
e0b3600
Mark all recovery messages as received by the donor.
arssher Sep 14, 2021
d826611
Don't FATAL in walproposer when EOF arrives in SS_IDLE state.
arssher Sep 14, 2021
5ee86bd
Optimize walproposer starting streaming point.
arssher Sep 15, 2021
52fa5f3
Silence compiler warnings:
hlinnaka Sep 17, 2021
cf3b103
Remove unused functions for reading non-rel pages.
hlinnaka Sep 17, 2021
18791ff
Misc cleanup in the code that communicates with the page server.
hlinnaka Sep 17, 2021
5494e85
Improve the protocol between Postgres and page server.
hlinnaka Sep 17, 2021
4c3225f
Run 'pgindent' on zenith-specific code in contrib/zenith and in walpr…
hlinnaka Sep 17, 2021
a809a56
Fix a badly worded comment
hlinnaka Sep 20, 2021
ca270ab
Simplify a2e929e by storing starting point in walkeeper itself.
arssher Sep 16, 2021
763cfd6
Catch walkeeper ErrorResponse in PQgetCopyData
sharnoff Sep 22, 2021
a0a62c1
Use buffered I/O for reading commands from stdin.
hlinnaka Sep 24, 2021
5bf390b
Replace fread() with plain read() and a hand-written buffer.
hlinnaka Sep 30, 2021
fe25a31
Store unlogged tables locally, and replace PD_WAL_LOGGED.
hlinnaka Oct 6, 2021
9e1336a
Fix queue cleanup in proposer (#93)
petuhovskiy Oct 14, 2021
b903b7e
Support read-only nodes
hlinnaka Oct 19, 2021
efaa89b
Remove a drop of syncSafekeepers complexity.
arssher Oct 21, 2021
0578e6f
Fix compiler warning.
arssher Oct 21, 2021
8bbb4d3
Implement backpressure for compute node to avoid WAL overflow
knizhnik Sep 18, 2021
008cde3
Initialize FSM/VM pages through buffer cache
ololobus Oct 19, 2021
ecebcaf
Turn off back pressure by default
ololobus Oct 21, 2021
9a0e035
ShutdownConnection instead of ResetConnection in more places.
arssher Oct 21, 2021
796816f
Handle partial writes to stdout in WAL redo process.
hlinnaka Nov 3, 2021
21ccefb
Handle keepalives while receiving WAL in recovery.
arssher Nov 8, 2021
9231b69
Fix truncateLsn update (#101)
petuhovskiy Nov 9, 2021
d06fd4b
[walproposer] Get rid of SAB_Error after rebase
ololobus Nov 10, 2021
3c3e427
Add term history to safekeepers.
arssher Nov 5, 2021
4fcde69
Clarify the meaning of StandbyReply LSNs used for backpressure
lubennikovaav Nov 9, 2021
101178d
Use max_replication_apply_lag instead of max_replication_write_lag.
lubennikovaav Nov 11, 2021
4f87e37
Forward pageserver connection string to safekeeper
LizardWizzard Nov 25, 2021
5a0150a
Move backpressure throttling to ProcessInterrupts()
lubennikovaav Nov 26, 2021
ce7f4dd
Stop building docker images in this repo.
kelvich Dec 15, 2021
a8580f0
[walproposer] Async WAL append (#105)
petuhovskiy Dec 21, 2021
8a7ae95
Fix walsender to work with zenith style standbyReply that sends non-z…
lubennikovaav Dec 22, 2021
7da26ca
Do not copy the obsolete apply_conf binary into Docker image
ololobus Dec 25, 2021
a0088f1
Reorder walproposer code in a more natural order (#112)
petuhovskiy Dec 31, 2021
f308609
Simplify walproposer code (#114)
petuhovskiy Jan 4, 2022
9a8071d
Don't change propTerm after quorum is acquired (#107)
petuhovskiy Jan 4, 2022
c05c985
walproposer renames (#116)
petuhovskiy Jan 5, 2022
30e0a6e
Report back-pressure trottling status of backend
knizhnik Dec 29, 2021
ae47d92
Add max_replication_write_lag
knizhnik Dec 29, 2021
4e83fd8
Do not throttle wal sender
knizhnik Jan 10, 2022
cab9755
Don't track acks in walproposer (#119)
petuhovskiy Jan 13, 2022
1fb0095
Silence excessively noisy logging from walproposer.
hlinnaka Jan 14, 2022
1dc207a
Extend replication protocol with ZenithFeedback message.
lubennikovaav Dec 20, 2021
43a7a75
Allow to join empty safekeeper to existing cluster (#123)
petuhovskiy Jan 27, 2022
49736eb
Use local relation cache for smgr_exists
knizhnik Dec 29, 2021
358fec5
Reduce walproposer logging after ca5e7beaf.
arssher Feb 4, 2022
8592c12
Implement cluster size quota for zenith compute node.
lubennikovaav Dec 20, 2021
59d1855
Revert "Use local relation cache for smgr_exists"
arssher Feb 9, 2022
e103c1c
Change the unit of cluster size limit GUC to MB, and other fixes.
hlinnaka Feb 9, 2022
d23f614
Improve error handling while connecting to page server.
hlinnaka Feb 9, 2022
6ed9e34
Make getpage requests interruptible.
hlinnaka Feb 9, 2022
e8ffab6
Fix memory leak of messages received from safekeepers.
hlinnaka Feb 10, 2022
55f3b4f
Initialize pgxactoff for walproposer
knizhnik Feb 11, 2022
b0228ee
Fix compilation warning after 8524105dc.
arssher Feb 14, 2022
6642552
Fix more compiler warnings.
arssher Feb 14, 2022
3466a1d
Remove dead code in handling ZenithFeedback part of an AppendResponse.
hlinnaka Feb 16, 2022
7d75aca
Expose reading a relation page at a specific LSN (#131)
antons-antons Feb 18, 2022
d647a6a
Add backpressure_lsns() function. Fix zenith feedback processing
lubennikovaav Feb 17, 2022
b4ec016
Fix zenith_test_utils linkage on macOS
kelvich Feb 23, 2022
2e8f058
Add warning fr unrecgonized GUCs with zenith prefix
knizhnik Feb 21, 2022
1e9f46c
Count WAL flushes in walreceiver (#139)
petuhovskiy Mar 8, 2022
8803ebb
Use local relation cache for smgr_exists
knizhnik Dec 29, 2021
9c9b317
Populate relsize cache when relation is created.
hlinnaka Mar 10, 2022
382fe09
Fix pg_table_size() on a view
hlinnaka Mar 28, 2022
eabc14b
Don't set commitLsn to truncateLsn.
arssher Mar 28, 2022
1a7e158
Raise fatal error on failed recovery (#147)
petuhovskiy Mar 31, 2022
75aaac3
Enable dumping corrupt WAL segments (#145)
antons-antons Apr 1, 2022
d7ac667
Don't hold walproposer WAL in memory (#141)
petuhovskiy Apr 4, 2022
ae778c9
Add --sysid parameter to initdb
knizhnik Jan 27, 2022
392008e
Give up connection attempt to safekeeper after timeout.
arssher Apr 15, 2022
32aa6f2
Avoid redundand memory allocation and sycnhronization in walredo (#144)
knizhnik Apr 23, 2022
b6b417f
Fix missed include for InRecovery (#149)
knizhnik Apr 25, 2022
6522ac4
Avoid "bad syscall 39" on assertion failure in WAL redo process.
hlinnaka Apr 26, 2022
2e6ba8f
Add error context, if replaying a WAL record fails in WAL redo process.
hlinnaka Apr 26, 2022
d467462
Add WARNING for debugging purposes.
hlinnaka Apr 26, 2022
f889dfb
Turn Assertion into elog(ERROR), to help with debugging.
hlinnaka Apr 26, 2022
0887949
Fix errors in WAL redo about relpersistence mismatch.
hlinnaka Apr 26, 2022
4deadd2
Don't log 'last written LSN ahead of flushed'.
arssher Apr 26, 2022
85c013c
Perform inmem_smgr cleaup after processing each record (#154)
knizhnik Apr 27, 2022
b72bfc3
Avoid extending relation in the WAL redo process.
hlinnaka May 3, 2022
9c763bd
Send timeline_start_lsn in Elected and receive it in VoteResponse mes…
arssher May 1, 2022
2d2c847
Verify basebackup LSN against consensus LSN in walproposer.
arssher May 2, 2022
fcebd9d
Implement pg_database_size():
lubennikovaav Jul 23, 2021
cba317b
Shut down instance on basebackup LSN mismatch.
arssher May 6, 2022
c5f2680
Use compute-tools from the new neondatabase Docker Hub repo
ololobus May 9, 2022
478d07d
zenith_test_utils extension: add neon_xlogflush()
yeputons May 10, 2022
b1004c3
Reduce noise in the logs from inmem_write()
hlinnaka May 13, 2022
9fed52d
Use compute_ctl instead of zenith_ctl (#162)
ololobus May 18, 2022
667fe31
Improve error messages on seccomp loading errors.
hlinnaka May 24, 2022
49b8a44
Rename contrib/zenith to contrib/neon. Rename custom GUCs:
lubennikovaav May 26, 2022
3f68bc6
Rename 'wal_acceptors' GUC to 'safekeepers'
lubennikovaav Apr 19, 2022
e1d4101
Fix basebackup LSN comparison in walproposer.
arssher May 31, 2022
8d9e935
Allow specifiyng the different compute-tools tag (#170)
ololobus May 31, 2022
29c2995
Do not allocate shared memory for wal_redo process (#165)
knizhnik Jun 6, 2022
dd54409
Add check for NULL for malloc in InternalIpcMemoryCreate (#173)
knizhnik Jun 8, 2022
632f89b
Rename ZenithFeedback (#174)
SomeoneToIgnore Jun 10, 2022
303d04c
Remove callmemaybe bits from compute (#172)
SomeoneToIgnore Jun 10, 2022
b234964
Panic on receiving higher term (#176)
petuhovskiy Jun 22, 2022
e7f14c3
Misc cleanup in libpagestore.c.
hlinnaka May 16, 2022
68dbff9
Large last written lsn cache (#177)
knizhnik Jul 9, 2022
4073d1d
Add uuid-ossp to the supported extensions (#181)
MMeent Jul 12, 2022
e215705
Update last written LSN for gin/gist index metadata (#182)
knizhnik Jul 19, 2022
c194e38
Revert "Update last written LSN for gin/gist index metadata (#182)" (…
knizhnik Jul 26, 2022
63cd6cd
Fix `uuid-ossp` build
kelvich Aug 1, 2022
369321a
Remove redundant const (#189)
bojanserafimov Aug 8, 2022
b8a2b04
Eliminate UnkonwnXLogRecPtr and always use InvalidXLogRecPtr instead …
knizhnik Aug 12, 2022
b53cf9a
Init wal redo buffer for fpi (#194)
knizhnik Aug 15, 2022
7ada3d3
Stamp XLP_FIRST_IS_CONTRECORD only if we start writing with page offset.
arssher Aug 14, 2022
0b17534
Pull 99% of walproposer code into extension. (#188)
MMeent Aug 18, 2022
593d426
Use ECR for image (#195)
zoete Aug 19, 2022
93217a2
walproposer: do not send pageserver connstring with START_WAL_PUSH (#…
yeputons Aug 25, 2022
14eb804
Remove neon extensions from the vendor repo (#197)
MMeent Aug 25, 2022
d397c61
Remove Dockerfile, it's now in the neon repo (#199)
ololobus Aug 26, 2022
27d0bca
Move backpressure throttling implementation to neon extension (#203)
knizhnik Sep 2, 2022
2b4fd70
Merge last written cache lsn with new main branch (#201)
knizhnik Sep 4, 2022
48f19ec
Local prefetch implementation for Postgres 14
knizhnik Sep 12, 2022
af8fbcb
Disable prefetch by default to make it possible to early merge this P…
knizhnik Sep 12, 2022
77cfde0
Disable prefetch by default to make it possible to early merge this P…
knizhnik Sep 12, 2022
116e8f9
Update expected output for sysviews test because of changed default v…
knizhnik Sep 12, 2022
512867e
Set last written page lsn for created relation (#209)
knizhnik Sep 16, 2022
bad16aa
Undo diasming VM check warning in vacuumlazy.c (#213)
knizhnik Sep 20, 2022
207e095
Pin pages with speculative insert tuples to prevent their reconstruct…
knizhnik Oct 20, 2022
06bf117
Fix shared memory initialization for last written LSN cache (#224)
knizhnik Oct 24, 2022
d35bcd6
Fix upper boundary caculation in the chunks loop in SetLastWrittenLSN…
knizhnik Oct 28, 2022
0851cfc
Move walredo process code under pgxn in the main 'neon' repository.
hlinnaka Oct 31, 2022
f5607fa
Misc cleanup, mostly to reduce unnecessary differences with upstream.
hlinnaka Oct 31, 2022
37bef4c
Optimize prefetch patterns in both heap seqscan and vacuum scans. (#227)
MMeent Nov 7, 2022
53e7da6
Fix prefetch issues in parallel scans and vacuum's cleanup scan (#234)
MMeent Nov 11, 2022
0645b35
Use prefetch in pg_prewarm extension (#236)
knizhnik Nov 17, 2022
1649a9e
PG14: Prefetch cleanup (#242)
MMeent Nov 23, 2022
748c43d
Do not produce open file error for unlogged relations (#239)
knizhnik Nov 24, 2022
8622af7
Maintain last written LSN for each page to enable prefetch on vacuum,…
knizhnik Nov 24, 2022
7a2f9dd
Prefetch cleanup: (#247)
MMeent Dec 5, 2022
556a089
Fix uninitialized variable in spgvacuum.c (#250)
MMeent Dec 7, 2022
995e5ec
Update heap pge LSN in case of VM changes even if wal_redo_hints=off …
knizhnik Dec 8, 2022
1ca498e
Show prefetch statistic in EXPLAIN (#248)
knizhnik Jan 12, 2023
d9eb8e6
Implement efficient prefetch for parallel bitmap heap scan (#258)
knizhnik Feb 14, 2023
9336c01
Unlogged index fix v14 (#259)
knizhnik Feb 22, 2023
305f108
Fix bitmap scan prefetch (#260)
knizhnik Feb 23, 2023
0eef7f8
Revert handling of UNLOGGED tables on compute side.
arssher Feb 24, 2023
1740379
Allow external main functions to skip config load and make last
kelvich Feb 23, 2023
ce4bbc3
Remove walredo-related hacks from InternalIpcMemoryCreate()
kelvich Mar 6, 2023
4a33211
Adjust prefetch target for parallel bitmap scan (#273)
knizhnik Mar 27, 2023
d158de9
Heap bitmap scan prefetch fix2 v14 (#275)
knizhnik Apr 7, 2023
8473c55
Implement index prefetch for index and index-only scans (#277)
knizhnik Apr 7, 2023
ca233bc
[PG14] Feature/replicas (#278)
MMeent Apr 13, 2023
9c52b53
Do not allow users with CREATEROLE privelege to manage system user
kelvich Jul 7, 2023
480afdd
Fix regression tests after the patch with CREATEROLE restrictions
kelvich Jul 15, 2023
5083d2a
Make it possible to grant self created roles (#297)
knizhnik Jul 26, 2023
d811f4d
Define NEON_SMGR in smgr.h to make it possible for extensions to use …
knizhnik Jul 29, 2023
d4cd84d
Request extension files and libraries from compute_ctl
lubennikovaav Jun 13, 2023
5645949
Neon logical replication support for PG14 (#309)
knizhnik Oct 18, 2023
e26ccfe
Fix elog format error in wallog_mapping_file (#315)
knizhnik Oct 19, 2023
23b502f
Remove excessive walsender reply logging.
arssher Oct 19, 2023
0bb356a
Update WAL buffers when restoring WAL at compute needed for LR (#325)
knizhnik Nov 3, 2023
e151aa2
Prevent output callbacks from hearing about neon-file messages (#330)
Dec 14, 2023
03358bb
strncmp vs strcmp
save-buffer Dec 15, 2023
8207291
Allow creating publications FOR ALL TABLES
save-buffer Jan 11, 2024
11e970f
Switch GetCurrentRoleId to GetUserId
save-buffer Jan 24, 2024
3de48ce
Support creating subscriptions as neon_superuser
Jan 25, 2024
be7a65f
On demand downloading of SLRU segments (#333)
knizhnik Jan 31, 2024
b67fabb
Persist pg_stat informartion in PS
Feb 1, 2024
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
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.git
.vscode
.circleci
tmp_install
compute_build
86 changes: 86 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,7 @@ with_libxml
with_uuid
with_readline
with_systemd
with_libseccomp
with_selinux
with_ldap
with_krb_srvnam
Expand Down Expand Up @@ -858,6 +859,7 @@ with_bsd_auth
with_ldap
with_bonjour
with_selinux
with_libseccomp
with_systemd
with_readline
with_libedit_preferred
Expand Down Expand Up @@ -1564,6 +1566,7 @@ Optional Packages:
--with-ldap build with LDAP support
--with-bonjour build with Bonjour support
--with-selinux build with SELinux support
--with-libseccomp build with libseccomp support
--with-systemd build with systemd support
--without-readline do not use GNU Readline nor BSD Libedit for editing
--with-libedit-preferred
Expand Down Expand Up @@ -8606,6 +8609,39 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_selinux" >&5
$as_echo "$with_selinux" >&6; }

#
# libseccomp
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with libseccomp support" >&5
$as_echo_n "checking whether to build with libseccomp support... " >&6; }



# Check whether --with-libseccomp was given.
if test "${with_libseccomp+set}" = set; then :
withval=$with_libseccomp;
case $withval in
yes)
:
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-libseccomp option" "$LINENO" 5
;;
esac

else
with_libseccomp=no

fi



{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_libseccomp" >&5
$as_echo "$with_libseccomp" >&6; }

#
# Systemd
#
Expand Down Expand Up @@ -14258,6 +14294,56 @@ else
fi


fi

if test "$with_libseccomp" = yes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for seccomp_init in -lseccomp" >&5
$as_echo_n "checking for seccomp_init in -lseccomp... " >&6; }
if ${ac_cv_lib_seccomp_seccomp_init+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lseccomp $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char seccomp_init ();
int
main ()
{
return seccomp_init ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_seccomp_seccomp_init=yes
else
ac_cv_lib_seccomp_seccomp_init=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_seccomp_seccomp_init" >&5
$as_echo "$ac_cv_lib_seccomp_seccomp_init" >&6; }
if test "x$ac_cv_lib_seccomp_seccomp_init" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBSECCOMP 1
_ACEOF

LIBS="-lseccomp $LIBS"

else
as_fn_error $? "library 'libseccomp' is required for Seccomp BPF support" "$LINENO" 5
fi

fi

# for contrib/uuid-ossp
Expand Down
13 changes: 13 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,14 @@ PGAC_ARG_BOOL(with, selinux, no, [build with SELinux support])
AC_SUBST(with_selinux)
AC_MSG_RESULT([$with_selinux])

#
# libseccomp
#
AC_MSG_CHECKING([whether to build with libseccomp support])
PGAC_ARG_BOOL(with, libseccomp, no, [build with libseccomp support])
AC_SUBST(with_libseccomp)
AC_MSG_RESULT([$with_libseccomp])

#
# Systemd
#
Expand Down Expand Up @@ -1567,6 +1575,11 @@ dnl If you want to use Apple's own Bonjour code on another platform,
dnl just add -ldns_sd to LIBS manually.
fi

if test "$with_libseccomp" = yes ; then
AC_CHECK_LIB(seccomp, seccomp_init, [],
[AC_MSG_ERROR([library 'libseccomp' is required for Seccomp BPF support])])
fi

# for contrib/uuid-ossp
if test "$with_uuid" = bsd ; then
AC_CHECK_HEADERS(uuid.h,
Expand Down
34 changes: 34 additions & 0 deletions contrib/pg_prewarm/autoprewarm.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include "utils/rel.h"
#include "utils/relfilenodemap.h"
#include "utils/resowner.h"
#include "utils/spccache.h"

#define AUTOPREWARM_FILE "autoprewarm.blocks"

Expand Down Expand Up @@ -433,10 +434,12 @@ void
autoprewarm_database_main(Datum main_arg)
{
int pos;
int io_concurrency;
BlockInfoRecord *block_info;
Relation rel = NULL;
BlockNumber nblocks = 0;
BlockInfoRecord *old_blk = NULL;
BlockInfoRecord *prefetch_blk = NULL;
dsm_segment *seg;

/* Establish signal handlers; once that's done, unblock signals. */
Expand Down Expand Up @@ -502,6 +505,8 @@ autoprewarm_database_main(Datum main_arg)

if (!rel)
CommitTransactionCommand();
else
io_concurrency = get_tablespace_maintenance_io_concurrency(rel->rd_rel->reltablespace);
}
if (!rel)
{
Expand Down Expand Up @@ -534,6 +539,35 @@ autoprewarm_database_main(Datum main_arg)
continue;
}

/* if prefetching is enabled for this relation */
if (io_concurrency > 0)
{
/* make prefetch_blk catch up */
if (blk > prefetch_blk)
{
prefetch_blk = blk;
}

/* now, prefetch all following blocks */
while (prefetch_blk <= &block_info[apw_state->prewarm_stop_idx])
{
/* unless they're of a different relfilenode */
if (prefetch_blk->filenode != blk->filenode ||
prefetch_blk->forknum != blk->forknum ||
prefetch_blk->blocknum >= nblocks)
break;

/* or unless they are more than io_concurrency blocks ahead */
if (blk + io_concurrency <= prefetch_blk)
break;

PrefetchBuffer(rel, prefetch_blk->forknum, prefetch_blk->blocknum);

/* continue with the next block */
prefetch_blk++;
}
}

/* Prewarm buffer. */
buf = ReadBufferExtended(rel, blk->forknum, blk->blocknum, RBM_NORMAL,
NULL);
Expand Down
18 changes: 16 additions & 2 deletions contrib/pg_prewarm/pg_prewarm.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@
#include "access/relation.h"
#include "fmgr.h"
#include "miscadmin.h"
#include "optimizer/cost.h"
#include "storage/bufmgr.h"
#include "storage/smgr.h"
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/lsyscache.h"
#include "utils/rel.h"
#include "utils/spccache.h"

PG_MODULE_MAGIC;

Expand Down Expand Up @@ -183,14 +185,26 @@ pg_prewarm(PG_FUNCTION_ARGS)
}
else if (ptype == PREWARM_BUFFER)
{
BlockNumber prefetch_block = first_block;
Oid nspOid;
int io_concurrency;

nspOid = rel->rd_rel->reltablespace;
io_concurrency = get_tablespace_maintenance_io_concurrency(nspOid);

/*
* In buffer mode, we actually pull the data into shared_buffers.
*/
for (block = first_block; block <= last_block; ++block)
{
Buffer buf;

Buffer buf;
BlockNumber prefetch_stop = block + Min(last_block - block + 1,
io_concurrency);
CHECK_FOR_INTERRUPTS();
while (prefetch_block < prefetch_stop)
{
PrefetchBuffer(rel, forkNumber, prefetch_block++);
}
buf = ReadBufferExtended(rel, forkNumber, block, RBM_NORMAL, NULL);
ReleaseBuffer(buf);
++blocks_done;
Expand Down
1 change: 1 addition & 0 deletions contrib/pg_prewarm/pg_prewarm.control
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ comment = 'prewarm relation data'
default_version = '1.2'
module_pathname = '$libdir/pg_prewarm'
relocatable = true
trusted = true
1 change: 1 addition & 0 deletions src/Makefile.global.in
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ with_tcl = @with_tcl@
with_ssl = @with_ssl@
with_readline = @with_readline@
with_selinux = @with_selinux@
with_libseccomp = @with_libseccomp@
with_systemd = @with_systemd@
with_gssapi = @with_gssapi@
with_krb_srvnam = @with_krb_srvnam@
Expand Down
3 changes: 2 additions & 1 deletion src/backend/access/brin/brin_xlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ brin_xlog_insert_update(XLogReaderState *record,
}

/* need this page's blkno to store in revmap */
regpgno = BufferGetBlockNumber(buffer);
//ZENITH XXX Don't use BufferGetBlockNumber because wal-redo doesn't pin buffer.
XLogRecGetBlockTag(record, 0, NULL, NULL, &regpgno);

/* insert the index item into the page */
if (action == BLK_NEEDS_REDO)
Expand Down
8 changes: 8 additions & 0 deletions src/backend/access/gin/gininsert.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ ginbuild(Relation heap, Relation index, IndexInfo *indexInfo)
elog(ERROR, "index \"%s\" already contains data",
RelationGetRelationName(index));

smgr_start_unlogged_build(index->rd_smgr);

initGinState(&buildstate.ginstate, index);
buildstate.indtuples = 0;
memset(&buildstate.buildStats, 0, sizeof(GinStatsData));
Expand Down Expand Up @@ -408,6 +410,8 @@ ginbuild(Relation heap, Relation index, IndexInfo *indexInfo)
buildstate.buildStats.nTotalPages = RelationGetNumberOfBlocks(index);
ginUpdateStats(index, &buildstate.buildStats, true);

smgr_finish_unlogged_build_phase_1(index->rd_smgr);

/*
* We didn't write WAL records as we built the index, so if WAL-logging is
* required, write all pages to the WAL now.
Expand All @@ -417,8 +421,12 @@ ginbuild(Relation heap, Relation index, IndexInfo *indexInfo)
log_newpage_range(index, MAIN_FORKNUM,
0, RelationGetNumberOfBlocks(index),
true);
SetLastWrittenLSNForBlockRange(XactLastRecEnd, index->rd_smgr->smgr_rnode.node, MAIN_FORKNUM, 0, RelationGetNumberOfBlocks(index));
SetLastWrittenLSNForRelation(XactLastRecEnd, index->rd_smgr->smgr_rnode.node, MAIN_FORKNUM);
}

smgr_end_unlogged_build(index->rd_smgr);

/*
* Return statistics
*/
Expand Down
19 changes: 13 additions & 6 deletions src/backend/access/gin/ginxlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ ginRedoSplit(XLogReaderState *record)
rootbuf;
bool isLeaf = (data->flags & GIN_INSERT_ISLEAF) != 0;
bool isRoot = (data->flags & GIN_SPLIT_ROOT) != 0;
XLogRedoAction action;

/*
* First clear incomplete-split flag on child page if this finishes a
Expand All @@ -415,21 +416,27 @@ ginRedoSplit(XLogReaderState *record)
if (!isLeaf)
ginRedoClearIncompleteSplit(record, 3);

if (XLogReadBufferForRedo(record, 0, &lbuffer) != BLK_RESTORED)
action = XLogReadBufferForRedo(record, 0, &lbuffer);
if (action != BLK_RESTORED && action != BLK_DONE)
elog(ERROR, "GIN split record did not contain a full-page image of left page");

if (XLogReadBufferForRedo(record, 1, &rbuffer) != BLK_RESTORED)
action = XLogReadBufferForRedo(record, 1, &rbuffer);
if (action != BLK_RESTORED && action != BLK_DONE)
elog(ERROR, "GIN split record did not contain a full-page image of right page");

if (isRoot)
{
if (XLogReadBufferForRedo(record, 2, &rootbuf) != BLK_RESTORED)
action = XLogReadBufferForRedo(record, 2, &rootbuf);
if (action != BLK_RESTORED && action != BLK_DONE)
elog(ERROR, "GIN split record did not contain a full-page image of root page");
UnlockReleaseBuffer(rootbuf);
if (rootbuf != InvalidBuffer)
UnlockReleaseBuffer(rootbuf);
}

UnlockReleaseBuffer(rbuffer);
UnlockReleaseBuffer(lbuffer);
if (rbuffer != InvalidBuffer)
UnlockReleaseBuffer(rbuffer);
if (lbuffer != InvalidBuffer)
UnlockReleaseBuffer(lbuffer);
}

/*
Expand Down
Loading