Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions .github/workflows/build-cloudberry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,12 @@ jobs:
},
{"test":"ic-cbdb-parallel",
"make_configs":["src/test/regress:installcheck-cbdb-parallel"]
},
{"test":"ic-orca-parallel",
"make_configs":["src/test/regress:installcheck-orca-parallel"],
"pg_settings":{
"optimizer_enable_parallel_append":"true"
}
Comment on lines +330 to +334
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be better to add the same test to the build-deb-cloudberry.yml workflow.

}
]
}'
Expand Down
6 changes: 6 additions & 0 deletions src/backend/gpopt/config/CConfigParamMapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ CConfigParamMapping::SConfigMappingElem CConfigParamMapping::m_elements[] = {
GPOS_WSZ_LIT(
"Enable Eager Agg transform for pushing aggregate below an innerjoin.")},

{EopttraceEnableParallelAppendScan, &optimizer_enable_parallel_append,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make optimizer_enable_parallel_append default to true ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use false better, otherwise we should change other ci pipeline config values.

false, // m_negate_param
GPOS_WSZ_LIT("Enable parallel append for scan/bitmap/index scan in partition tables.")},

{EopttraceDisableOrderedAgg, &optimizer_enable_orderedagg,
true, // m_negate_param
GPOS_WSZ_LIT("Disable ordered aggregate plans.")},
Expand Down Expand Up @@ -449,6 +453,8 @@ CConfigParamMapping::PackConfigParamInBitset(
// disable table scan if the corresponding GUC is turned off
traceflag_bitset->ExchangeSet(
GPOPT_DISABLE_XFORM_TF(CXform::ExfGet2TableScan));
traceflag_bitset->ExchangeSet(
GPOPT_DISABLE_XFORM_TF(CXform::ExfGet2ParallelTableScan));
}

if (!optimizer_enable_push_join_below_union_all)
Expand Down
52 changes: 52 additions & 0 deletions src/backend/gpopt/gpdbwrappers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include <limits> // std::numeric_limits

#include "gpos/base.h"
#include "gpopt/base/COptCtxt.h"
#include "gpopt/optimizer/COptimizerConfig.h"
#include "gpos/error/CAutoExceptionStack.h"
#include "gpos/error/CException.h"

Expand All @@ -36,8 +38,10 @@ extern "C" {
#include "access/amapi.h"
#include "access/external.h"
#include "access/genam.h"
#include "access/parallel.h"
#include "catalog/pg_aggregate.h"
#include "catalog/pg_inherits.h"
#include "cdb/cdbvars.h"
#include "foreign/fdwapi.h"
#include "nodes/nodeFuncs.h"
#include "optimizer/clauses.h"
Expand All @@ -52,6 +56,9 @@ extern "C" {
#include "utils/lsyscache.h"
#include "utils/memutils.h"
#include "utils/partcache.h"

extern bool enable_parallel;
extern int max_parallel_workers_per_gather;
}
#define GP_WRAP_START \
sigjmp_buf local_sigjmp_buf; \
Expand Down Expand Up @@ -2548,6 +2555,19 @@ gpdb::GetForeignServerId(Oid reloid)
return 0;
}

int16
gpdb::GetAppendOnlySegmentFilesCount(Relation rel)
{
GP_WRAP_START;
{
FormData_pg_appendonly aoFormData;
GetAppendOnlyEntry(rel, &aoFormData);
return aoFormData.segfilecount;
}
GP_WRAP_END;
return -1;
}

// Locks on partition leafs and indexes are held during optimizer (after
// parse-analyze stage). ORCA need this function to lock relation. Here
// we do not need to consider lock-upgrade issue, reasons are:
Expand Down Expand Up @@ -2706,4 +2726,36 @@ gpdb::TestexprIsHashable(Node *testexpr, List *param_ids)
return false;
}

// check if parallel mode is OK (comprehensive check)
bool
gpdb::IsParallelModeOK(void)
{
GP_WRAP_START;
{
if (!enable_parallel)
return false;

if (IS_SINGLENODE())
return false;

if (max_parallel_workers_per_gather <= 0)
return false;

// Check if parallel plans are enabled in current optimizer context
gpopt::COptCtxt *poctxt = gpopt::COptCtxt::PoctxtFromTLS();
if (nullptr != poctxt)
{
gpopt::COptimizerConfig *optimizer_config = poctxt->GetOptimizerConfig();
if (nullptr != optimizer_config)
{
if (!optimizer_config->CreateParallelPlan())
return false;
}
}
return true;
}
GP_WRAP_END;
return false; // default to disabled if no context
}

// EOF
Loading
Loading