Uploaded image for project: 'PuppetDB'
  1. PuppetDB
  2. PDB-4985

Querying for trusted on the inventory endpoint doesn't hit the index

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • None
    • PDB 6.19.0, PDB 7.7.0
    • PuppetDB
    • None
    • Ghost
    • 3
    • ghost-11.08.2021, ghost-22.09.2021
    • Needs Assessment
    • Bug Fix
    • Hide
      When querying for trusted facts on inventory endpoint with a query like :

      inventory[] { trusted.extensions.foo = "bar"}

      instead of facts.trusted.extensions.foo, the index wasn't hit. The change introduced by this ticket ensures that an index is hit if the query is made with just trusted.[fact] .
      Show
      When querying for trusted facts on inventory endpoint with a query like : inventory[] { trusted.extensions.foo = "bar"} instead of facts.trusted.extensions.foo, the index wasn't hit. The change introduced by this ticket ensures that an index is hit if the query is made with just trusted.[fact] .
    • Needs Assessment

    Description

      On the inventory endpoint, trusted facts can be queried in two ways

      inventory[] { trusted.extensions.foo = "bar"}
      

      But trusted is also just part of the factset

      inventory[] { facts.trusted.extensions.foo = "bar" }
      

      For the most part the queries function identically. But using trusted produces the filter

      WHERE ((fs.stable||fs.volatile)->'trusted' @> '{"extensions": {"foo": "bar"}}'
      

      and using facts.trusted produces the filter

      WHERE ((fs.stable||fs.volatile) @> '{"trusted" {"extensions": {"foo": "bar"}}}'
      

      the latter filter, using facts.trusted can use the index while the first, using trusted cannot because the index is on only (fs.stable || fs.volatile) so that must be what is on the left side of @> operator.

      Attachments

        Activity

          People

            oana.tanasoiu Oana Tanasoiu
            austin.blatt Austin Blatt
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support