MCPcopy Create free account
hub / github.com/apache/cloudberry / apply_server_options

Function apply_server_options

contrib/postgres_fdw/postgres_fdw.c:5874–5919  ·  view source on GitHub ↗

* Parse options from foreign server and apply them to fpinfo. * * New options might also require tweaking merge_fdw_options(). */

Source from the content-addressed store, hash-verified

5872 * New options might also require tweaking merge_fdw_options().
5873 */
5874static void
5875apply_server_options(PgFdwRelationInfo *fpinfo)
5876{
5877 ListCell *lc;
5878
5879 foreach(lc, fpinfo->server->options)
5880 {
5881 DefElem *def = (DefElem *) lfirst(lc);
5882
5883 if (strcmp(def->defname, "use_remote_estimate") == 0)
5884 {
5885 /*
5886 * GPDB_13_MERGE_FIXME: For updable statement, different forked Backends by Master
5887 * (QD and entrydb instances)
5888 * will hold Exclusive lock on the same table, which causes lock hang issue.
5889 * For Postgres, there is only one backend, and connnections have been shared,
5890 * so the issue doesn't exist.
5891 *
5892 * For example, following query will hang:
5893 * SELECT *
5894 * FROM ft1, ft2, ft4, ft5, local_tbl
5895 * WHERE ft1.c1 = ft2.c1 AND
5896 * ft1.c2 = ft4.c1 AND
5897 * ft1.c2 = ft5.c1 AND
5898 * ft1.c2 = local_tbl.c1 AND
5899 * ft1.c1 < 100 AND
5900 * ft2.c1 < 100 FOR UPDATE;
5901 */
5902 elog(WARNING, "fdw option 'use_remote_estimate' is not supported.");
5903 fpinfo->use_remote_estimate = false;
5904 }
5905 else if (strcmp(def->defname, "fdw_startup_cost") == 0)
5906 (void) parse_real(defGetString(def), &fpinfo->fdw_startup_cost, 0,
5907 NULL);
5908 else if (strcmp(def->defname, "fdw_tuple_cost") == 0)
5909 (void) parse_real(defGetString(def), &fpinfo->fdw_tuple_cost, 0,
5910 NULL);
5911 else if (strcmp(def->defname, "extensions") == 0)
5912 fpinfo->shippable_extensions =
5913 ExtractExtensionList(defGetString(def), false);
5914 else if (strcmp(def->defname, "fetch_size") == 0)
5915 (void) parse_int(defGetString(def), &fpinfo->fetch_size, 0, NULL);
5916 else if (strcmp(def->defname, "async_capable") == 0)
5917 fpinfo->async_capable = defGetBoolean(def);
5918 }
5919}
5920
5921/*
5922 * Parse options from foreign table and apply them to fpinfo.

Callers 1

Calls 6

parse_realFunction · 0.85
defGetStringFunction · 0.85
ExtractExtensionListFunction · 0.85
parse_intFunction · 0.85
defGetBooleanFunction · 0.85
foreachFunction · 0.50

Tested by

no test coverage detected