Skip to content

Commit f1d72f8

Browse files
authored
Merge branch 'main' into cherry_pick_hot_standby
2 parents 6a68bfb + 615f6ec commit f1d72f8

File tree

11 files changed

+44
-146
lines changed

11 files changed

+44
-146
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
blank_issues_enabled: false
1+
blank_issues_enabled: true
22
contact_links:
33
- name: 🙏🏻 Q&A
44
url: https://github.com/apache/cloudberry/discussions/categories/q-a

configure

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.69 for Apache Cloudberry 2.0.0-devel.
3+
# Generated by GNU Autoconf 2.69 for Apache Cloudberry 2.1.0-devel.
44
#
55
# Report bugs to <dev@cloudberry.apache.org>.
66
#
@@ -582,8 +582,8 @@ MAKEFLAGS=
582582
# Identity of this package.
583583
PACKAGE_NAME='Apache Cloudberry'
584584
PACKAGE_TARNAME='apache-cloudberry'
585-
PACKAGE_VERSION='2.0.0-devel'
586-
PACKAGE_STRING='Apache Cloudberry 2.0.0-devel'
585+
PACKAGE_VERSION='2.1.0-devel'
586+
PACKAGE_STRING='Apache Cloudberry 2.1.0-devel'
587587
PACKAGE_BUGREPORT='dev@cloudberry.apache.org'
588588
PACKAGE_URL='https://cloudberry.apache.org/'
589589

@@ -1513,7 +1513,7 @@ if test "$ac_init_help" = "long"; then
15131513
# Omit some internal or obsolete options to make the list less imposing.
15141514
# This message is too long to be a string in the A/UX 3.1 sh.
15151515
cat <<_ACEOF
1516-
\`configure' configures Apache Cloudberry 2.0.0-devel to adapt to many kinds of systems.
1516+
\`configure' configures Apache Cloudberry 2.1.0-devel to adapt to many kinds of systems.
15171517

15181518
Usage: $0 [OPTION]... [VAR=VALUE]...
15191519

@@ -1579,7 +1579,7 @@ fi
15791579

15801580
if test -n "$ac_init_help"; then
15811581
case $ac_init_help in
1582-
short | recursive ) echo "Configuration of Apache Cloudberry 2.0.0-devel:";;
1582+
short | recursive ) echo "Configuration of Apache Cloudberry 2.1.0-devel:";;
15831583
esac
15841584
cat <<\_ACEOF
15851585

@@ -1782,7 +1782,7 @@ fi
17821782
test -n "$ac_init_help" && exit $ac_status
17831783
if $ac_init_version; then
17841784
cat <<\_ACEOF
1785-
Apache Cloudberry configure 2.0.0-devel
1785+
Apache Cloudberry configure 2.1.0-devel
17861786
generated by GNU Autoconf 2.69
17871787

17881788
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2535,7 +2535,7 @@ cat >config.log <<_ACEOF
25352535
This file contains any messages produced by compilers while
25362536
running configure, to aid debugging if configure makes a mistake.
25372537

2538-
It was created by Apache Cloudberry $as_me 2.0.0-devel, which was
2538+
It was created by Apache Cloudberry $as_me 2.1.0-devel, which was
25392539
generated by GNU Autoconf 2.69. Invocation command line was
25402540

25412541
$ $0 $@
@@ -23334,7 +23334,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
2333423334
# report actual input values of CONFIG_FILES etc. instead of their
2333523335
# values after options handling.
2333623336
ac_log="
23337-
This file was extended by Apache Cloudberry $as_me 2.0.0-devel, which was
23337+
This file was extended by Apache Cloudberry $as_me 2.1.0-devel, which was
2333823338
generated by GNU Autoconf 2.69. Invocation command line was
2333923339

2334023340
CONFIG_FILES = $CONFIG_FILES
@@ -23405,7 +23405,7 @@ _ACEOF
2340523405
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
2340623406
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
2340723407
ac_cs_version="\\
23408-
Apache Cloudberry config.status 2.0.0-devel
23408+
Apache Cloudberry config.status 2.1.0-devel
2340923409
configured by $0, generated by GNU Autoconf 2.69,
2341023410
with options \\"\$ac_cs_config\\"
2341123411

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ m4_pattern_forbid(^PGAC_)dnl to catch undefined macros
2020
dnl The PACKAGE_VERSION from upstream PostgreSQL is maintained in the
2121
dnl PG_PACKAGE_VERSION variable, when merging make sure to update this
2222
dnl variable with the merge conflict from the AC_INIT() statement.
23-
AC_INIT([Apache Cloudberry], [2.0.0-devel], [dev@cloudberry.apache.org], [], [https://cloudberry.apache.org/])
23+
AC_INIT([Apache Cloudberry], [2.1.0-devel], [dev@cloudberry.apache.org], [], [https://cloudberry.apache.org/])
2424
[PG_PACKAGE_VERSION=14.4]
2525
AC_SUBST(PG_PACKAGE_VERSION)
2626

getversion

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,13 @@
3535
# e.g., VERSION = 2.0.1-devel+dev.3.gabcd123
3636
#
3737
# 3. If *not* in a Git repo but a `VERSION` file exists:
38-
# VERSION and BUILDNUMBER are read from that file (format: "<version> build <build_number>")
38+
#
39+
# a. If the file contains a line like "<version> build <build_number>", both values are extracted.
40+
#
41+
# b. Otherwise, the VERSION is read from the file and the BUILDNUMBER is taken from BUILD_NUMBER if it exists.
42+
#
43+
# (This is the case for Apache Cloudberry packaging builds, where these files are created by the
44+
# release script and may also be leveraged by downstream users.)
3945
#
4046
# 4. If neither a Git repo nor a VERSION file is present:
4147
# VERSION = <PACKAGE_VERSION> from configure
@@ -101,8 +107,16 @@ if type git >/dev/null 2>&1 && [ -d '.git' ]; then
101107
fi
102108
# Not a git repo but VERSION file exists
103109
elif [[ -s ./VERSION ]]; then
104-
VERSION=$(awk -F' build ' '{print $1}' ./VERSION)
105-
BUILDNUMBER=$(awk -F' build ' '{print $2}' ./VERSION)
110+
# Support both legacy "<version> build <build_number>" and newer single-version formats
111+
if grep -q ' build ' ./VERSION; then
112+
VERSION=$(awk -F' build ' '{print $1}' ./VERSION)
113+
BUILDNUMBER=$(awk -F' build ' '{print $2}' ./VERSION)
114+
else
115+
VERSION=$(<./VERSION)
116+
if [[ -f ./BUILD_NUMBER ]]; then
117+
BUILDNUMBER=$(<./BUILD_NUMBER)
118+
fi
119+
fi
106120
fi
107121

108122
# Handle optional flag

src/backend/catalog/gp_matview_aux.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
#include "catalog/pg_type.h"
4242
#include "catalog/indexing.h"
4343
#include "cdb/cdbvars.h"
44-
#include "commands/matview.h"
4544
#include "utils/array.h"
4645
#include "utils/builtins.h"
4746
#include "utils/rel.h"
@@ -168,7 +167,6 @@ InsertMatviewAuxEntry(Oid mvoid, const Query *viewQuery, bool skipdata)
168167
List *relids;
169168
NameData mvname;
170169
bool has_foreign = false;
171-
Relation matviewRel;
172170
char *viewsql;
173171

174172
Assert(OidIsValid(mvoid));
@@ -190,9 +188,7 @@ InsertMatviewAuxEntry(Oid mvoid, const Query *viewQuery, bool skipdata)
190188

191189
values[Anum_gp_matview_aux_has_foreign - 1] = BoolGetDatum(has_foreign);
192190

193-
matviewRel = table_open(mvoid, NoLock);
194-
viewsql = nodeToString((Node *) copyObject(get_matview_query(matviewRel)));
195-
table_close(matviewRel, NoLock);
191+
viewsql = nodeToString((Node *) copyObject(viewQuery));
196192
values[Anum_gp_matview_aux_view_query - 1] = CStringGetTextDatum(viewsql);
197193

198194
if (skipdata)

src/backend/optimizer/plan/aqumv.c

Lines changed: 0 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,7 @@
5757
#include "nodes/pathnodes.h"
5858
#include "nodes/pg_list.h"
5959

60-
typedef struct
61-
{
62-
int varno;
63-
} aqumv_adjust_varno_context;
64-
65-
extern void aqumv_adjust_simple_query(Query *viewQuery);
6660
static bool aqumv_process_from_quals(Node *query_quals, Node *mv_quals, List** post_quals);
67-
static void aqumv_adjust_varno(Query *parse, int delta);
68-
static Node *aqumv_adjust_varno_mutator(Node *node, aqumv_adjust_varno_context *context);
6961

7062
typedef struct
7163
{
@@ -361,9 +353,6 @@ answer_query_using_materialized_views(PlannerInfo *root, AqumvContext aqumv_cont
361353
subroot->tuple_fraction = root->tuple_fraction;
362354
subroot->limit_tuples = root->limit_tuples;
363355

364-
/* Adjust to valid query tree and fix varno after rewrite.*/
365-
aqumv_adjust_simple_query(viewQuery);
366-
367356
/*
368357
* AQUMV_FIXME_MVP
369358
* Are stable functions OK?
@@ -886,111 +875,6 @@ aqumv_process_targetlist(aqumv_equivalent_transformation_context *context, List
886875
return !context->has_unmatched;
887876
}
888877

889-
void aqumv_adjust_simple_query(Query *viewQuery)
890-
{
891-
ListCell *lc;
892-
/*
893-
* AQUMV
894-
* We have to rewrite now before we do the real Equivalent
895-
* Transformation 'rewrite'.
896-
* Because actions stored in rule is not a normal query tree,
897-
* it can't be used directly, with exception to new/old relations used to
898-
* refresh mv.
899-
* Erase unused relations, keep the right one.
900-
*/
901-
foreach (lc, viewQuery->rtable)
902-
{
903-
RangeTblEntry *rtetmp = lfirst(lc);
904-
if ((rtetmp->relkind == RELKIND_MATVIEW) &&
905-
(rtetmp->alias != NULL) &&
906-
(strcmp(rtetmp->alias->aliasname, "new") == 0 ||
907-
strcmp(rtetmp->alias->aliasname, "old") == 0))
908-
{
909-
foreach_delete_current(viewQuery->rtable, lc);
910-
}
911-
}
912-
913-
/*
914-
* Now we have the right relation, adjust
915-
* varnos in its query tree.
916-
* AQUMV_FIXME_MVP: Only one single relation
917-
* is supported now, we could assign varno
918-
* to 1 opportunistically.
919-
*/
920-
aqumv_adjust_varno(viewQuery, 1);
921-
}
922-
923-
/*
924-
* Process varno after we eliminate mv's actions("old" and "new" relation)
925-
* Correct rindex and all varnos with a delta.
926-
*
927-
* MV's actions query tree:
928-
* [rtable]
929-
* RangeTblEntry [rtekind=RTE_RELATION]
930-
* [alias] Alias [aliasname="old"]
931-
* RangeTblEntry [rtekind=RTE_RELATION]
932-
* [alias] Alias [aliasname="new"]
933-
* RangeTblEntry [rtekind=RTE_RELATION]
934-
* [jointree]
935-
* FromExpr []
936-
* [fromlist]
937-
* RangeTblRef [rtindex=3]
938-
* [targetList]
939-
* TargetEntry [resno=1 resname="c1"]
940-
* Var [varno=3 varattno=1]
941-
* TargetEntry [resno=2 resname="c2"]
942-
* Var [varno=3 varattno=2]
943-
*------------------------------------------------------------------------------------------
944-
* MV's query tree after rewrite:
945-
* [rtable]
946-
* RangeTblEntry [rtekind=RTE_RELATION]
947-
* [jointree]
948-
* FromExpr []
949-
* [fromlist]
950-
* RangeTblRef [rtindex=3]
951-
* [targetList]
952-
* TargetEntry [resno=1 resname="c1"]
953-
* Var [varno=3 varattno=1]
954-
* TargetEntry [resno=2 resname="c2"]
955-
* Var [varno=3 varattno=2]
956-
*------------------------------------------------------------------------------------------
957-
* MV's query tree after varno adjust:
958-
* [rtable]
959-
* RangeTblEntry [rtekind=RTE_RELATION]
960-
* [jointree]
961-
* FromExpr []
962-
* [fromlist]
963-
* RangeTblRef [rtindex=1]
964-
* [targetList]
965-
* TargetEntry [resno=1 resname="c1"]
966-
* Var [varno=1 varattno=1]
967-
* TargetEntry [resno=2 resname="c2"]
968-
* Var [varno=1 varattno=2]
969-
*
970-
*/
971-
static void
972-
aqumv_adjust_varno(Query* parse, int varno)
973-
{
974-
aqumv_adjust_varno_context context;
975-
context.varno = varno;
976-
parse = query_tree_mutator(parse, aqumv_adjust_varno_mutator, &context, QTW_DONT_COPY_QUERY);
977-
}
978-
979-
static Node *aqumv_adjust_varno_mutator(Node *node, aqumv_adjust_varno_context *context)
980-
{
981-
if (node == NULL)
982-
return NULL;
983-
if (IsA(node, Var))
984-
{
985-
((Var *)node)->varno = context->varno;
986-
((Var *)node)->varnosyn = context->varno; /* Keep syntactic with varno. */
987-
}
988-
else if (IsA(node, RangeTblRef))
989-
/* AQUMV_FIXME_MVP: currently we have only one relation */
990-
((RangeTblRef*) node)->rtindex = context->varno;
991-
return expression_tree_mutator(node, aqumv_adjust_varno_mutator, context);
992-
}
993-
994878
/*
995879
* check_partition - Check if the query's range table entries align with the partitioned table structure.
996880
*

src/bin/pg_upgrade/util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ check_ok(void)
273273
* respected.
274274
*/
275275
void
276-
gp_fatal_log(const char *fmt,...) __attribute__ ((format (gnu_printf, 1, 2)));
276+
gp_fatal_log(const char *fmt,...) pg_attribute_printf(1, 2);
277277

278278
void
279279
gp_fatal_log(const char *fmt,...)

src/include/optimizer/aqumv.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,4 @@ typedef AqumvContextData *AqumvContext;
4545

4646
extern RelOptInfo* answer_query_using_materialized_views(PlannerInfo *root, AqumvContextData *aqumv_context);
4747

48-
/*
49-
* Adjust parse tree storaged in view's actions.
50-
* Query should be a simple query, ex:
51-
* select from a single table.
52-
*/
53-
extern void aqumv_adjust_simple_query(Query *viewQuery);
54-
5548
#endif /* AQUMV_H */

src/test/regress/expected/gp_explain.out

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,10 @@ DROP USER regress_range_parted_user;
577577
-- Test if explain analyze will hang with materialize node
578578
CREATE TABLE recursive_table_ic (a INT) DISTRIBUTED BY (a);
579579
INSERT INTO recursive_table_ic SELECT * FROM generate_series(20, 30000);
580+
-- start_matchsubs
581+
-- m/Seq Scan on recursive_table_ic \(actual rows=\d+ loops=1\)/
582+
-- s/Seq Scan on recursive_table_ic \(actual rows=\d+ loops=1\)/Seq Scan on recursive_table_ic (actual rows=#### loops=1)/
583+
-- end_matchsubs
580584
explain (analyze, costs off, timing off, summary off) WITH RECURSIVE
581585
r(i) AS (
582586
SELECT 1
@@ -600,7 +604,7 @@ SELECT * FROM y LIMIT 10;
600604
-> WorkTable Scan on y (never executed)
601605
-> Materialize (never executed)
602606
-> Gather Motion 3:1 (slice1; segments: 3) (never executed)
603-
-> Seq Scan on recursive_table_ic (actual rows=4061 loops=1)
607+
-> Seq Scan on recursive_table_ic (actual rows=#### loops=1)
604608
Optimizer: Postgres query optimizer
605609
(13 rows)
606610

src/test/regress/expected/gp_explain_optimizer.out

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,10 @@ DROP USER regress_range_parted_user;
599599
-- Test if explain analyze will hang with materialize node
600600
CREATE TABLE recursive_table_ic (a INT) DISTRIBUTED BY (a);
601601
INSERT INTO recursive_table_ic SELECT * FROM generate_series(20, 30000);
602+
-- start_matchsubs
603+
-- m/Seq Scan on recursive_table_ic \(actual rows=\d+ loops=1\)/
604+
-- s/Seq Scan on recursive_table_ic \(actual rows=\d+ loops=1\)/Seq Scan on recursive_table_ic (actual rows=#### loops=1)/
605+
-- end_matchsubs
602606
explain (analyze, costs off, timing off, summary off) WITH RECURSIVE
603607
r(i) AS (
604608
SELECT 1
@@ -622,7 +626,7 @@ SELECT * FROM y LIMIT 10;
622626
-> WorkTable Scan on y (never executed)
623627
-> Materialize (never executed)
624628
-> Gather Motion 3:1 (slice1; segments: 3) (never executed)
625-
-> Seq Scan on recursive_table_ic (actual rows=4061 loops=1)
629+
-> Seq Scan on recursive_table_ic (actual rows=#### loops=1)
626630
Optimizer: Postgres query optimizer
627631
(13 rows)
628632

0 commit comments

Comments
 (0)