Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick Resgroup related code from GreenPlum [Mar 2, 2022 - Feb 7, 2023] #448

Merged
merged 46 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
7c34847
Fix shared snapshot collision
ashwinstar Nov 29, 2021
472ee4c
Backport PARALLEL RETRIEVE CURSOR changes
adam8157 Mar 7, 2022
aa0396f
Fix regression about PREPARE TRANSACTION in utility-mode connections
jimmyyih Mar 3, 2022
1838af8
Add ORCA GUC to disable NLJ
dgkimura Mar 9, 2022
7794a41
Add GUC gp_log_endpoints to print endpoints information to server log
adam8157 Mar 16, 2022
4f5ab21
Refactor IC motion socket setup
divyeshddv Mar 31, 2022
77f6c38
Fix FTS prematurely failing primary over due to long reset period
huansong Mar 23, 2022
385b29d
recalculate QE's query_mem proportionally (#13160)
SmartKeyerror Apr 6, 2022
fd0075f
CdbComponentDatabaseInfo: add an active segdb list
jchampio Nov 22, 2018
43eb8bc
Add gp_backend_info() for runtime introspection/debugging
divyeshddv Apr 13, 2022
cf1cf5b
Use hostname instead of ip to compute the host_segments.
kainwen May 17, 2022
5589beb
Updated CPhysicalJoin to derive the inner distribution in the case of…
thedanhoffman May 17, 2022
0fb6285
Do not turn to singleQE for SegmentGeneral path refs outer Params.
kainwen May 23, 2022
0ed7e02
reject ambigous 5-digits date in non-standard YYYMMDD format
Tao-T May 16, 2022
835fae0
Handling exception to call mppExecutorCleanup in standard_ExecutorSta…
Aegeaner May 25, 2022
8d51113
Support both unicast and wildcard address binding
soumyadeep2007 Jun 2, 2022
3a0fdd1
Fix assertion failure in InitPostgres when resgroup is on (#13643)
dh-cloud Jun 14, 2022
053f28a
removed meaningless code line in resgroup_helper.c (#13731)
fairyfar Jun 27, 2022
c843603
Add an Orca GUC to control fallback for replicated table (#13763)
gpopt Jul 5, 2022
30f5944
Remove one line about replacement_sort_tuples (#13805)
yaowangm Jul 18, 2022
1dbda84
skip red-zone check if runaway_detector_activation_percent set to 0 o…
SmartKeyerror Jul 19, 2022
8b18dab
using postgres query optimizer instead of ORCA to run resgroup group …
SmartKeyerror Aug 24, 2022
9f4d862
[7X] Feat: Find the pids of overflowed subtransaction (#13992)
Aug 29, 2022
a8492e5
Add a GUC to control the output of suboverflow transaction sql statem…
Aug 31, 2022
d27898d
Put some locale related GUCs to sync guc array (#14068)
dreamedcheng Sep 13, 2022
31bf11e
Add a GUC to display create gang time while executing statements
zxuejing Nov 8, 2022
5e3dfdd
Order items in sync/unsync_guc_name.h
adam8157 Nov 22, 2022
89f6602
add postmaster and all auxiliary processes to a same cgroup (#14256)
SmartKeyerror Nov 2, 2022
5c457fb
Added a new view into gp_toolkit. (#13880)
fairyfar Nov 22, 2022
ef13201
fix resgroup views cases (#14511)
SmartKeyerror Nov 22, 2022
ee754fa
refactor the original cgroup code and abstract the corresponding inte…
SmartKeyerror Nov 30, 2022
9aae16b
NEW SYNTAX for resource group cpuset (#14332)
charliettxx Dec 1, 2022
4a06648
fix link problem in macOS and Windows (#14587)
SmartKeyerror Dec 5, 2022
482cf31
Fix resource group cpuset test case (#14601)
charliettxx Dec 5, 2022
51fba83
[7X] Fix multiple definition error when linking gpdb. (#14603)
higuoxing Dec 6, 2022
cecfa99
Simplify RG cpuset seperated by coordinator/segment (#14637)
charliettxx Dec 16, 2022
d11df4b
add new semantics on resource group and removing memory model. (#14562)
SmartKeyerror Dec 23, 2022
492a9d8
Initialize DLOG's oldestXmin up to the latestCompletedXid+1
huansong Dec 14, 2022
f27c52b
clean up useless test cases and GUCs (#14712)
SmartKeyerror Jan 6, 2023
ae7f5a8
Not grab distributed snapshot if it's direct dispatch (#13991)
SmartKeyerror Jan 10, 2023
47a80b7
Change some resource group variables type to int64 to avoid overflow.
airfan1994 Jan 10, 2023
c445a86
Fix resgroup init error when there is a lot of cores in cpuset.cpus.
airfan1994 Jan 11, 2023
a1c1dd7
Set sync/unsync flag for gucs (#13948)
Jan 12, 2023
50f2611
Partially revert of fixes for greenplum-db#13948 (#14772)
Jan 16, 2023
a2a4657
implement resource group memory limit control
yanwr1 Feb 7, 2023
fe58f69
Fix merge GPDB (resgroup related)
foreyes Jun 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion concourse/scripts/ic_gpdb_resgroup.bash
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ run_resgroup_test() {
scp /home/gpadmin/gpdb_src/src/test/regress/regress.so \
gpadmin@sdw1:/home/gpadmin/gpdb_src/src/test/regress/

make installcheck-resgroup || (
make PGOPTIONS="-c optimizer=off" installcheck-resgroup || (
errcode=\$?
find src/test/isolation2 -name regression.diffs \
| while read diff; do
Expand Down
29 changes: 12 additions & 17 deletions contrib/interconnect/tcp/ic_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,28 +140,23 @@ setupTCPListeningSocket(int backlog, int *listenerSocketFd, int32 *listenerPort)
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
hints.ai_socktype = SOCK_STREAM; /* Two-way, out of band connection */
hints.ai_flags = AI_PASSIVE; /* For wildcard IP address */
hints.ai_protocol = 0; /* Any protocol - TCP implied for network use
* due to SOCK_STREAM */

/*
* We set interconnect_address on the primary to the local address of the
* connection from QD to the primary, which is the primary's ADDRESS from
* gp_segment_configuration, used for interconnection. However it's wrong
* on the master. Because the connection from the client to the master may
* have different IP addresses as its destination, which is very likely
* not the master's ADDRESS in gp_segment_configuration.
*/
if (interconnect_address)
if (Gp_interconnect_address_type == INTERCONNECT_ADDRESS_TYPE_UNICAST)
{
/*
* Restrict what IP address we will listen on to just the one that was
* used to create this QE session.
*/
Assert(interconnect_address && strlen(interconnect_address) > 0);
hints.ai_flags |= AI_NUMERICHOST;
ereport(DEBUG1, (errmsg("binding to %s only", interconnect_address)));
if (gp_log_interconnect >= GPVARS_VERBOSITY_DEBUG)
ereport(DEBUG4, (errmsg("binding listener %s", interconnect_address)));
ereportif(gp_log_interconnect >= GPVARS_VERBOSITY_DEBUG, DEBUG3,
(errmsg("getaddrinfo called with unicast address: %s",
interconnect_address)));
}
else
{
Assert(interconnect_address == NULL);
hints.ai_flags |= AI_PASSIVE;
ereportif(gp_log_interconnect >= GPVARS_VERBOSITY_DEBUG, DEBUG3,
(errmsg("getaddrinfo called with wildcard address")));
}

s = getaddrinfo(interconnect_address, service, &hints, &addrs);
Expand Down
30 changes: 13 additions & 17 deletions contrib/interconnect/udp/ic_udpifc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,6 @@ setupUDPListeningSocket(int *listenerSocketFd, int32 *listenerPort, int *txFamil
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
hints.ai_socktype = SOCK_DGRAM; /* Datagram socket */
hints.ai_flags = AI_PASSIVE; /* For wildcard IP address */
hints.ai_protocol = 0; /* Any protocol - UDP implied for network use due to SOCK_DGRAM */

#ifdef USE_ASSERT_CHECKING
Expand All @@ -1202,25 +1201,22 @@ setupUDPListeningSocket(int *listenerSocketFd, int32 *listenerPort, int *txFamil
#endif

fun = "getaddrinfo";
/*
* We set interconnect_address on the primary to the local address of the connection from QD
* to the primary, which is the primary's ADDRESS from gp_segment_configuration,
* used for interconnection.
* However it's wrong on the master. Because the connection from the client to the master may
* have different IP addresses as its destination, which is very likely not the master's
* ADDRESS in gp_segment_configuration.
*/
if (interconnect_address)
if (Gp_interconnect_address_type == INTERCONNECT_ADDRESS_TYPE_UNICAST)
{
/*
* Restrict what IP address we will listen on to just the one that was
* used to create this QE session.
*/
Assert(interconnect_address && strlen(interconnect_address) > 0);
hints.ai_flags |= AI_NUMERICHOST;
ereport(DEBUG1, (errmsg("binding to %s only", interconnect_address)));
if (gp_log_interconnect >= GPVARS_VERBOSITY_DEBUG)
ereport(DEBUG4, (errmsg("binding address %s", interconnect_address)));
ereportif(gp_log_interconnect >= GPVARS_VERBOSITY_DEBUG, DEBUG3,
(errmsg("getaddrinfo called with unicast address: %s",
interconnect_address)));
}
else
{
Assert(interconnect_address == NULL);
hints.ai_flags |= AI_PASSIVE;
ereportif(gp_log_interconnect >= GPVARS_VERBOSITY_DEBUG, DEBUG3,
(errmsg("getaddrinfo called with wildcard address")));
}

s = getaddrinfo(interconnect_address, service, &hints, &addrs);
if (s != 0)
elog(ERROR, "getaddrinfo says %s", gai_strerror(s));
Expand Down
1 change: 1 addition & 0 deletions doc/src/sgml/ref/allfiles.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ Complete list of usable sgml source files in this directory.
<!ENTITY reindex SYSTEM "reindex.sgml">
<!ENTITY releaseSavepoint SYSTEM "release_savepoint.sgml">
<!ENTITY reset SYSTEM "reset.sgml">
<!ENTITY retrieve SYSTEM "retrieve.sgml">
<!ENTITY revoke SYSTEM "revoke.sgml">
<!ENTITY rollback SYSTEM "rollback.sgml">
<!ENTITY rollbackPrepared SYSTEM "rollback_prepared.sgml">
Expand Down
6 changes: 2 additions & 4 deletions doc/src/sgml/ref/alter_resource_group.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ PostgreSQL documentation
ALTER RESOURCE GROUP name SET group_attribute value
where group_attribute is one of:
CONCURRENCY integer
CPU_RATE_LIMIT integer
CPU_HARD_QUOTA_LIMIT integer
CPU_SOFT_PRIORITY integer
CPUSET tuple
MEMORY_LIMIT integer
MEMORY_SHARED_QUOTA integer
MEMORY_SPILL_RATIO integer

</synopsis>
</refsynopsisdiv>
Expand Down
7 changes: 2 additions & 5 deletions doc/src/sgml/ref/create_resource_group.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,9 @@ PostgreSQL documentation

CREATE RESOURCE GROUP name WITH (group_attribute=value [, ... ])
where group_attribute is:
CPU_RATE_LIMIT=integer | CPUSET=tuple
MEMORY_LIMIT=integer
CPU_HARD_QUOTA_LIMIT=integer | CPUSET=tuple
[ CONCURRENCY=integer ]
[ MEMORY_SHARED_QUOTA=integer ]
[ MEMORY_SPILL_RATIO=integer ]
[ MEMORY_AUDITOR= {vmtracker | cgroup} ]
[ CPU_SOFT_PRIORITY=integer ]

</synopsis>
</refsynopsisdiv>
Expand Down
28 changes: 26 additions & 2 deletions doc/src/sgml/ref/declare.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ PostgreSQL documentation

<refnamediv>
<refname>DECLARE</refname>
<refpurpose>define a cursor</refpurpose>
<refpurpose>define a cursor or a parallel retrieve cursor</refpurpose>
</refnamediv>

<refsynopsisdiv>
<synopsis>
DECLARE <replaceable class="parameter">name</replaceable> [ BINARY ] [ ASENSITIVE | INSENSITIVE ] [ [ NO ] SCROLL ]
CURSOR [ { WITH | WITHOUT } HOLD ] FOR <replaceable class="parameter">query</replaceable>
[ PARALLEL RETRIEVE ] CURSOR [ { WITH | WITHOUT } HOLD ] FOR <replaceable class="parameter">query</replaceable>
</synopsis>
</refsynopsisdiv>

Expand All @@ -42,6 +42,22 @@ DECLARE <replaceable class="parameter">name</replaceable> [ BINARY ] [ ASENSITIV
<link linkend="sql-fetch"><command>FETCH</command></link>.
</para>

<para>
Like a normal cursor, user can declare a parallel retrieve cursor on
coordinator, then retrieve the query results on each segment directly.
</para>

<para>
Parallel retrieve cursor has similar declaration and syntax as normal cursor
does. However, some cursor operations are not supported in parallel retrieve
cursor(e.g. MOVE).
</para>

<para>
NOTE: Orca doesn't support PARALLEL RETRIEVE CURSOR for now. It would fall
back to postgres optimizer automatically.
</para>

<note>
<para>
This page describes usage of cursors at the SQL command level.
Expand Down Expand Up @@ -113,6 +129,10 @@ DECLARE <replaceable class="parameter">name</replaceable> [ BINARY ] [ ASENSITIV
<literal>SCROLL</literal>. See <xref linkend="sql-declare-notes"/>
below for details.
</para>

<para>
PARALLEL RETRIEVE CURSOR with <literal>WITH SCROLL</literal> is not supported.
</para>
</listitem>
</varlistentry>

Expand All @@ -128,6 +148,10 @@ DECLARE <replaceable class="parameter">name</replaceable> [ BINARY ] [ ASENSITIV
<literal>WITH HOLD</literal> is specified, <literal>WITHOUT
HOLD</literal> is the default.
</para>

<para>
PARALLEL RETRIEVE CURSOR with <literal>WITH HOLD</literal> is not supported.
</para>
</listitem>
</varlistentry>

Expand Down
89 changes: 89 additions & 0 deletions doc/src/sgml/ref/retrieve.sgml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<!--
doc/src/sgml/ref/retrieve.sgml
PostgreSQL documentation
-->

<refentry id="sql-retrieve">
<indexterm zone="sql-retrieve">
<primary>RETRIEVE</primary>
</indexterm>

<refmeta>
<refentrytitle>RETRIEVE</refentrytitle>
<manvolnum>7</manvolnum>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>

<refnamediv>
<refname>RETRIEVE</refname>
<refpurpose>retrieve from endpoint</refpurpose>
</refnamediv>

<refsynopsisdiv>
<synopsis>
RETRIEVE { ALL | <replaceable class="parameter">count</replaceable> } FROM ENDPOINT <replaceable class="parameter">endpoint_name</replaceable>;

</synopsis>
</refsynopsisdiv>

<refsect1>
<title>Description</title>

<para>
<command>RETRIEVE</command> retrieves data from endpoint.
</para>

<para>
In each retrieve session, the query result on that segment can be
retrieved by using statement "RETRIEVE" and its corresponding endpoint
name.
</para>

<para>
An empty set will be returned if no more
tuples for the endpoint.
</para>
</refsect1>

<refsect1>
<title>Parameters</title>

<variablelist>
<varlistentry>
<term><replaceable class="parameter">count</replaceable></term>
<listitem>
<para>
a positive integer value needs to be provided as the "count" to
specify how many rows to retrieve.
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><literal>ALL</literal></term>
<listitem>
<para>
Parameter "ALL" means to retrieve all the results from the endpoint.
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><replaceable class="PARAMETER">endpoint_name</replaceable></term>
<listitem>
<para>
The endpoint to retrieve data from, endpoint names can be listed from function gp_get_endpoints().
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

<refsect1>
<title>See Also</title>

<simplelist type="inline">
<member><xref linkend="sql-declare"></member>
</simplelist>
</refsect1>
</refentry>
17 changes: 1 addition & 16 deletions gpMgmt/bin/gpcheckresgroupimpl
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ class cgroup(object):
if not self.compdirs:
self.die("failed to detect cgroup component dirs.")

# 'memory' on 5X is special, although dir 'memory/gpdb' is optional,
# dir 'memory' is mandatory to provide 'memory.limit_in_bytes'.
# in such a case we must always put 'memory' in compdirs on 5X.
if gpver.version < [6, 0, 0] and 'memory' not in self.compdirs:
self.compdirs['memory'] = ''

self.validate_permission("cpu", "gpdb/", "rwx")
self.validate_permission("cpu", "gpdb/cgroup.procs", "rw")
self.validate_permission("cpu", "gpdb/cpu.cfs_period_us", "rw")
Expand All @@ -61,16 +55,7 @@ class cgroup(object):
self.validate_permission("cpuacct", "gpdb/cpuacct.usage", "r")
self.validate_permission("cpuacct", "gpdb/cpuacct.stat", "r")

self.validate_permission("memory", "memory.limit_in_bytes", "r")

# resgroup memory auditor is introduced in 6.0 devel and backported
# to 5.x branch since 5.6.1. To provide backward compatibilities
# memory permissions are only checked since 6.0.
if gpver.version >= [6, 0, 0]:
self.validate_permission("memory", "gpdb/", "rwx")
self.validate_permission("memory", "gpdb/memory.limit_in_bytes", "rw")
self.validate_permission("memory", "gpdb/memory.usage_in_bytes", "r")

self.validate_permission("cpuset", "gpdb/", "rwx")
self.validate_permission("cpuset", "gpdb/cgroup.procs", "rw")
self.validate_permission("cpuset", "gpdb/cpuset.cpus", "rw")
Expand Down Expand Up @@ -178,7 +163,7 @@ class cgroup(object):
def required_comps(self):
comps = ['cpu', 'cpuacct']
if gpver.version >= [6, 0, 0]:
comps.extend(['cpuset', 'memory'])
comps.extend(['cpuset'])
return comps

def fallback_comp_dirs(self):
Expand Down
Loading
Loading