[PDB-2486] PuppetDB crashes during startup migration with namespaced trgm indices Created: 2016/03/01  Updated: 2016/04/04  Resolved: 2016/03/14

Status: Closed
Project: PuppetDB
Component/s: None
Affects Version/s: PDB 2.3.8
Fix Version/s: PDB 3.2.5, PDB 4.0.0

Type: Bug Priority: Normal
Reporter: Nick Moriarty Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

PuppetDB 2.3.8-1puppetlabs1 on Ubuntu 14.04
Running against PostgreSQL 9.5


Template:
Story Points: 1
Sprint: PuppetDB 2016-03-23

 Description   

Our PuppetDB instance runs against a managed PostgreSQL service hosting multiple databases. This means that indices end up being created under the 'puppetdb' namespace rather than the 'public' one.

With pg_trgm indices enabled, PuppetDB crashes at startup as it tries to create duplicate indices during the migration operation. This is because it ends up looking in the 'public' namespace by default.

In storage-utils, the default namespace for testing whether an index exists is 'public', which is not necessarily correct for a given deployment.

The result is a BatchUpdateException, which kills the PuppetDB application straight away.



 Comments   
Comment by Russell Mull [ 2016/03/01 ]

Hi Nick Moriarty,

Can you tell us a more about your PostgreSQL setup? How are you getting PuppetDB to run outside the 'public' schema? Did you (or whoever is running the DB) set search_path for your user to '$user,public' or something similar?

Russ

Comment by Nick Moriarty [ 2016/03/02 ]

Hi Russ,

I asked for the information from our DBA - here's the reply:

We've revoked all privs on public schema from public (as mentioned here http://www.postgresql.org/docs/9.4/static/ddl-schemas.html). Then as we're not using the public schema for public use it made sense to revoke all privs from it entirely and made a new schema called puppetdb for user also called puppetdb who has a search path set to the same.

Regards

Comment by Wyatt Alt [ 2016/03/14 ]

Nick Moriarty Thanks for the report. There's a fix destined for the 3.2.5 release – not sure about timing on that yet. Unfortunately though we are not actively developing the 2.3.x branch anymore, so that fix won't help you until you upgrade to 3.x.

If upgrading isn't feasible I think you could squeeze by by getting indexes named fact_paths_path_trgm and fact_values_string_trgm into the public schema somewhere, but that's such an ugly hack I'm almost embarrassed to mention it. Let us know if there's anything additional we can help with.

Generated at Mon Dec 16 04:23:51 PST 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.