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

Same schema logical fixes #108

Merged
merged 10 commits into from Jun 7, 2016

Conversation

glynastill
Copy link
Contributor

This branch contains changes to check_same_schema mainly to assist when comparing schemas across logical replicas.
* support checking across logical replicas by checking logical name/type/definition when comparing operators/indices/functions/triggers etc rather than oids
* add '--assume-async' option to skip checking sequnece last_val on asyncronous replicas
* stop picking up oid named deferrable unique constraint triggers in trigger check
* correctly identify objects owned by group roles
* allow constraint check to work across <= 9.2 and >= 9.3 (pg_constraint.confmatchtype = 'u' == 's')
* include table name in key used to identify trigger and constraint checks to prevent false positives
* --filter on regex (as per the manual) rather than equality

glynastill and others added 10 commits June 7, 2016 12:13
operators   - Use text descriptions for result type and operands; ignore related oids
triggers    - Include table name in key to prevent false positive when another table has a trigger with the same name.  Use textual trigger definition; ignore tgqual represe
functions   - Use text function definition; ignore oid based types and defaults.
constraints - Include table name in key to prevent false positive when another table has a constraint with the same name. Use text constraint definition; ignore oid based values.
sequence    - Ignore last_value; I'm confused as to why we'd want to know this on a schema check.  But if required could be added back in with an optional filter instead.
indexes     - Ignore reltablespace oid; we check the tablespace name anyway. Ignore indkey attnum which can differ when tables have been altered differently but are otherwis
…s rather than pg_user.

This resolves issues where objects owned by a group role are missing in various checks (check_same_schema, check_commitratio, check_hitratio), or detail is missing (check_database_size), or results not filtered as intended (check_last_vacuum_analyze, check_relation_size).

Conflicts:
	check_postgres.pl
This relates to a change in the character representing a simple match
on a foreign key stored in the confmatchtype field changing from 'u'
to 's' between postgresql 9.2 and 9.3. Ref:

	http://www.postgresql.org/docs/9.2/static/catalog-pg-constraint.html
	http://www.postgresql.org/docs/9.3/static/catalog-pg-constraint.html
…nstraint triggers

These triggers have a name containting the triggers oid which mismatches on logical replicas; so to exclude these just ensure tgconstrindid is zero.
…ence last_value check.

Fixes for changes made to same_schema in commit f8145cd

  * Amend constraint unit tests in t/02_same_schema.t to take into account we now return the table name
  * Reinstate checking of a sequences last_val, and instead allow users of asynchronous replication to override with '--assume-async' option
As per the manual:
"To exclude objects of a certain type by a regular expression against their name, use "noname=regex"."

However the actual check in the script would only filter on an exact match; switched to regex.
@glynastill
Copy link
Contributor Author

rebased onto master

@df7cb
Copy link
Collaborator

df7cb commented Jun 7, 2016

Thanks!

@bucardo bucardo merged commit e32a893 into bucardo:master Jun 7, 2016
@glynastill glynastill deleted the same_schema_logical_fixes branch June 7, 2016 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants