Skip to content

Commit

Permalink
fix test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
avamingli committed Jan 9, 2025
1 parent 2b79a1b commit 3419239
Show file tree
Hide file tree
Showing 15 changed files with 1,109 additions and 58 deletions.
2 changes: 1 addition & 1 deletion gpcontrib/gp_inject_fault/gp_inject_fault--1.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
\echo Use "CREATE EXTENSION gp_fault_inject" to load this file. \quit

-- NOTE: we let some background process ignore all but a few faults (check checkBgProcessSkipFault()).
CREATE FUNCTION @extschema@.gp_inject_fault(
CREATE FUNCTION gp_inject_fault(
faultname text,
type text,
ddl text,
Expand Down
18 changes: 9 additions & 9 deletions src/backend/access/appendonly/aosegfiles.c
Original file line number Diff line number Diff line change
Expand Up @@ -1527,25 +1527,25 @@ get_ao_compression_ratio(PG_FUNCTION_ARGS)
Relation parentrel;
float8 result = -1.0;

/* open the parent (main) relation */
parentrel = table_open(relid, AccessShareLock);

if (parentrel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
{
table_close(parentrel, AccessShareLock);
PG_RETURN_FLOAT8(result);
}

if (Gp_role == GP_ROLE_EXECUTE)
ereport(ERROR,
(errmsg("get_ao_compression_ratio is expected to run in QD process, or utility mode")));

/* open the parent (main) relation */
parentrel = table_open(relid, AccessShareLock);

if (!(RelationIsAoRows(parentrel) || RelationIsAoCols(parentrel)))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("'%s' is not an append-only relation",
RelationGetRelationName(parentrel))));

if (parentrel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
{
table_close(parentrel, AccessShareLock);
PG_RETURN_FLOAT8(result);
}

if (RelationIsAoRows(parentrel))
result = aorow_compression_ratio_internal(parentrel);
else
Expand Down
6 changes: 3 additions & 3 deletions src/backend/access/transam/xlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -13890,15 +13890,15 @@ initialize_wal_bytes_written(void)
* WAL generation and move at sustained speed with network and mirrors.
*
* NB: This function should never be called from inside a critical section,
* meaning caller should never have MyPgXact->delayChkpt set to true. Otherwise,
* meaning caller should never have MyProc->delayChkpt set to true. Otherwise,
* if mirror is down, we will end up in a deadlock situation between the primary
* and the checkpointer process, because if MyPgXact->delayChkpt is set,
* and the checkpointer process, because if MyProc->delayChkpt is set,
* checkpointer cannot proceed to unset WalSndCtl->sync_standbys_defined.
*/
void
wait_to_avoid_large_repl_lag(void)
{
Assert(!MyPgXact->delayChkpt);
Assert(!MyProc->delayChkpt);
/* rep_lag_avoidance_threshold is defined in KB */
if (rep_lag_avoidance_threshold &&
wal_bytes_written > (rep_lag_avoidance_threshold * 1024))
Expand Down
10 changes: 3 additions & 7 deletions src/backend/commands/explain.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,9 @@ ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into, ExplainState *es,
/* run the plan */
ExecutorRun(queryDesc, dir, 0L, true);

/* run cleanup too */
ExecutorFinish(queryDesc);

/* Wait for completion of all qExec processes. */
if (queryDesc->estate->dispatcherState && queryDesc->estate->dispatcherState->primaryResults)
{
Expand All @@ -742,13 +745,6 @@ ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into, ExplainState *es,
}
}

/* run cleanup too */
ExecutorFinish(queryDesc);

/* Wait for completion of all qExec processes. */
if (queryDesc->estate->dispatcherState && queryDesc->estate->dispatcherState->primaryResults)
cdbdisp_checkDispatchResult(queryDesc->estate->dispatcherState, DISPATCH_WAIT_NONE);

/* We can't run ExecutorEnd 'till we're done printing the stats... */
totaltime += elapsed_time(&starttime);
}
Expand Down
6 changes: 3 additions & 3 deletions src/include/cdb/cdbtm.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,9 @@ extern volatile int *shmNumCommittedGxacts;

extern bool IsDtxRecoveryProcess(void);

extern char *DtxStateToString(DtxState state);
extern char *DtxProtocolCommandToString(DtxProtocolCommand command);
extern char *DtxContextToString(DtxContext context);
extern const char *DtxStateToString(DtxState state);
extern const char *DtxProtocolCommandToString(DtxProtocolCommand command);
extern const char *DtxContextToString(DtxContext context);
extern void dtxDeformGid(const char *gid,
DistributedTransactionId *distribXid);
extern void dtxFormGid(char *gid, DistributedTransactionId gxid);
Expand Down
11 changes: 6 additions & 5 deletions src/test/regress/expected/AOCO_Compression.out
Original file line number Diff line number Diff line change
Expand Up @@ -3680,14 +3680,15 @@ SELECT * FROM pg_compression WHERE compname='rle_type';
DROP type if exists mood_encoded cascade;
CREATE TYPE mood_encoded AS ENUM ('sad', 'ok', 'happy');
ALTER TYPE public.mood_encoded SET DEFAULT ENCODING (compresstype=zlib, blocksize=65536, compresslevel=4);
ERROR: mood_encoded is not a base type
SELECT t.typname, te.typoptions
FROM pg_type t
LEFT JOIN pg_type_encoding te ON (t.oid=te.typid)
WHERE t.typname in ('mood_encoded', '_mood_encoded');
typname | typoptions
---------------+-----------------------------------------------------
_mood_encoded | {compresstype=zlib,blocksize=65536,compresslevel=4}
mood_encoded | {compresstype=zlib,blocksize=65536,compresslevel=4}
typname | typoptions
---------------+------------
mood_encoded |
_mood_encoded |
(2 rows)

-- get_ao_compression_ratio when the relation is a partitioned table with ao table children.
Expand All @@ -3703,7 +3704,7 @@ PARTITION BY RANGE (sales_date)
);
SELECT get_ao_compression_ratio('public.partitioned_table_14876');
get_ao_compression_ratio
------------
--------------------------
-1
(1 row)

