The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

Bug #9832

Storeconfig problems with Postgresql on 2.7.4

Added by Ashley Penney over 2 years ago. Updated 11 months ago.

Status:ClosedStart date:09/30/2011
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:stored configuration
Target version:2.7.5
Affected Puppet version:2.7.4 Branch:
Keywords:

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com

This issue is currently not available for export. If you are experiencing the issue described below, please file a new ticket in JIRA. Once a new ticket has been created, please add a link to it that points back to this Redmine ticket.


Description

Earlier today I discovered that all of my nodes were being drained of their /etc/hosts entries and investigative work with dpittman@ helped me track it down to a storeconfig issue.

Based on this chunk of the postgresql log:

LOG:  statement: SELECT "resources".* FROM "resources" INNER JOIN "resource_tags" ON "resource_tags"."resource_id" = "resources"."id" INNER JOIN "puppet_tags" ON "puppet_tags"."id" = "resource_tags"."puppet_tag_id" WHERE ((exported='t' AND restype='host') AND puppet_tags.name = 'ec2private' AND (host_id != 40))
LOG:  statement: SELECT  "hosts".* FROM "hosts" WHERE "hosts"."name" = 'qa-automation1.unity.perimeterusa.com' LIMIT 1
LOG:  statement: SELECT "resources".* FROM "resources" INNER JOIN "resource_tags" ON "resource_tags"."resource_id" = "resources"."id" INNER JOIN "puppet_tags" ON "puppet_tags"."id" = "resource_tags"."puppet_tag_id" WHERE ((exported='t' AND restype='host') AND puppet_tags.name = 'regular' AND (host_id != 40))
LOG:  statement: SELECT  "hosts".* FROM "hosts" WHERE "hosts"."name" = 'qa-automation1.unity.perimeterusa.com' LIMIT 1
LOG:  statement: SELECT "resources".* FROM "resources" INNER JOIN "resource_tags" ON "resource_tags"."resource_id" = "resources"."id" INNER JOIN "puppet_tags" ON "puppet_tags"."id" = "resource_tags"."puppet_tag_id" WHERE ((exported='t' AND restype='mysql_database') AND puppet_tags.name = 'mysql_qa-automation1.unity.perimeterusa.com' AND (host_id != 40))
LOG:  statement: SELECT  "hosts".* FROM "hosts" WHERE "hosts"."name" = 'qa-automation1.unity.perimeterusa.com' LIMIT 1
LOG:  statement: SELECT "resources".* FROM "resources" INNER JOIN "resource_tags" ON "resource_tags"."resource_id" = "resources"."id" INNER JOIN "puppet_tags" ON "puppet_tags"."id" = "resource_tags"."puppet_tag_id" WHERE ((exported='t' AND restype='mysql_user') AND puppet_tags.name = 'mysql_qa-automation1.unity.perimeterusa.com' AND (host_id != 40))
LOG:  statement: SELECT  "hosts".* FROM "hosts" WHERE "hosts"."name" = 'qa-automation1.unity.perimeterusa.com' LIMIT 1
LOG:  statement: SELECT "resources".* FROM "resources" INNER JOIN "resource_tags" ON "resource_tags"."resource_id" = "resources"."id" INNER JOIN "puppet_tags" ON "puppet_tags"."id" = "resource_tags"."puppet_tag_id" WHERE ((exported='t' AND restype='mysql_grant') AND puppet_tags.name = 'mysql_qa-automation1.unity.perimeterusa.com' AND (host_id != 40))
LOG:  statement: SELECT  "hosts".* FROM "hosts" WHERE "hosts"."name" = 'qa-automation1.unity.perimeterusa.com' LIMIT 1
LOG:  statement: SELECT "resources".* FROM "resources" INNER JOIN "resource_tags" ON "resource_tags"."resource_id" = "resources"."id" INNER JOIN "puppet_tags" ON "puppet_tags"."id" = "resource_tags"."puppet_tag_id" WHERE ((exported='t' AND restype='host') AND puppet_tags.name = 'ec2private' AND (host_id != 40))
LOG:  statement: SELECT  "hosts".* FROM "hosts" WHERE "hosts"."name" = 'qa-automation1.unity.perimeterusa.com' LIMIT 1
LOG:  statement: SELECT "resources".* FROM "resources" INNER JOIN "resource_tags" ON "resource_tags"."resource_id" = "resources"."id" INNER JOIN "puppet_tags" ON "puppet_tags"."id" = "resource_tags"."puppet_tag_id" WHERE ((exported='t' AND restype='host') AND puppet_tags.name = 'regular' AND (host_id != 40))
LOG:  statement: SELECT  "hosts".* FROM "hosts" WHERE "hosts"."name" = 'qa-automation1.unity.perimeterusa.com' LIMIT 1
LOG:  statement: SELECT "resources".* FROM "resources" INNER JOIN "resource_tags" ON "resource_tags"."resource_id" = "resources"."id" INNER JOIN "puppet_tags" ON "puppet_tags"."id" = "resource_tags"."puppet_tag_id" WHERE ((exported='t' AND restype='mysql_database') AND puppet_tags.name = 'mysql_qa-automation1.unity.perimeterusa.com' AND (host_id != 40))
LOG:  statement: SELECT  "hosts".* FROM "hosts" WHERE "hosts"."name" = 'qa-automation1.unity.perimeterusa.com' LIMIT 1
LOG:  statement: SELECT "resources".* FROM "resources" INNER JOIN "resource_tags" ON "resource_tags"."resource_id" = "resources"."id" INNER JOIN "puppet_tags" ON "puppet_tags"."id" = "resource_tags"."puppet_tag_id" WHERE ((exported='t' AND restype='mysql_user') AND puppet_tags.name = 'mysql_qa-automation1.unity.perimeterusa.com' AND (host_id != 40))
LOG:  statement: SELECT  "hosts".* FROM "hosts" WHERE "hosts"."name" = 'qa-automation1.unity.perimeterusa.com' LIMIT 1
LOG:  statement: SELECT "resources".* FROM "resources" INNER JOIN "resource_tags" ON "resource_tags"."resource_id" = "resources"."id" INNER JOIN "puppet_tags" ON "puppet_tags"."id" = "resource_tags"."puppet_tag_id" WHERE ((exported='t' AND restype='mysql_grant') AND puppet_tags.name = 'mysql_qa-automation1.unity.perimeterusa.com' AND (host_id != 40))

