Skip to content

Commit

Permalink
Merge branch 'adb-7.2.0' into ADBDEV-6509
Browse files Browse the repository at this point in the history
  • Loading branch information
dkovalev1 authored Oct 30, 2024
2 parents 0995e84 + 69f5f03 commit 5a70a36
Show file tree
Hide file tree
Showing 125 changed files with 2,515 additions and 474 deletions.
1 change: 1 addition & 0 deletions .abi-check/7.2.0_arenadata5/postgres.types.ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
struct QueryDesc
2 changes: 1 addition & 1 deletion contrib/btree_gin/btree_gin.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ gin_btree_extract_query(FunctionCallInfo fcinfo,
case BTGreaterEqualStrategyNumber:
case BTGreaterStrategyNumber:
*ptr_partialmatch = true;
/* FALLTHROUGH */
fallthru;
case BTEqualStrategyNumber:
entries[0] = datum;
break;
Expand Down
1 change: 1 addition & 0 deletions contrib/isn/isn.c
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,7 @@ string2ean(const char *str, bool errorOK, ean13 *result,
case UPC:
buf[2] = '0';
valid = (valid && ((rcheck = checkdig(buf + 2, 13)) == check || magic));
fallthru;
default:
break;
}
Expand Down
12 changes: 6 additions & 6 deletions contrib/pg_trgm/trgm_gin.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ gin_extract_query_trgm(PG_FUNCTION_ARGS)
#ifndef IGNORECASE
elog(ERROR, "cannot handle ~~* with case-sensitive trigrams");
#endif
/* FALL THRU */
fallthru;
case LikeStrategyNumber:

/*
Expand All @@ -111,7 +111,7 @@ gin_extract_query_trgm(PG_FUNCTION_ARGS)
#ifndef IGNORECASE
elog(ERROR, "cannot handle ~* with case-sensitive trigrams");
#endif
/* FALL THRU */
fallthru;
case RegExpStrategyNumber:
trg = createTrgmNFA(val, PG_GET_COLLATION(),
&graph, CurrentMemoryContext);
Expand Down Expand Up @@ -221,7 +221,7 @@ gin_trgm_consistent(PG_FUNCTION_ARGS)
#ifndef IGNORECASE
elog(ERROR, "cannot handle ~~* with case-sensitive trigrams");
#endif
/* FALL THRU */
fallthru;
case LikeStrategyNumber:
/* Check if all extracted trigrams are presented. */
res = true;
Expand All @@ -238,7 +238,7 @@ gin_trgm_consistent(PG_FUNCTION_ARGS)
#ifndef IGNORECASE
elog(ERROR, "cannot handle ~* with case-sensitive trigrams");
#endif
/* FALL THRU */
fallthru;
case RegExpStrategyNumber:
if (nkeys < 1)
{
Expand Down Expand Up @@ -306,7 +306,7 @@ gin_trgm_triconsistent(PG_FUNCTION_ARGS)
#ifndef IGNORECASE
elog(ERROR, "cannot handle ~~* with case-sensitive trigrams");
#endif
/* FALL THRU */
fallthru;
case LikeStrategyNumber:
/* Check if all extracted trigrams are presented. */
res = GIN_MAYBE;
Expand All @@ -323,7 +323,7 @@ gin_trgm_triconsistent(PG_FUNCTION_ARGS)
#ifndef IGNORECASE
elog(ERROR, "cannot handle ~* with case-sensitive trigrams");
#endif
/* FALL THRU */
fallthru;
case RegExpStrategyNumber:
if (nkeys < 1)
{
Expand Down
8 changes: 4 additions & 4 deletions contrib/pg_trgm/trgm_gist.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ gtrgm_consistent(PG_FUNCTION_ARGS)
#ifndef IGNORECASE
elog(ERROR, "cannot handle ~~* with case-sensitive trigrams");
#endif
/* FALL THRU */
fallthru;
case LikeStrategyNumber:
qtrg = generate_wildcard_trgm(VARDATA(query),
querysize - VARHDRSZ);
Expand All @@ -219,7 +219,7 @@ gtrgm_consistent(PG_FUNCTION_ARGS)
#ifndef IGNORECASE
elog(ERROR, "cannot handle ~* with case-sensitive trigrams");
#endif
/* FALL THRU */
fallthru;
case RegExpStrategyNumber:
qtrg = createTrgmNFA(query, PG_GET_COLLATION(),
&graph, fcinfo->flinfo->fn_mcxt);
Expand Down Expand Up @@ -307,7 +307,7 @@ gtrgm_consistent(PG_FUNCTION_ARGS)
#ifndef IGNORECASE
elog(ERROR, "cannot handle ~~* with case-sensitive trigrams");
#endif
/* FALL THRU */
fallthru;
case LikeStrategyNumber:
/* Wildcard search is inexact */
*recheck = true;
Expand Down Expand Up @@ -348,7 +348,7 @@ gtrgm_consistent(PG_FUNCTION_ARGS)
#ifndef IGNORECASE
elog(ERROR, "cannot handle ~* with case-sensitive trigrams");
#endif
/* FALL THRU */
fallthru;
case RegExpStrategyNumber:
/* Regexp search is inexact */
*recheck = true;
Expand Down
3 changes: 2 additions & 1 deletion contrib/pgcrypto/imath.c
Original file line number Diff line number Diff line change
Expand Up @@ -1978,7 +1978,8 @@ mp_int_read_cstring(mp_int z, mp_size radix, const char *str,
++str;
break;
case '+':
++str; /* fallthrough */
++str;
fallthru;
default:
z->sign = MP_ZPOS;
break;
Expand Down
2 changes: 1 addition & 1 deletion contrib/pgcrypto/pgp-info.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ pgp_get_keyid(MBuf *pgp_data, char *dst)
break;
case PGP_PKT_SYMENCRYPTED_SESSKEY:
got_symenc_key++;
/* fallthru */
fallthru;
case PGP_PKT_SIGNATURE:
case PGP_PKT_MARKER:
case PGP_PKT_TRUST:
Expand Down
4 changes: 0 additions & 4 deletions contrib/postgres_fdw/deparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -3101,13 +3101,10 @@ deparsePartialAggFunctionParamFilter(Aggref *node, deparse_expr_cxt *context,
{
case 2100:
/* int8 AVG */
/* Fall through */
case 2101:
/* int4 AVG function */
/* Fall through */
case 2102:
/* int2 AVG function */
/* Fall through */
case 2103:
/* numeric AVG function */
/* According to aggcombinefn, those aggregate functions need to fetch same columns from remote server. */
Expand All @@ -3116,7 +3113,6 @@ deparsePartialAggFunctionParamFilter(Aggref *node, deparse_expr_cxt *context,
break;
case 2104:
/* float4 AVG function */
/* Fall through */
case 2105:
/* float8 AVG function */
appendStringInfo(buf, "array[count(%s)%s, sum(%s)%s, count(%s)*var_pop(%s)%s]",
Expand Down
2 changes: 1 addition & 1 deletion contrib/postgres_fdw/postgres_fdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -6350,7 +6350,7 @@ postgresGetForeignUpperPaths(PlannerInfo *root, UpperRelationKind stage,
/* It's unsafe to push having statements with partial aggregates */
if (((GroupPathExtraData *) extra)->havingQual)
return;
/* Fall through */
fallthru;
/* Partial agg push down path */
case UPPERREL_GROUP_AGG:
add_foreign_grouping_paths(root, input_rel, output_rel,
Expand Down
2 changes: 1 addition & 1 deletion gpcontrib/gp_sparse_vector/operators.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ svec_count(PG_FUNCTION_ARGS)
* beginning of the accumulation of the correct dimension.
*/
left = makeSparseDataFromDouble(0.,right->total_value_count);
/* FALLTHROUGH */
fallthru;

case 0: //neither arg is scalar
case 2: //right arg is scalar
Expand Down
6 changes: 0 additions & 6 deletions src/backend/access/appendonly/appendonly_compaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,6 @@ AppendOptimizedDropDeadSegments(Relation aorel, Bitmapset *segnos, AOVacuumRelSt
void
AppendOptimizedTruncateToEOF(Relation aorel, AOVacuumRelStats *vacrelstats)
{
const char *relname;
Relation pg_aoseg_rel;
TupleDesc pg_aoseg_dsc;
SysScanDesc aoscan;
Expand All @@ -698,8 +697,6 @@ AppendOptimizedTruncateToEOF(Relation aorel, AOVacuumRelStats *vacrelstats)

Assert(RelationStorageIsAO(aorel));

relname = RelationGetRelationName(aorel);

/*
* The algorithm below for choosing a target segment is not concurrent-safe.
* Grab a lock to serialize.
Expand Down Expand Up @@ -790,16 +787,13 @@ AppendOnlyCompact(Relation aorel,
List *avoid_segnos,
AOVacuumRelStats *vacrelstats)
{
const char *relname;
AppendOnlyInsertDesc insertDesc = NULL;
FileSegInfo *fsinfo;
Snapshot appendOnlyMetaDataSnapshot = RegisterSnapshot(GetCatalogSnapshot(InvalidOid));

Assert(RelationStorageIsAoRows(aorel));
Assert(Gp_role == GP_ROLE_EXECUTE || Gp_role == GP_ROLE_UTILITY);

relname = RelationGetRelationName(aorel);

/* Fetch under the write lock to get latest committed eof. */
fsinfo = GetFileSegInfo(aorel, appendOnlyMetaDataSnapshot, compaction_segno, true);

Expand Down
4 changes: 0 additions & 4 deletions src/backend/access/appendonly/appendonlywriter.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ void
LockSegnoForWrite(Relation rel, int segno)
{
Relation pg_aoseg_rel;
TupleDesc pg_aoseg_dsc;
SysScanDesc aoscan;
HeapTuple tuple;
Snapshot snapshot;
Expand All @@ -171,7 +170,6 @@ LockSegnoForWrite(Relation rel, int segno)
* size threshold (90% full).
*/
pg_aoseg_rel = table_open(segrelid, AccessShareLock);
pg_aoseg_dsc = RelationGetDescr(pg_aoseg_rel);

/*
* Obtain the snapshot that is taken at the beginning of the transaction.
Expand Down Expand Up @@ -385,7 +383,6 @@ static int
choose_segno_internal(Relation rel, List *avoid_segnos, choose_segno_mode mode)
{
Relation pg_aoseg_rel;
TupleDesc pg_aoseg_dsc;
int i;
int32 chosen_segno = -1;
candidate_segment candidates[MAX_AOREL_CONCURRENCY];
Expand Down Expand Up @@ -443,7 +440,6 @@ choose_segno_internal(Relation rel, List *avoid_segnos, choose_segno_mode mode)
* size threshold (90% full).
*/
pg_aoseg_rel = heap_open(segrelid, AccessShareLock);
pg_aoseg_dsc = RelationGetDescr(pg_aoseg_rel);

/*
* Scan through all the pg_aoseg (or pg_aocs) entries, and make note of
Expand Down
3 changes: 0 additions & 3 deletions src/backend/access/bitmap/bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ bmbuild(Relation heap, Relation index, IndexInfo *indexInfo)
double reltuples;
BMBuildState bmstate;
IndexBuildResult *result;
TupleDesc tupDesc;

if (indexInfo->ii_Concurrent)
ereport(ERROR,
Expand All @@ -135,8 +134,6 @@ bmbuild(Relation heap, Relation index, IndexInfo *indexInfo)
errmsg("index \"%s\" already contains data",
RelationGetRelationName(index))));

tupDesc = RelationGetDescr(index);

/* initialize the bitmap index for MAIN_FORKNUM. */
_bitmap_init(index, RelationNeedsWAL(index), false);

Expand Down
2 changes: 0 additions & 2 deletions src/backend/access/bitmap/bitmaputil.c
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,6 @@ _bitmap_log_bitmapwords(Relation rel,
xl_bm_bitmapwords xlBitmapWords;
ListCell *lcp;
ListCell *lcb;
bool init_page;
int num_bm_pages = list_length(xl_bm_bitmapword_pages);
int current_page = 0;

Expand Down Expand Up @@ -1064,7 +1063,6 @@ _bitmap_log_bitmapwords(Relation rel,
rdata_no = 1;

/* Write per-page structs */
init_page = init_first_page;
forboth(lcp, xl_bm_bitmapword_pages, lcb, bitmapBuffers)
{
xl_bm_bitmapwords_perpage *xlBitmapwordsPage = lfirst(lcp);
Expand Down
5 changes: 3 additions & 2 deletions src/backend/access/external/url.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "libpq/libpq-be.h"
#include "miscadmin.h"
#include "postmaster/postmaster.h" /* postmaster port */
#include "storage/proc.h"
#include "tcop/tcopprot.h"
#include "utils/builtins.h"
#include "utils/guc.h"
Expand Down Expand Up @@ -109,9 +110,9 @@ external_set_env_vars_ext(extvar_t *extvar, char *uri, bool csv, char *escape, c
* "session id"-"command id" to identify the transaction.
*/
if (!getDistributedTransactionIdentifier(extvar->GP_XID))
sprintf(extvar->GP_XID, "%u-%.10u", gp_session_id, gp_command_count);
sprintf(extvar->GP_XID, "%u-%.10u", gp_session_id, MyProc->queryCommandId);

sprintf(extvar->GP_CID, "%x", gp_command_count);
sprintf(extvar->GP_CID, "%x", MyProc->queryCommandId);
sprintf(extvar->GP_SN, "%x", scancounter);
sprintf(extvar->GP_SEGMENT_ID, "%d", GpIdentity.segindex);
sprintf(extvar->GP_SEG_PORT, "%d", PostPortNumber);
Expand Down
2 changes: 1 addition & 1 deletion src/backend/access/heap/heapam_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ heapam_relation_copy_for_cluster(Relation OldHeap, Relation NewHeap,
break;
case HEAPTUPLE_RECENTLY_DEAD:
*tups_recently_dead += 1;
/* fall through */
fallthru;
case HEAPTUPLE_LIVE:
/* Live or recently dead, must copy it */
isdead = false;
Expand Down
5 changes: 5 additions & 0 deletions src/backend/access/transam/xlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -2155,7 +2155,9 @@ AdvanceXLInsertBuffer(XLogRecPtr upto, bool opportunistic)
XLogRecPtr NewPageEndPtr = InvalidXLogRecPtr;
XLogRecPtr NewPageBeginPtr;
XLogPageHeader NewPage;
#ifdef WAL_DEBUG
int npages = 0;
#endif

LWLockAcquire(WALBufMappingLock, LW_EXCLUSIVE);

Expand Down Expand Up @@ -2310,7 +2312,9 @@ AdvanceXLInsertBuffer(XLogRecPtr upto, bool opportunistic)

XLogCtl->InitializedUpTo = NewPageEndPtr;

#ifdef WAL_DEBUG
npages++;
#endif
}
LWLockRelease(WALBufMappingLock);

Expand Down Expand Up @@ -7753,6 +7757,7 @@ StartupXLOG(void)
recoveryPausesHere();

/* drop into promote */
fallthru;

case RECOVERY_TARGET_ACTION_PROMOTE:
break;
Expand Down
2 changes: 1 addition & 1 deletion src/backend/catalog/dependency.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ findDependentObjects(const ObjectAddress *object,
break;

/* Otherwise, treat this like an internal dependency */
/* FALL THRU */
fallthru;

case DEPENDENCY_INTERNAL:

Expand Down
2 changes: 1 addition & 1 deletion src/backend/catalog/objectaddress.c
Original file line number Diff line number Diff line change
Expand Up @@ -2172,7 +2172,7 @@ pg_get_object_address(PG_FUNCTION_ARGS)
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("name list length must be at least %d", 3)));
/* fall through to check args length */
/* FALLTHROUGH */
fallthru;
case OBJECT_OPERATOR:
if (list_length(args) != 2)
ereport(ERROR,
Expand Down
3 changes: 2 additions & 1 deletion src/backend/cdb/cdbdtxcontextinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "cdb/cdbvars.h"
#include "cdb/cdbtm.h"
#include "access/xact.h"
#include "storage/proc.h"
#include "utils/guc.h"
#include "utils/session_state.h"

Expand Down Expand Up @@ -62,7 +63,7 @@ DtxContextInfo_CreateOnCoordinator(DtxContextInfo *dtxContextInfo, bool inCursor

AssertImply(inCursor,
dtxContextInfo->distributedXid != InvalidDistributedTransactionId &&
gp_command_count == MySessionState->latestCursorCommandId);
MyProc->queryCommandId == MySessionState->latestCursorCommandId);

dtxContextInfo->cursorContext = inCursor;
dtxContextInfo->nestingLevel = GetCurrentTransactionNestLevel();
Expand Down
4 changes: 3 additions & 1 deletion src/backend/cdb/cdbthreadlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "miscadmin.h"
#include "pgtime.h"
#include "postmaster/syslogger.h"
#include "storage/proc.h"


#ifndef _WIN32
Expand Down Expand Up @@ -166,7 +167,8 @@ write_log(const char *fmt,...)
sprintf(tempbuf, "%d", MyProcPid);
strcat(logprefix, tempbuf); /* pid */
strcat(logprefix, "|");
sprintf(tempbuf, "con%d cmd%d", gp_session_id, gp_command_count);
sprintf(tempbuf, "con%d cmd%d",
gp_session_id, MyProc != NULL ? MyProc->queryCommandId : 0);
strcat(logprefix, tempbuf);

strcat(logprefix, "|");
Expand Down
2 changes: 1 addition & 1 deletion src/backend/cdb/cdbtm.c
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ doNotifyingAbort(void)
setCurrentDtxState(DTX_STATE_RETRY_ABORT_PREPARED);
setDistributedTransactionContext(DTX_CONTEXT_QD_RETRY_PHASE_2);
}
/* FALL THRU */
fallthru;

case DTX_STATE_RETRY_ABORT_PREPARED:
retryAbortPrepared();
Expand Down
Loading

0 comments on commit 5a70a36

Please sign in to comment.