Expand Down
14 changes: 9 additions & 5 deletions src/test/regress/expected/aggregates_optimizer.out
Original file line number Diff line number Diff line change
Expand Up @@ -2827,13 +2827,15 @@ INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: GPDB Expression type: Query Parameter not supported in DXL
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: GPDB Expression type: Query Parameter not supported in DXL
NOTICE: avg_transfn called with 1
NOTICE: avg_transfn called with 3
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: GPDB Expression type: Query Parameter not supported in DXL
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: GPDB Expression type: Query Parameter not supported in DXL
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: GPDB Expression type: Query Parameter not supported in DXL
NOTICE: avg_transfn called with 3
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: GPDB Expression type: Query Parameter not supported in DXL
INFO: GPORCA failed to produce a plan, falling back to planner
Expand Down Expand Up @@ -2866,6 +2868,8 @@ INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: GPDB Expression type: Query Parameter not supported in DXL
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: GPDB Expression type: Query Parameter not supported in DXL
NOTICE: avg_transfn called with 1
NOTICE: avg_transfn called with 3
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: GPDB Expression type: Query Parameter not supported in DXL
INFO: GPORCA failed to produce a plan, falling back to planner
Expand Down Expand Up @@ -2928,13 +2932,13 @@ DETAIL: GPDB Expression type: Query Parameter not supported in DXL
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: GPDB Expression type: Query Parameter not supported in DXL
NOTICE: avg_transfn called with 3
NOTICE: avg_transfn called with 3
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: GPDB Expression type: Query Parameter not supported in DXL
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: GPDB Expression type: Query Parameter not supported in DXL
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: GPDB Expression type: Query Parameter not supported in DXL
NOTICE: avg_transfn called with 3
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: GPDB Expression type: Query Parameter not supported in DXL
INFO: GPORCA failed to produce a plan, falling back to planner
Expand All @@ -2953,22 +2957,22 @@ discard plans;
select my_avg(one),my_sum(two) from (values(1,2),(3,4)) t(one,two);
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: GPDB Expression type: Query Parameter not supported in DXL
NOTICE: avg_transfn called with 2
NOTICE: avg_transfn called with 1
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: GPDB Expression type: Query Parameter not supported in DXL
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: GPDB Expression type: Query Parameter not supported in DXL
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: GPDB Expression type: Query Parameter not supported in DXL
NOTICE: avg_transfn called with 1
NOTICE: avg_transfn called with 4
NOTICE: avg_transfn called with 2
NOTICE: avg_transfn called with 3
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: GPDB Expression type: Query Parameter not supported in DXL
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: GPDB Expression type: Query Parameter not supported in DXL
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: GPDB Expression type: Query Parameter not supported in DXL
NOTICE: avg_transfn called with 3
NOTICE: avg_transfn called with 4
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: GPDB Expression type: Query Parameter not supported in DXL
INFO: GPORCA failed to produce a plan, falling back to planner
Expand Down
Loading

0 comments on commit 3419239

Please sign in to comment.