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 pgstat file to preserve statistic between sessions #358

Open
wants to merge 214 commits into
base: REL_14_STABLE_neon
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 213 commits
Commits
Show all changes
214 commits
Select commit Hold shift + click to select a range
6423b78
[smgr_api] [community] smgr_api.patch
lubennikovaav May 16, 2021
6140082
[contrib/zenith] contrib_zenith.patch
lubennikovaav May 16, 2021
871ee98
[walredo] zenith_wal_redo.patch
lubennikovaav May 16, 2021
0b90dab
lastWrittenPageLSN.patch
lubennikovaav May 16, 2021
5d1d4aa
Fix GetPage requests right after replaying CREATE DATABASE
hlinnaka May 21, 2021
42b8f43
handle_eviction_of_non_wal_logged_pages.patch
lubennikovaav May 16, 2021
8eba458
[walproposer] wal_proposer.patch
lubennikovaav May 16, 2021
94b84ef
persist_unlogged_tables.patch
lubennikovaav May 16, 2021
f29ac2c
fix_pg_table_size.patch
lubennikovaav May 16, 2021
0df3684
[walredo] fix_gin_redo.patch
lubennikovaav May 16, 2021
de384f2
[walredo] fix_brin_redo.patch
lubennikovaav May 16, 2021
860f839
speculative_records_workaround.patch
lubennikovaav May 16, 2021
55dccb7
wallog_t_ctid.patch
lubennikovaav May 16, 2021
94c7f11
vacuumlazy_debug_stub.patch
lubennikovaav May 16, 2021
a5db8dc
[test] zenith_test_evict.patch
lubennikovaav May 16, 2021
d782c1b
fix_sequence_wallogging.patch
lubennikovaav May 16, 2021
5718c7c
Bring back change that got lost in refactoring. silence ReadBuffer_co…
lubennikovaav May 18, 2021
2fd3875
[contrib/zenith] [refer #225] if insert WAL position points at the en…
knizhnik Jun 7, 2021
c58bf01
[walproposer] Create replication slot for walproposer to avoid loose …
knizhnik Jun 8, 2021
e7ef05c
[walproposer] Skip absent WAL segment removed by pg_resetwal
lubennikovaav Aug 17, 2021
9a4d542
[walproposer] Fix breaking out of WalProposerPoll and WaitEventSetWai…
arssher Jun 11, 2021
423f73b
[walproposer] Make it possible to start postgres without reading chec…
knizhnik Jun 17, 2021
f459143
[walproposer] Simplify WL_LATCH_SET testing in the walproposer
ololobus Jul 5, 2021
f6acb0a
[walredo] Add basic support for Seccomp BPF mode
funbringer Jun 24, 2021
34b85e8
[smgr_api] [contrib/zenith] 1. Do not call mdinit from smgrinit() bec…
knizhnik Jul 9, 2021
7e2b417
[walproposer] [contrib/zenith] support zenith_tenant
LizardWizzard Jul 15, 2021
66fb5b4
[walproposer] Remove graceful termination of COPY during walproposer …
arssher Aug 4, 2021
616f45a
[walproposer] [contrib/zenith] [refer #395] Do no align sart replicat…
knizhnik Aug 9, 2021
65ce50b
[test] Add contrib/zenith_test_utils with helpers for testing and deb…
lubennikovaav Aug 10, 2021
ce222a3
[walproposer] Change condition for triggering recovery
knizhnik Aug 11, 2021
1ef045c
[contrib/zenith] Use authentication token passed as environment varia…
LizardWizzard Aug 4, 2021
3bd780f
[contrib/zenith] Fix race condition while WAL-logging page, leading t…
hlinnaka Aug 13, 2021
8c768c0
[walproposer] Rework walkeeper protocol to use libpq (#60)
sharnoff Aug 13, 2021
24bb700
Build zenithdb/compute-node:latest in CI (zenithdb/console#125)
ololobus Aug 16, 2021
5c17aba
zenith_regression_tests.patch
lubennikovaav Aug 23, 2021
1968565
Add test function to flush the shared buffer cache.
hlinnaka Aug 24, 2021
e4f2b16
Basic safekeeper refactoring and bug fixing.
arssher Aug 17, 2021
f2a0837
Rename VCL to epochStartLsn and restart_lsn to truncate_lsn.
arssher Aug 27, 2021
82dcd2f
[refer #27] Implement shared relsize cache to improve zenith performa…
knizhnik Aug 3, 2021
574ba5d
Cleanup walproposer changes from #60
sharnoff Aug 31, 2021
0737310
pass tenant id in connection string to safekeeper
LizardWizzard Aug 31, 2021
98dc4c0
Ask pageserver only with LSN's aligned on record boundary.
kelvich Aug 31, 2021
6718382
[refer #506] Correctly initialize all fields of WAL page header for f…
knizhnik Sep 1, 2021
bee24fe
Add --sync-safekeepers starting standalone walproposer to sync safeke…
knizhnik Aug 19, 2021
3178927
Update Dockerfile
ololobus Aug 27, 2021
b6fd51a
Fix compiler warnings in walproposer.c
ololobus Sep 10, 2021
6861fa6
Always advance truncateLsn to commitLsn, keeping it on record boundary.
arssher Sep 9, 2021
559c2a1
Minor logging editing.
arssher Sep 10, 2021
3414506
Fix walproposer starting streaming point.
arssher Sep 10, 2021
dea852c
Mark all recovery messages as received by the donor.
arssher Sep 14, 2021
ff595e3
Don't FATAL in walproposer when EOF arrives in SS_IDLE state.
arssher Sep 14, 2021
f82b6eb
Optimize walproposer starting streaming point.
arssher Sep 15, 2021
202fb86
Silence compiler warnings:
hlinnaka Sep 17, 2021
7c55bf3
Remove unused functions for reading non-rel pages.
hlinnaka Sep 17, 2021
bd5979d
Misc cleanup in the code that communicates with the page server.
hlinnaka Sep 17, 2021
6ef307b
Improve the protocol between Postgres and page server.
hlinnaka Sep 17, 2021
ee5299a
Run 'pgindent' on zenith-specific code in contrib/zenith and in walpr…
hlinnaka Sep 17, 2021
b935705
Fix a badly worded comment
hlinnaka Sep 20, 2021
23a6e79
Simplify a2e929e by storing starting point in walkeeper itself.
arssher Sep 16, 2021
4ed35d5
Catch walkeeper ErrorResponse in PQgetCopyData
sharnoff Sep 22, 2021
1871809
Use buffered I/O for reading commands from stdin.
hlinnaka Sep 24, 2021
27e3a50
Replace fread() with plain read() and a hand-written buffer.
hlinnaka Sep 30, 2021
afa880d
Store unlogged tables locally, and replace PD_WAL_LOGGED.
hlinnaka Oct 6, 2021
28e1bcf
Fix queue cleanup in proposer (#93)
petuhovskiy Oct 14, 2021
bef750f
Support read-only nodes
hlinnaka Oct 19, 2021
1b45bf6
Remove a drop of syncSafekeepers complexity.
arssher Oct 21, 2021
e63789c
Fix compiler warning.
arssher Oct 21, 2021
b70693b
Implement backpressure for compute node to avoid WAL overflow
knizhnik Sep 18, 2021
92f0a92
Initialize FSM/VM pages through buffer cache
ololobus Oct 19, 2021
48e45e3
Turn off back pressure by default
ololobus Oct 21, 2021
73c2bf2
ShutdownConnection instead of ResetConnection in more places.
arssher Oct 21, 2021
6d3e7e8
Handle partial writes to stdout in WAL redo process.
hlinnaka Nov 3, 2021
d4fcfd9
Handle keepalives while receiving WAL in recovery.
arssher Nov 8, 2021
ecfbad2
Fix truncateLsn update (#101)
petuhovskiy Nov 9, 2021
450e3fb
[walproposer] Get rid of SAB_Error after rebase
ololobus Nov 10, 2021
1a99944
Add term history to safekeepers.
arssher Nov 5, 2021
bd291b0
Clarify the meaning of StandbyReply LSNs used for backpressure
lubennikovaav Nov 9, 2021
e23594a
Use max_replication_apply_lag instead of max_replication_write_lag.
lubennikovaav Nov 11, 2021
e5ce130
Forward pageserver connection string to safekeeper
LizardWizzard Nov 25, 2021
a0c96c8
Move backpressure throttling to ProcessInterrupts()
lubennikovaav Nov 26, 2021
873574f
Stop building docker images in this repo.
kelvich Dec 15, 2021
7c5e028
[walproposer] Async WAL append (#105)
petuhovskiy Dec 21, 2021
b29a4a8
Fix walsender to work with zenith style standbyReply that sends non-z…
lubennikovaav Dec 22, 2021
99ee015
Do not copy the obsolete apply_conf binary into Docker image
ololobus Dec 25, 2021
acb3658
Reorder walproposer code in a more natural order (#112)
petuhovskiy Dec 31, 2021
795bb14
Simplify walproposer code (#114)
petuhovskiy Jan 4, 2022
fe53b71
Don't change propTerm after quorum is acquired (#107)
petuhovskiy Jan 4, 2022
24c53ee
walproposer renames (#116)
petuhovskiy Jan 5, 2022
234e6e2
Report back-pressure trottling status of backend
knizhnik Dec 29, 2021
a19cfb3
Add max_replication_write_lag
knizhnik Dec 29, 2021
af5761f
Do not throttle wal sender
knizhnik Jan 10, 2022
4c259df
Don't track acks in walproposer (#119)
petuhovskiy Jan 13, 2022
36e2a3b
Silence excessively noisy logging from walproposer.
hlinnaka Jan 14, 2022
dbc6341
Extend replication protocol with ZenithFeedback message.
lubennikovaav Dec 20, 2021
d3a2327
Allow to join empty safekeeper to existing cluster (#123)
petuhovskiy Jan 27, 2022
22360bd
Use local relation cache for smgr_exists
knizhnik Dec 29, 2021
7140479
Reduce walproposer logging after ca5e7beaf.
arssher Feb 4, 2022
971abf6
Implement cluster size quota for zenith compute node.
lubennikovaav Dec 20, 2021
da7022b
Revert "Use local relation cache for smgr_exists"
arssher Feb 9, 2022
3f671c3
Change the unit of cluster size limit GUC to MB, and other fixes.
hlinnaka Feb 9, 2022
f587669
Improve error handling while connecting to page server.
hlinnaka Feb 9, 2022
bbbe1ce
Make getpage requests interruptible.
hlinnaka Feb 9, 2022
9c1e11d
Fix memory leak of messages received from safekeepers.
hlinnaka Feb 10, 2022
9887f03
Initialize pgxactoff for walproposer
knizhnik Feb 11, 2022
6bc4ba6
Fix compilation warning after 8524105dc.
arssher Feb 14, 2022
2f338a1
Fix more compiler warnings.
arssher Feb 14, 2022
ebe340f
Remove dead code in handling ZenithFeedback part of an AppendResponse.
hlinnaka Feb 16, 2022
c2f33ba
Expose reading a relation page at a specific LSN (#131)
antons-antons Feb 18, 2022
ed3c9a8
Add backpressure_lsns() function. Fix zenith feedback processing
lubennikovaav Feb 17, 2022
cc281ef
Fix zenith_test_utils linkage on macOS
kelvich Feb 23, 2022
6e96c37
Add warning fr unrecgonized GUCs with zenith prefix
knizhnik Feb 21, 2022
49a022a
Count WAL flushes in walreceiver (#139)
petuhovskiy Mar 8, 2022
1a84f71
Use local relation cache for smgr_exists
knizhnik Dec 29, 2021
c9b6c96
Populate relsize cache when relation is created.
hlinnaka Mar 10, 2022
4d1b0cb
Fix pg_table_size() on a view
hlinnaka Mar 28, 2022
abb201e
Don't set commitLsn to truncateLsn.
arssher Mar 28, 2022
1358805
Raise fatal error on failed recovery (#147)
petuhovskiy Mar 31, 2022
afbc2a0
Enable dumping corrupt WAL segments (#145)
antons-antons Apr 1, 2022
87dae2a
Don't hold walproposer WAL in memory (#141)
petuhovskiy Apr 4, 2022
5bf4e68
Add --sysid parameter to initdb
knizhnik Jan 27, 2022
88cfd4a
Give up connection attempt to safekeeper after timeout.
arssher Apr 15, 2022
5c8fa2c
Avoid redundand memory allocation and sycnhronization in walredo (#144)
knizhnik Apr 23, 2022
2117482
Fix missed include for InRecovery (#149)
knizhnik Apr 25, 2022
5fc7d18
Avoid "bad syscall 39" on assertion failure in WAL redo process.
hlinnaka Apr 26, 2022
e3d732f
Add error context, if replaying a WAL record fails in WAL redo process.
hlinnaka Apr 26, 2022
6a546db
Add WARNING for debugging purposes.
hlinnaka Apr 26, 2022
3170b41
Turn Assertion into elog(ERROR), to help with debugging.
hlinnaka Apr 26, 2022
2e719a3
Fix errors in WAL redo about relpersistence mismatch.
hlinnaka Apr 26, 2022
7623ad9
Don't log 'last written LSN ahead of flushed'.
arssher Apr 26, 2022
026428c
Perform inmem_smgr cleaup after processing each record (#154)
knizhnik Apr 27, 2022
984248d
Avoid extending relation in the WAL redo process.
hlinnaka May 3, 2022
cd5729d
Send timeline_start_lsn in Elected and receive it in VoteResponse mes…
arssher May 1, 2022
db153c9
Verify basebackup LSN against consensus LSN in walproposer.
arssher May 2, 2022
be2d0e4
Implement pg_database_size():
lubennikovaav Jul 23, 2021
cfe5f3c
Shut down instance on basebackup LSN mismatch.
arssher May 6, 2022
61d19f5
Use compute-tools from the new neondatabase Docker Hub repo
ololobus May 9, 2022
caef1a4
zenith_test_utils extension: add neon_xlogflush()
yeputons May 10, 2022
27cd816
Reduce noise in the logs from inmem_write()
hlinnaka May 13, 2022
62fd2a7
Use compute_ctl instead of zenith_ctl (#162)
ololobus May 18, 2022
f6ab59e
Improve error messages on seccomp loading errors.
hlinnaka May 24, 2022
289abdb
Rename contrib/zenith to contrib/neon. Rename custom GUCs:
lubennikovaav May 26, 2022
d029854
Rename 'wal_acceptors' GUC to 'safekeepers'
lubennikovaav Apr 19, 2022
a249d33
Fix basebackup LSN comparison in walproposer.
arssher May 31, 2022
678e58d
Allow specifiyng the different compute-tools tag (#170)
ololobus May 31, 2022
e674797
Do not allocate shared memory for wal_redo process (#165)
knizhnik Jun 6, 2022
2c6f54f
Add check for NULL for malloc in InternalIpcMemoryCreate (#173)
knizhnik Jun 8, 2022
040daf5
Rename ZenithFeedback (#174)
SomeoneToIgnore Jun 10, 2022
43aaebb
Remove callmemaybe bits from compute (#172)
SomeoneToIgnore Jun 10, 2022
1cd83b5
Panic on receiving higher term (#176)
petuhovskiy Jun 22, 2022
fac89ab
Misc cleanup in libpagestore.c.
hlinnaka May 16, 2022
fadb421
Large last written lsn cache (#177)
knizhnik Jul 9, 2022
561bee3
Add uuid-ossp to the supported extensions (#181)
MMeent Jul 12, 2022
a96326c
Update last written LSN for gin/gist index metadata (#182)
knizhnik Jul 19, 2022
fd0465d
Revert "Update last written LSN for gin/gist index metadata (#182)" (…
knizhnik Jul 26, 2022
b1091eb
Fix `uuid-ossp` build
kelvich Aug 1, 2022
6fa0782
Remove redundant const (#189)
bojanserafimov Aug 8, 2022
cb8cd75
Eliminate UnkonwnXLogRecPtr and always use InvalidXLogRecPtr instead …
knizhnik Aug 12, 2022
56de5f2
Init wal redo buffer for fpi (#194)
knizhnik Aug 15, 2022
12b4ce3
Stamp XLP_FIRST_IS_CONTRECORD only if we start writing with page offset.
arssher Aug 14, 2022
fa779a1
Pull 99% of walproposer code into extension. (#188)
MMeent Aug 18, 2022
186bca0
Use ECR for image (#195)
zoete Aug 19, 2022
a829608
walproposer: do not send pageserver connstring with START_WAL_PUSH (#…
yeputons Aug 25, 2022
d8ee64d
Remove neon extensions from the vendor repo (#197)
MMeent Aug 25, 2022
aa0499a
Remove Dockerfile, it's now in the neon repo (#199)
ololobus Aug 26, 2022
a4b6546
Move backpressure throttling implementation to neon extension (#203)
knizhnik Sep 2, 2022
585290c
Merge last written cache lsn with new main branch (#201)
knizhnik Sep 4, 2022
74df0ad
Local prefetch implementation for Postgres 14
knizhnik Sep 12, 2022
dab5dff
Disable prefetch by default to make it possible to early merge this P…
knizhnik Sep 12, 2022
62cbaef
Disable prefetch by default to make it possible to early merge this P…
knizhnik Sep 12, 2022
b61bf54
Update expected output for sysviews test because of changed default v…
knizhnik Sep 12, 2022
96f340e
Set last written page lsn for created relation (#209)
knizhnik Sep 16, 2022
68d5859
Undo diasming VM check warning in vacuumlazy.c (#213)
knizhnik Sep 20, 2022
e546274
Pin pages with speculative insert tuples to prevent their reconstruct…
knizhnik Oct 20, 2022
edd2e65
Fix shared memory initialization for last written LSN cache (#224)
knizhnik Oct 24, 2022
a270df9
Fix upper boundary caculation in the chunks loop in SetLastWrittenLSN…
knizhnik Oct 28, 2022
9c10b7a
Move walredo process code under pgxn in the main 'neon' repository.
hlinnaka Oct 31, 2022
77d07fd
Misc cleanup, mostly to reduce unnecessary differences with upstream.
hlinnaka Oct 31, 2022
220ab8e
Optimize prefetch patterns in both heap seqscan and vacuum scans. (#227)
MMeent Nov 7, 2022
bbcefaf
Fix prefetch issues in parallel scans and vacuum's cleanup scan (#234)
MMeent Nov 11, 2022
428d1ad
Use prefetch in pg_prewarm extension (#236)
knizhnik Nov 17, 2022
02b845e
PG14: Prefetch cleanup (#242)
MMeent Nov 23, 2022
b196070
Do not produce open file error for unlogged relations (#239)
knizhnik Nov 24, 2022
13f4364
Maintain last written LSN for each page to enable prefetch on vacuum,…
knizhnik Nov 24, 2022
01c1dfb
Prefetch cleanup: (#247)
MMeent Dec 5, 2022
ddc9d47
Fix uninitialized variable in spgvacuum.c (#250)
MMeent Dec 7, 2022
d78ad76
Update heap pge LSN in case of VM changes even if wal_redo_hints=off …
knizhnik Dec 8, 2022
1a15868
Show prefetch statistic in EXPLAIN (#248)
knizhnik Jan 12, 2023
1a3341e
Implement efficient prefetch for parallel bitmap heap scan (#258)
knizhnik Feb 14, 2023
3ab16be
Unlogged index fix v14 (#259)
knizhnik Feb 22, 2023
cf9e36c
Fix bitmap scan prefetch (#260)
knizhnik Feb 23, 2023
338f137
Revert handling of UNLOGGED tables on compute side.
arssher Feb 24, 2023
7c8fa6c
Allow external main functions to skip config load and make last
kelvich Feb 23, 2023
841befc
Remove walredo-related hacks from InternalIpcMemoryCreate()
kelvich Mar 6, 2023
f156677
Adjust prefetch target for parallel bitmap scan (#273)
knizhnik Mar 27, 2023
f2c0f39
Heap bitmap scan prefetch fix2 v14 (#275)
knizhnik Apr 7, 2023
7d6adc5
Implement index prefetch for index and index-only scans (#277)
knizhnik Apr 7, 2023
31deb69
[PG14] Feature/replicas (#278)
MMeent Apr 13, 2023
74571e1
Do not allow users with CREATEROLE privelege to manage system user
kelvich Jul 7, 2023
6b4e16e
Fix regression tests after the patch with CREATEROLE restrictions
kelvich Jul 15, 2023
56e27c3
Make it possible to grant self created roles (#297)
knizhnik Jul 26, 2023
394f32e
Define NEON_SMGR in smgr.h to make it possible for extensions to use …
knizhnik Jul 29, 2023
4bbdda2
Request extension files and libraries from compute_ctl
lubennikovaav Jun 13, 2023
cadbbcc
Neon logical replication support for PG14 (#309)
knizhnik Oct 18, 2023
1ce5469
Fix elog format error in wallog_mapping_file (#315)
knizhnik Oct 19, 2023
ea71170
Remove excessive walsender reply logging.
arssher Oct 19, 2023
f56cd58
Update WAL buffers when restoring WAL at compute needed for LR (#325)
knizhnik Nov 3, 2023
b2fc5c6
Prevent output callbacks from hearing about neon-file messages (#330)
Dec 14, 2023
546a6d1
strncmp vs strcmp
save-buffer Dec 15, 2023
ab9db70
Allow creating publications FOR ALL TABLES
save-buffer Jan 11, 2024
0309285
Switch GetCurrentRoleId to GetUserId
save-buffer Jan 24, 2024
f378dcd
Support creating subscriptions as neon_superuser
Jan 25, 2024
018fb05
On demand downloading of SLRU segments (#333)
knizhnik Jan 31, 2024
06c440a
Persist pgstat file to preserve statistic between sessions
Feb 8, 2024
624f2b3
Persistent pgstat file only if it is successfully created
Feb 9, 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