and the following queries:

select exported, count(exported) from resources group by exported

exported | count 
----------+-------
 f        |  3520
 t        |    31
(2 rows)

select distinct restype from resources

        restype         
------------------------
 User
 Resources
 Postgres::Config
 Postgres::Createuser
 Users::Adduser
 Host
 Postgres::Initdb
 Sqlexec
 Exec
 Stage
 Group
 Concat::Fragment
 Augeas
 Mysql_user
 Service
 Class
 Yumrepo
 File
 Security::Sudoers::Add
 Package
 Firewall
 Postgres::Enable
 Postgres::Createdb
 Mysql_grant
 Apache2::Site
 Cron
 Ssh_authorized_key
 Concat
 Mysql_database
(29 rows)

He was able to narrow it down to an issue with:

12:51 Awesome. Found why it isn’t matching: restype=‘host’ vs restype=‘Host’

The temporary workaround is:

You could patch your code in lib/puppet/indirector/resource/active_record.rb line 65 to be arguments = [true, type.to_s.capitalize]

History

#1 Updated by Daniel Pittman over 2 years ago

  • Description updated (diff)
  • Status changed from Unreviewed to Accepted
  • Target version set to 2.7.x
  • Affected Puppet version set to 2.7.4

This is a PostgreSQL specific issue, as far as we can tell: MySQL and SQLite are doing case insensitive comparisons, while PostgreSQL is case sensitive. Our test matrix didn’t cover PGSQL, so we missed this defect.

#2 Updated by Daniel Pittman over 2 years ago

  • Category set to stored configuration
  • Status changed from Accepted to In Topic Branch Pending Review

https://github.com/puppetlabs/puppet/pull/146 has this ready to merge into 2.7.x

#3 Updated by Michael Stahnke over 2 years ago

  • Status changed from In Topic Branch Pending Review to Closed
  • Target version changed from 2.7.x to 2.7.5

Merged and shipped in 2.7.5.

#4 Updated by Daniel Pittman 11 months ago

  • Assignee deleted (Daniel Pittman)

Also available in: Atom PDF