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

Unable to increase max_replication_slots #2

Closed
dev1ant opened this issue Oct 26, 2015 · 1 comment
Closed

Unable to increase max_replication_slots #2

dev1ant opened this issue Oct 26, 2015 · 1 comment

Comments

@dev1ant
Copy link

@dev1ant dev1ant commented Oct 26, 2015

As of 3947ef5 I get the following while trying to increase max_replication_slots:

postgres@pgtest05f ~ $ psql
psql (9.4.4)
Type "help" for help.

pgtest05f/postgres M # show max_replication_slots ;
 max_replication_slots
-----------------------
 2
(1 row)

Time: 0.433 ms
pgtest05f/postgres M # \q
postgres@pgtest05f ~ $ psql
psql (9.4.4)
Type "help" for help.

pgtest05f/postgres M # alter system set max_replication_slots to 3;
ALTER SYSTEM
Time: 5.309 ms
pgtest05f/postgres M # \q
postgres@pgtest05f ~ $ /usr/pgsql-9.4/bin/pg_ctl stop -m fast -D /var/lib/pgsql/9.4/data/
waiting for server to shut down.... done
server stopped
postgres@pgtest05f ~ $ /usr/pgsql-9.4/bin/pg_ctl start -D /var/lib/pgsql/9.4/data/
server starting
postgres@pgtest05f ~ $ < 2015-10-26 11:43:25.081 MSK >LOG:  registering background worker "pg_stat_wait collector"
< 2015-10-26 11:43:25.082 MSK >LOG:  registering background worker "repl_mon"
< 2015-10-26 11:43:25.461 MSK >FATAL:  no more LWLocks available

postgres@pgtest05f ~ $ vim /var/lib/pgsql/9.4/data/postgresql.auto.conf
postgres@pgtest05f ~ $ /usr/pgsql-9.4/bin/pg_ctl start -D /var/lib/pgsql/9.4/data/
server starting
postgres@pgtest05f ~ $ < 2015-10-26 11:45:04.244 MSK >LOG:  registering background worker "pg_stat_wait collector"
< 2015-10-26 11:45:04.244 MSK >LOG:  registering background worker "repl_mon"
< 2015-10-26 11:45:04.447 MSK >LOG:  redirecting log output to logging collector process
< 2015-10-26 11:45:04.447 MSK >HINT:  Future log output will appear in directory "pg_log".

postgres@pgtest05f ~ $

It does not reproduce with stock 9.4.5.

@dev1ant
Copy link
Author

@dev1ant dev1ant commented Oct 28, 2015

Fixed in 3fca95f.

@dev1ant dev1ant closed this Oct 28, 2015
asp437 pushed a commit that referenced this issue Apr 5, 2018
refresh_by_match_merge() has some issues in the way it builds a SQL
query to construct the "diff" table:

1. It doesn't require the selected unique index(es) to be indimmediate.
2. It doesn't pay attention to the particular equality semantics enforced
by a given index, but just assumes that they must be those of the column
datatype's default btree opclass.
3. It doesn't check that the indexes are btrees.
4. It's insufficiently careful to ensure that the parser will pick the
intended operator when parsing the query.  (This would have been a
security bug before CVE-2018-1058.)
5. It's not careful about indexes on system columns.

The way to fix #4 is to make use of the existing code in ri_triggers.c
for generating an arbitrary binary operator clause.  I chose to move
that to ruleutils.c, since that seems a more reasonable place to be
exporting such functionality from than ri_triggers.c.

While #1, #3, and postgres#5 are just latent given existing feature restrictions,
and #2 doesn't arise in the core system for lack of alternate opclasses
with different equality behaviors, #4 seems like an issue worth
back-patching.  That's the bulk of the change anyway, so just back-patch
the whole thing to 9.4 where this code was introduced.

Discussion: https://postgr.es/m/[email protected]
glukhovn pushed a commit that referenced this issue Feb 14, 2019
The original setup for dependencies of partitioned objects had
serious problems:

1. It did not verify that a drop cascading to a partition-child object
also cascaded to at least one of the object's partition parents.  Now,
normally a child object would share all its dependencies with one or
another parent (e.g. a child index's opclass dependencies would be shared
with the parent index), so that this oversight is usually harmless.
But if some dependency failed to fit this pattern, the child could be
dropped while all its parents remain, creating a logically broken
situation.  (It's easy to construct artificial cases that break it,
such as attaching an unrelated extension dependency to the child object
and then dropping the extension.  I'm not sure if any less-artificial
cases exist.)

2. Management of partition dependencies during ATTACH/DETACH PARTITION
was complicated and buggy; for example, after detaching a partition
table it was possible to create cases where a formerly-child index
should be dropped and was not, because the correct set of dependencies
had not been reconstructed.

Less seriously, because multiple partition relationships were
represented identically in pg_depend, there was an order-of-traversal
dependency on which partition parent was cited in error messages.
We also had some pre-existing order-of-traversal hazards for error
messages related to internal and extension dependencies.  This is
cosmetic to users but causes testing problems.

To fix #1, add a check at the end of the partition tree traversal
to ensure that at least one partition parent got deleted.  To fix #2,
establish a new policy that partition dependencies are in addition to,
not instead of, a child object's usual dependencies; in this way
ATTACH/DETACH PARTITION need not cope with adding or removing the
usual dependencies.

To fix the cosmetic problem, distinguish between primary and secondary
partition dependency entries in pg_depend, by giving them different
deptypes.  (They behave identically except for having different
priorities for being cited in error messages.)  This means that the
former 'I' dependency type is replaced with new 'P' and 'S' types.

This also fixes a longstanding bug that after handling an internal
dependency by recursing to the owning object, findDependentObjects
did not verify that the current target was now scheduled for deletion,
and did not apply the current recursion level's objflags to it.
Perhaps that should be back-patched; but in the back branches it
would only matter if some concurrent transaction had removed the
internal-linkage pg_depend entry before the recursive call found it,
or the recursive call somehow failed to find it, both of which seem
unlikely.

Catversion bump because the contents of pg_depend change for
partitioning relationships.

Patch HEAD only.  It's annoying that we're not fixing #2 in v11,
but there seems no practical way to do so given that the problem
is exactly a poor choice of what entries to put in pg_depend.
We can't really fix that while staying compatible with what's
in pg_depend in existing v11 installations.

Discussion: https://postgr.es/m/CAH2-Wzkypv1R+teZrr71U23J578NnTBt2X8+Y=Odr4pOdW1rXg@mail.gmail.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.