feat(snapshot): add index restore session settings#990
Open
jonasHanhan wants to merge 2 commits into
Open
Conversation
kvch
reviewed
Jul 14, 2026
| PGSTREAM_POSTGRES_SNAPSHOT_NO_PRIVILEGES=true | ||
| PGSTREAM_POSTGRES_SNAPSHOT_EXCLUDED_SECURITY_LABELS="anon" | ||
| PGSTREAM_POSTGRES_SNAPSHOT_REFRESH_MATERIALIZED_VIEWS=true | ||
| PGSTREAM_POSTGRES_SNAPSHOT_INDEX_CONSTRAINT_SESSION_SETTINGS='{"maintenance_work_mem":"4GB","max_parallel_maintenance_workers":"4","synchronous_commit":"off","statement_timeout":"0","lock_timeout":"0"}' |
Collaborator
There was a problem hiding this comment.
Could you please change the format of this configuration. It would be more readable to set options like this so the setting:
mainteanance_work_mem=4GB max_parallel_maintenance_workers=4
kvch
reviewed
Jul 14, 2026
|
|
||
| var sessionSettingNamePattern = regexp.MustCompile(`^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$`) | ||
|
|
||
| func buildSessionSettingsDump(settings map[string]string) ([]byte, error) { |
Collaborator
There was a problem hiding this comment.
Instead of constructing the SET statements, we could pass the options to PostgreSQL using PGOPTIONS. RunPGRestore already uses psql, so we can pass the options easily.
kvch
requested changes
Jul 14, 2026
kvch
left a comment
Collaborator
There was a problem hiding this comment.
Thank you for the contribution! I have requested some changes. Let me know if you need more details.
Signed-off-by: jonasHanhan <zqhmusic121@gmail.com>
jonasHanhan
force-pushed
the
feat/index-constraint-session-settings
branch
from
July 15, 2026 06:03
de0b12c to
7d0a679
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds configurable PostgreSQL session settings for the
pg_dump/pg_restoreindex and constraint restore phase. Settings use a readablename=valuelist and are passed to PostgreSQL throughPGOPTIONSonly for direct index/constraint restores. Empty configuration preserves the current behavior, and WAL restore deliberately skips the settings.Related Issue(s)
Type of Change
Changes Made
PGRestoreOptionsand apply them withPGOPTIONS=-c name=value, preserving existingPGOPTIONS.Testing
Checklist
Additional Notes
Validation completed on the latest
mainwith:make generatemake testgolangci-lint v2.10.1(0 issues)