Skip to content

Commit 9889df7

Browse files
committed
[yugabyte#23706] YSQL: Add table-level catcache Prometheus metrics
Summary: Adds table-level Prometheus metrics for the number of catcache misses in addition to the current index-level ones added in D35792. These metrics are node-level, i.e. they will include the cache misses from all backends running on this node, but not the other nodes. They accessible via the `:13000/prometheus-metrics` endpoint. Including the metrics added in this revision, we now have three YSQL metrics that track catalog cache misses: - `CatalogCacheMisses` (no `table_name` field): Total number of cache misses across all catcaches. - `CatalogCacheMisses` (`table_name` field specified): Number of cache misses for the index specified by `table_name`. - `CatalogCacheTableMisses` (**new**): Number of cache misses for all catcaches on the table specified by `table_name`. Test Plan: ``` ./yb_build.sh --cxx-test pgwrapper_pg_libpq-test --gtest_filter PgLibPqTest.CatalogCacheIdMissMetricsTest ``` Manual test: ``` bin/yb-ctl create bin/ysqlsh yugabyte=# create table test(a int); CREATE TABLE yugabyte=# \c You are now connected to database "yugabyte" as user "yugabyte". yugabyte=# select * from t; a --- (0 rows) yugabyte=# \q wget 'http://127.0.0.1:13000/prometheus-metrics?reset_histograms=false&show_help=false' -O - 2>/dev/null | grep CatalogCacheTableMisses | grep count handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_aggregate",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_am",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_amop",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_amproc",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_attribute",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_auth_members",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_authid",exported_instance="kf-mbp-v47vl:9000"} 2 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_cast",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_class",exported_instance="kf-mbp-v47vl:9000"} 3 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_collation",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_constraint",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_conversion",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_database",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_default_acl",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_enum",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_event_trigger",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_foreign_data_wrapper",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_foreign_server",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_foreign_table",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_index",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_language",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_namespace",exported_instance="kf-mbp-v47vl:9000"} 2 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_opclass",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_operator",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_opfamily",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_partitioned_table",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_proc",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_publication",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_publication_rel",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_range",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_replication_origin",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_rewrite",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_sequence",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_statistic",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_statistic_ext",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_subscription",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_subscription_rel",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_tablespace",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_transform",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_ts_config",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_ts_config_map",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_ts_dict",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_ts_parser",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_ts_template",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_type",exported_instance="kf-mbp-v47vl:9000"} 1 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_user_mapping",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 handler_latency_yb_ysqlserver_SQLProcessor_CatalogCacheTableMisses_count{metric_id="yb.ysqlserver",metric_type="server",table_name="pg_yb_tablegroup",exported_instance="kf-mbp-v47vl:9000"} 0 1724889458674 ``` Reviewers: myang Reviewed By: myang Subscribers: yql Differential Revision: https://phorge.dev.yugabyte.com/D37633
1 parent 50ff737 commit 9889df7

File tree

8 files changed

+499
-106
lines changed

8 files changed

+499
-106
lines changed

src/postgres/src/backend/utils/cache/catcache.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
static CatCacheHeader *CacheHdr = NULL;
8686
static long YbNumCatalogCacheMisses;
8787
static long YbNumCatalogCacheIdMisses[SysCacheSize] = {0};
88+
static long YbNumCatalogCacheTableMisses[YbNumCatalogCacheTables] = {0};
8889

8990
static inline HeapTuple SearchCatCacheInternal(CatCache *cache,
9091
int nkeys,
@@ -1825,6 +1826,7 @@ SearchCatCacheMiss(CatCache *cache,
18251826
{
18261827
YbNumCatalogCacheMisses++;
18271828
YbNumCatalogCacheIdMisses[cache->id]++;
1829+
YbNumCatalogCacheTableMisses[YbGetCatalogCacheTableIdFromCacheId(cache->id)]++;
18281830
}
18291831

18301832
if (yb_debug_log_catcache_events)
@@ -2686,6 +2688,12 @@ YbGetCatCacheIdMisses()
26862688
return YbNumCatalogCacheIdMisses;
26872689
}
26882690

2691+
long *
2692+
YbGetCatCacheTableMisses()
2693+
{
2694+
return YbNumCatalogCacheTableMisses;
2695+
}
2696+
26892697
YbCatCListIterator
26902698
YbCatCListIteratorBegin(CatCList *list)
26912699
{

src/postgres/src/backend/utils/cache/syscache.c

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,149 @@ static const char *yb_cache_index_name_table[] = {
10891089
static_assert(SysCacheSize == sizeof(yb_cache_index_name_table) /
10901090
sizeof(const char *), "Wrong catalog cache number");
10911091

1092+
/* List of all the tables that have caches on them */
1093+
static const char *yb_cache_table_name_table[] = {
1094+
"pg_aggregate",
1095+
"pg_am",
1096+
"pg_amop",
1097+
"pg_amproc",
1098+
"pg_attribute",
1099+
"pg_auth_members",
1100+
"pg_authid",
1101+
"pg_cast",
1102+
"pg_class",
1103+
"pg_collation",
1104+
"pg_constraint",
1105+
"pg_conversion",
1106+
"pg_database",
1107+
"pg_default_acl",
1108+
"pg_enum",
1109+
"pg_event_trigger",
1110+
"pg_foreign_data_wrapper",
1111+
"pg_foreign_server",
1112+
"pg_foreign_table",
1113+
"pg_index",
1114+
"pg_language",
1115+
"pg_namespace",
1116+
"pg_opclass",
1117+
"pg_operator",
1118+
"pg_opfamily",
1119+
"pg_partitioned_table",
1120+
"pg_proc",
1121+
"pg_publication",
1122+
"pg_publication_rel",
1123+
"pg_range",
1124+
"pg_replication_origin",
1125+
"pg_rewrite",
1126+
"pg_sequence",
1127+
"pg_statistic",
1128+
"pg_statistic_ext",
1129+
"pg_subscription",
1130+
"pg_subscription_rel",
1131+
"pg_tablespace",
1132+
"pg_transform",
1133+
"pg_ts_config",
1134+
"pg_ts_config_map",
1135+
"pg_ts_dict",
1136+
"pg_ts_parser",
1137+
"pg_ts_template",
1138+
"pg_type",
1139+
"pg_user_mapping",
1140+
"pg_yb_tablegroup",
1141+
};
1142+
1143+
static_assert(YbNumCatalogCacheTables ==
1144+
sizeof(yb_cache_table_name_table) / sizeof(const char *),
1145+
"yb_catalog_cache_table_name_table size mismatch");
1146+
1147+
1148+
/* Maps cache id to the table id in yb_cache_table_name_table */
1149+
static YbCatalogCacheTable yb_catalog_cache_tables[] = {
1150+
YbCatalogCacheTable_pg_aggregate,
1151+
YbCatalogCacheTable_pg_am,
1152+
YbCatalogCacheTable_pg_am,
1153+
YbCatalogCacheTable_pg_amop,
1154+
YbCatalogCacheTable_pg_amop,
1155+
YbCatalogCacheTable_pg_amproc,
1156+
YbCatalogCacheTable_pg_attribute,
1157+
YbCatalogCacheTable_pg_attribute,
1158+
YbCatalogCacheTable_pg_auth_members,
1159+
YbCatalogCacheTable_pg_auth_members,
1160+
YbCatalogCacheTable_pg_authid,
1161+
YbCatalogCacheTable_pg_authid,
1162+
YbCatalogCacheTable_pg_cast,
1163+
YbCatalogCacheTable_pg_opclass,
1164+
YbCatalogCacheTable_pg_opclass,
1165+
YbCatalogCacheTable_pg_collation,
1166+
YbCatalogCacheTable_pg_collation,
1167+
YbCatalogCacheTable_pg_conversion,
1168+
YbCatalogCacheTable_pg_conversion,
1169+
YbCatalogCacheTable_pg_constraint,
1170+
YbCatalogCacheTable_pg_conversion,
1171+
YbCatalogCacheTable_pg_database,
1172+
YbCatalogCacheTable_pg_default_acl,
1173+
YbCatalogCacheTable_pg_enum,
1174+
YbCatalogCacheTable_pg_enum,
1175+
YbCatalogCacheTable_pg_event_trigger,
1176+
YbCatalogCacheTable_pg_event_trigger,
1177+
YbCatalogCacheTable_pg_foreign_data_wrapper,
1178+
YbCatalogCacheTable_pg_foreign_data_wrapper,
1179+
YbCatalogCacheTable_pg_foreign_server,
1180+
YbCatalogCacheTable_pg_foreign_server,
1181+
YbCatalogCacheTable_pg_foreign_table,
1182+
YbCatalogCacheTable_pg_index,
1183+
YbCatalogCacheTable_pg_language,
1184+
YbCatalogCacheTable_pg_language,
1185+
YbCatalogCacheTable_pg_namespace,
1186+
YbCatalogCacheTable_pg_namespace,
1187+
YbCatalogCacheTable_pg_operator,
1188+
YbCatalogCacheTable_pg_operator,
1189+
YbCatalogCacheTable_pg_opfamily,
1190+
YbCatalogCacheTable_pg_opfamily,
1191+
YbCatalogCacheTable_pg_partitioned_table,
1192+
YbCatalogCacheTable_pg_proc,
1193+
YbCatalogCacheTable_pg_proc,
1194+
YbCatalogCacheTable_pg_publication,
1195+
YbCatalogCacheTable_pg_publication,
1196+
YbCatalogCacheTable_pg_publication_rel,
1197+
YbCatalogCacheTable_pg_publication_rel,
1198+
YbCatalogCacheTable_pg_range,
1199+
YbCatalogCacheTable_pg_class,
1200+
YbCatalogCacheTable_pg_class,
1201+
YbCatalogCacheTable_pg_replication_origin,
1202+
YbCatalogCacheTable_pg_replication_origin,
1203+
YbCatalogCacheTable_pg_rewrite,
1204+
YbCatalogCacheTable_pg_sequence,
1205+
YbCatalogCacheTable_pg_statistic_ext,
1206+
YbCatalogCacheTable_pg_statistic_ext,
1207+
YbCatalogCacheTable_pg_statistic,
1208+
YbCatalogCacheTable_pg_subscription,
1209+
YbCatalogCacheTable_pg_subscription,
1210+
YbCatalogCacheTable_pg_subscription_rel,
1211+
YbCatalogCacheTable_pg_tablespace,
1212+
YbCatalogCacheTable_pg_transform,
1213+
YbCatalogCacheTable_pg_transform,
1214+
YbCatalogCacheTable_pg_ts_config_map,
1215+
YbCatalogCacheTable_pg_ts_config,
1216+
YbCatalogCacheTable_pg_ts_config,
1217+
YbCatalogCacheTable_pg_ts_dict,
1218+
YbCatalogCacheTable_pg_ts_dict,
1219+
YbCatalogCacheTable_pg_ts_parser,
1220+
YbCatalogCacheTable_pg_ts_parser,
1221+
YbCatalogCacheTable_pg_ts_template,
1222+
YbCatalogCacheTable_pg_ts_template,
1223+
YbCatalogCacheTable_pg_type,
1224+
YbCatalogCacheTable_pg_type,
1225+
YbCatalogCacheTable_pg_user_mapping,
1226+
YbCatalogCacheTable_pg_user_mapping,
1227+
YbCatalogCacheTable_pg_yb_tablegroup,
1228+
YbCatalogCacheTable_pg_constraint,
1229+
};
1230+
1231+
static_assert(SysCacheSize ==
1232+
sizeof(yb_catalog_cache_tables) / sizeof(YbCatalogCacheTable),
1233+
"yb_catalog_cache_tables size mismatch");
1234+
10921235
typedef struct YbPinnedObjectKey
10931236
{
10941237
Oid classid;
@@ -2046,6 +2189,20 @@ YbCheckCatalogCacheIndexNameTable()
20462189
return false;
20472190
}
20482191
ReleaseSysCache(tuple);
2192+
2193+
const char *table_name = YbGetCatalogCacheTableNameFromCacheId(cache_id);
2194+
Oid reloid = cacheinfo[cache_id].reloid;
2195+
tuple = SearchSysCache1(RELOID, reloid);
2196+
Assert(HeapTupleIsValid(tuple));
2197+
classForm = (Form_pg_class) GETSTRUCT(tuple);
2198+
if (strcmp(NameStr(classForm->relname), table_name))
2199+
{
2200+
ReleaseSysCache(tuple);
2201+
YBC_LOG_WARNING("Cache id %u has name mismatch: %s vs %s", cache_id,
2202+
NameStr(classForm->relname), table_name);
2203+
return false;
2204+
}
2205+
ReleaseSysCache(tuple);
20492206
}
20502207
return true;
20512208
}
@@ -2055,3 +2212,24 @@ const char* YbGetCatalogCacheIndexName(int cache_id)
20552212
{
20562213
return yb_cache_index_name_table[cache_id];
20572214
}
2215+
2216+
const char *
2217+
YbGetCatalogCacheTableNameFromTableId(int table_id)
2218+
{
2219+
Assert(table_id >= 0 && table_id < YbNumCatalogCacheTables);
2220+
return yb_cache_table_name_table[table_id];
2221+
}
2222+
2223+
int
2224+
YbGetCatalogCacheTableIdFromCacheId(int cache_id)
2225+
{
2226+
int table_id = yb_catalog_cache_tables[cache_id];
2227+
Assert(table_id >= 0 && table_id < YbNumCatalogCacheTables);
2228+
return table_id;
2229+
}
2230+
2231+
const char *
2232+
YbGetCatalogCacheTableNameFromCacheId(int cache_id)
2233+
{
2234+
return YbGetCatalogCacheTableNameFromTableId(YbGetCatalogCacheTableIdFromCacheId(cache_id));
2235+
}

src/postgres/src/include/utils/catcache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ extern void PrintCatCacheListLeakWarning(CatCList *list);
243243

244244
extern long YbGetCatCacheMisses();
245245
extern long* YbGetCatCacheIdMisses();
246+
extern long *YbGetCatCacheTableMisses();
246247

247248
extern YbCatCListIterator YbCatCListIteratorBegin(CatCList *list);
248249
extern HeapTuple YbCatCListIteratorGetNext(YbCatCListIterator *iterator);

src/postgres/src/include/utils/syscache.h

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,59 @@ enum SysCacheIdentifier
116116
#define SysCacheSize (YBCONSTRAINTRELIDTYPIDNAME + 1)
117117
};
118118

119+
typedef enum YbCatalogCacheTable
120+
{
121+
YbCatalogCacheTable_pg_aggregate,
122+
YbCatalogCacheTable_pg_am,
123+
YbCatalogCacheTable_pg_amop,
124+
YbCatalogCacheTable_pg_amproc,
125+
YbCatalogCacheTable_pg_attribute,
126+
YbCatalogCacheTable_pg_auth_members,
127+
YbCatalogCacheTable_pg_authid,
128+
YbCatalogCacheTable_pg_cast,
129+
YbCatalogCacheTable_pg_class,
130+
YbCatalogCacheTable_pg_collation,
131+
YbCatalogCacheTable_pg_constraint,
132+
YbCatalogCacheTable_pg_conversion,
133+
YbCatalogCacheTable_pg_database,
134+
YbCatalogCacheTable_pg_default_acl,
135+
YbCatalogCacheTable_pg_enum,
136+
YbCatalogCacheTable_pg_event_trigger,
137+
YbCatalogCacheTable_pg_foreign_data_wrapper,
138+
YbCatalogCacheTable_pg_foreign_server,
139+
YbCatalogCacheTable_pg_foreign_table,
140+
YbCatalogCacheTable_pg_index,
141+
YbCatalogCacheTable_pg_language,
142+
YbCatalogCacheTable_pg_namespace,
143+
YbCatalogCacheTable_pg_opclass,
144+
YbCatalogCacheTable_pg_operator,
145+
YbCatalogCacheTable_pg_opfamily,
146+
YbCatalogCacheTable_pg_partitioned_table,
147+
YbCatalogCacheTable_pg_proc,
148+
YbCatalogCacheTable_pg_publication,
149+
YbCatalogCacheTable_pg_publication_rel,
150+
YbCatalogCacheTable_pg_range,
151+
YbCatalogCacheTable_pg_replication_origin,
152+
YbCatalogCacheTable_pg_rewrite,
153+
YbCatalogCacheTable_pg_sequence,
154+
YbCatalogCacheTable_pg_statistic,
155+
YbCatalogCacheTable_pg_statistic_ext,
156+
YbCatalogCacheTable_pg_subscription,
157+
YbCatalogCacheTable_pg_subscription_rel,
158+
YbCatalogCacheTable_pg_tablespace,
159+
YbCatalogCacheTable_pg_transform,
160+
YbCatalogCacheTable_pg_ts_config,
161+
YbCatalogCacheTable_pg_ts_config_map,
162+
YbCatalogCacheTable_pg_ts_dict,
163+
YbCatalogCacheTable_pg_ts_parser,
164+
YbCatalogCacheTable_pg_ts_template,
165+
YbCatalogCacheTable_pg_type,
166+
YbCatalogCacheTable_pg_user_mapping,
167+
YbCatalogCacheTable_pg_yb_tablegroup
168+
169+
#define YbNumCatalogCacheTables (YbCatalogCacheTable_pg_yb_tablegroup + 1)
170+
} YbCatalogCacheTable;
171+
119172
/* Used in IsYugaByteEnabled() mode only */
120173
extern void YbSetSysCacheTuple(Relation rel, HeapTuple tup);
121174
extern void YbPreloadCatalogCache(int cache_id, int idx_cache_id);
@@ -127,6 +180,9 @@ extern void YbPinObjectIfNeeded(Oid classId, Oid objectId, bool shared_dependenc
127180
extern bool YbCheckCatalogCacheIndexNameTable();
128181
#endif
129182
extern const char* YbGetCatalogCacheIndexName(int cache_id);
183+
extern const char *YbGetCatalogCacheTableNameFromTableId(int table_id);
184+
extern const char *YbGetCatalogCacheTableNameFromCacheId(int cache_id);
185+
extern int YbGetCatalogCacheTableIdFromCacheId(int cache_id);
130186

131187
extern void InitCatalogCache(void);
132188
extern void InitCatalogCachePhase2(void);

0 commit comments

Comments
 (0)