mirror of
https://github.com/postgres/postgres.git
synced 2026-04-26 00:31:07 -04:00
It turns out that our main regression test suite queries tables upon which concurrent DDL is occurring, which can, rarely, cause test_plan_advice failures. We're not quite ready to fix that problem just yet, because we want to gather some more information about how often it actually happens first. But, our plan is going to require test_plan_advice to access a few bits of pg_plan_advice that have been considered internal up until now, so this commit rejiggers things to expose those bits. First, test_plan_advice is going to need to be able to interpret the PGPA_TE_* constants which have been declared in pgpa_trove.h. The "TE" stands for "trove entry" but that's kind of a silly name; change the naming to "FB" (for "feedback") and move the declarations to pg_plan_advice.h, which is a header file that's already installed. This has the side benefit of making these constants available to any other extensions that may want to examine plan advice feedback. Second, test_plan_advice is going to call pgpa_planner_feedback_warning, so make that function non-static and mark it PGDLLEXPORT. Discussion: http://postgr.es/m/CA+TgmobOOmmXSJz3e+cjTY-bA1+W0dqVDqzxUBEvGtW62whYGg@mail.gmail.com
84 lines
2.6 KiB
C
84 lines
2.6 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* pgpa_trove.h
|
|
* All of the advice given for a particular query, appropriately
|
|
* organized for convenient access.
|
|
*
|
|
* Copyright (c) 2016-2026, PostgreSQL Global Development Group
|
|
*
|
|
* contrib/pg_plan_advice/pgpa_trove.h
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef PGPA_TROVE_H
|
|
#define PGPA_TROVE_H
|
|
|
|
#include "pgpa_ast.h"
|
|
|
|
#include "nodes/bitmapset.h"
|
|
|
|
typedef struct pgpa_trove pgpa_trove;
|
|
|
|
/*
|
|
* Each entry in a trove of advice represents the application of a tag to
|
|
* a single target.
|
|
*/
|
|
typedef struct pgpa_trove_entry
|
|
{
|
|
pgpa_advice_tag_type tag;
|
|
pgpa_advice_target *target;
|
|
int flags;
|
|
} pgpa_trove_entry;
|
|
|
|
/*
|
|
* What kind of information does the caller want to find in a trove?
|
|
*
|
|
* PGPA_TROVE_LOOKUP_SCAN means we're looking for scan advice.
|
|
*
|
|
* PGPA_TROVE_LOOKUP_JOIN means we're looking for join-related advice.
|
|
* This includes join order advice, join method advice, and semijoin-uniqueness
|
|
* advice.
|
|
*
|
|
* PGPA_TROVE_LOOKUP_REL means we're looking for general advice about this
|
|
* a RelOptInfo that may correspond to either a scan or a join. This includes
|
|
* gather-related advice and partitionwise advice. Note that partitionwise
|
|
* advice might seem like join advice, but that's not a helpful way of viewing
|
|
* the matter because (1) partitionwise advice is also relevant at the scan
|
|
* level and (2) other types of join advice affect only what to do from
|
|
* join_path_setup_hook, but partitionwise advice affects what to do in
|
|
* joinrel_setup_hook.
|
|
*/
|
|
typedef enum pgpa_trove_lookup_type
|
|
{
|
|
PGPA_TROVE_LOOKUP_JOIN,
|
|
PGPA_TROVE_LOOKUP_REL,
|
|
PGPA_TROVE_LOOKUP_SCAN
|
|
} pgpa_trove_lookup_type;
|
|
|
|
/*
|
|
* This struct is used to store the result of a trove lookup. For each member
|
|
* of "indexes", the entry at the corresponding offset within "entries" is one
|
|
* of the results.
|
|
*/
|
|
typedef struct pgpa_trove_result
|
|
{
|
|
pgpa_trove_entry *entries;
|
|
Bitmapset *indexes;
|
|
} pgpa_trove_result;
|
|
|
|
extern pgpa_trove *pgpa_build_trove(List *advice_items);
|
|
extern void pgpa_trove_lookup(pgpa_trove *trove,
|
|
pgpa_trove_lookup_type type,
|
|
int nrids,
|
|
pgpa_identifier *rids,
|
|
pgpa_trove_result *result);
|
|
extern void pgpa_trove_lookup_all(pgpa_trove *trove,
|
|
pgpa_trove_lookup_type type,
|
|
pgpa_trove_entry **entries,
|
|
int *nentries);
|
|
extern char *pgpa_cstring_trove_entry(pgpa_trove_entry *entry);
|
|
extern void pgpa_trove_set_flags(pgpa_trove_entry *entries,
|
|
Bitmapset *indexes, int flags);
|
|
extern void pgpa_trove_append_flags(StringInfo buf, int flags);
|
|
|
|
#endif
|